@uniweb/kit 0.7.16 → 0.7.18

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@uniweb/kit",
3
- "version": "0.7.16",
3
+ "version": "0.7.18",
4
4
  "description": "Standard component library for Uniweb foundations",
5
5
  "type": "module",
6
6
  "exports": {
@@ -38,7 +38,7 @@
38
38
  "fuse.js": "^7.0.0",
39
39
  "shiki": "^3.0.0",
40
40
  "tailwind-merge": "^2.6.0",
41
- "@uniweb/core": "0.5.15"
41
+ "@uniweb/core": "0.5.17"
42
42
  },
43
43
  "peerDependencies": {
44
44
  "react": "^18.0.0 || ^19.0.0",
@@ -138,14 +138,20 @@ export function Icon({
138
138
  errorComponent,
139
139
  ...props
140
140
  }) {
141
- // Normalize props — handle icon as string ref ("lu-house", "lu:house"),
141
+ // Normalize props — handle icon/name as string ref ("lu-house", "lu:house"),
142
142
  // object ({ library, name }), or URL
143
143
  const parsedRef = typeof icon === 'string' ? parseIconRef(icon) : null
144
- const iconLibrary = library || parsedRef?.library || (typeof icon === 'object' ? icon.library : null)
145
- const iconName = name || parsedRef?.name || (typeof icon === 'object' ? icon.name : null)
144
+ const parsedName = !library && typeof name === 'string' ? parseIconRef(name) : null
145
+ let iconLibrary = library || parsedRef?.library || parsedName?.library || (typeof icon === 'object' ? icon.library : null)
146
+ const iconName = (parsedName ? parsedName.name : name) || parsedRef?.name || (typeof icon === 'object' ? icon.name : null)
146
147
  const iconUrl = url || (!parsedRef && typeof icon === 'string' ? icon : icon?.url)
147
148
  const iconSvg = svg || (typeof icon === 'object' ? icon.svg : null)
148
149
 
150
+ // Default to Lucide when name is given without a library and it's not a built-in
151
+ if (iconName && !iconLibrary && !BUILT_IN_ICONS[iconName]) {
152
+ iconLibrary = 'lu'
153
+ }
154
+
149
155
  // Check sync cache for SSR (pre-populated by prerender)
150
156
  const cachedSvg = useMemo(() => {
151
157
  if (iconLibrary && iconName) {
@@ -53,6 +53,7 @@ const SIZE_CLASSES = {
53
53
  */
54
54
  export function Article({
55
55
  content,
56
+ block,
56
57
  size = 'lg',
57
58
  className,
58
59
  children,
@@ -60,8 +61,13 @@ export function Article({
60
61
  }) {
61
62
  const sizeClass = SIZE_CLASSES[size] || SIZE_CLASSES.lg
62
63
 
63
- // Resolve content - if it's a ProseMirror doc, get the content array
64
+ // Get content from block if not provided directly
64
65
  let resolvedContent = content
66
+ if (!resolvedContent && block) {
67
+ resolvedContent = block.rawContent
68
+ }
69
+
70
+ // If it's a ProseMirror doc, get the content array
65
71
  if (resolvedContent?.type === 'doc') {
66
72
  resolvedContent = resolvedContent.content
67
73
  }
@@ -314,9 +314,18 @@ function RenderNode({ node, block, ...props }) {
314
314
  * @param {string} [props.className] - Additional CSS classes
315
315
  */
316
316
  export function Render({ content, block, className, ...props }) {
317
- if (!content) return null
317
+ // Get content from block if not provided directly
318
+ let resolvedContent = content
319
+ if (!resolvedContent && block) {
320
+ resolvedContent = block.rawContent
321
+ if (resolvedContent?.type === 'doc') {
322
+ resolvedContent = resolvedContent.content
323
+ }
324
+ }
325
+
326
+ if (!resolvedContent) return null
318
327
 
319
- const nodes = Array.isArray(content) ? content : [content]
328
+ const nodes = Array.isArray(resolvedContent) ? resolvedContent : [resolvedContent]
320
329
 
321
330
  return (
322
331
  <div className={cn('space-y-4', className)} {...props}>
@@ -90,13 +90,12 @@ export function Section({
90
90
  let resolvedContent = content
91
91
 
92
92
  if (!resolvedContent && block) {
93
- // Get parsed content from block
94
- resolvedContent = block.parsedContent || block.content
93
+ resolvedContent = block.rawContent
94
+ }
95
95
 
96
- // If it's a ProseMirror doc, get the content array
97
- if (resolvedContent?.type === 'doc') {
98
- resolvedContent = resolvedContent.content
99
- }
96
+ // If it's a ProseMirror doc, get the content array
97
+ if (resolvedContent?.type === 'doc') {
98
+ resolvedContent = resolvedContent.content
100
99
  }
101
100
 
102
101
  // Build classes