@nubisco/ui 1.59.1 → 1.60.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/README.md +7 -0
- package/dist/components/Shell.vue.d.ts.map +1 -1
- package/dist/components/SidebarMenuItem.vue.d.ts.map +1 -1
- package/dist/components/Tabs.d.ts +58 -0
- package/dist/components/Tabs.vue.d.ts +31 -0
- package/dist/components/Tabs.vue.d.ts.map +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/global.d.ts +2 -0
- package/dist/index.cjs +8 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +10310 -10163
- package/dist/index.mjs.map +1 -1
- package/dist/main.d.ts +2 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/ui.css +1 -1
- package/dist/utils/slotContent.helper.d.ts +17 -0
- package/dist/utils/slotContent.helper.d.ts.map +1 -0
- package/package.json +1 -1
- package/src/utils/slotContent.helper.ts +36 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type Slots, type VNode } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* True when the vnodes would render something visible.
|
|
4
|
+
*
|
|
5
|
+
* Comments (Vue's `v-if` placeholders) and whitespace-only text do not count;
|
|
6
|
+
* fragments are searched recursively.
|
|
7
|
+
*
|
|
8
|
+
* Note the limit: a component vnode always counts, because whether it renders
|
|
9
|
+
* anything is only known after it renders. `<RouterView name="x" />` therefore
|
|
10
|
+
* reads as content even on routes registering no `x` view. Consumers that only
|
|
11
|
+
* need to *style* the empty case should prefer a CSS `:empty` guard, which is
|
|
12
|
+
* evaluated against the real DOM and re-evaluated on navigation.
|
|
13
|
+
*/
|
|
14
|
+
export declare function hasRenderableContent(nodes: VNode[]): boolean;
|
|
15
|
+
/** True when the named slot has renderable content. */
|
|
16
|
+
export declare function hasSlotContent(slots: Slots, name: string): boolean;
|
|
17
|
+
//# sourceMappingURL=slotContent.helper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"slotContent.helper.d.ts","sourceRoot":"","sources":["../../src/utils/slotContent.helper.ts"],"names":[],"mappings":"AAAA,OAAO,EAA2B,KAAK,KAAK,EAAE,KAAK,KAAK,EAAE,MAAM,KAAK,CAAA;AAErE;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,OAAO,CAe5D;AAED,uDAAuD;AACvD,wBAAgB,cAAc,CAAC,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAGlE"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Comment, Fragment, Text, type Slots, type VNode } from 'vue'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* True when the vnodes would render something visible.
|
|
5
|
+
*
|
|
6
|
+
* Comments (Vue's `v-if` placeholders) and whitespace-only text do not count;
|
|
7
|
+
* fragments are searched recursively.
|
|
8
|
+
*
|
|
9
|
+
* Note the limit: a component vnode always counts, because whether it renders
|
|
10
|
+
* anything is only known after it renders. `<RouterView name="x" />` therefore
|
|
11
|
+
* reads as content even on routes registering no `x` view. Consumers that only
|
|
12
|
+
* need to *style* the empty case should prefer a CSS `:empty` guard, which is
|
|
13
|
+
* evaluated against the real DOM and re-evaluated on navigation.
|
|
14
|
+
*/
|
|
15
|
+
export function hasRenderableContent(nodes: VNode[]): boolean {
|
|
16
|
+
return nodes.some((node) => {
|
|
17
|
+
if (node.type === Comment) return false
|
|
18
|
+
if (node.type === Text) {
|
|
19
|
+
return (
|
|
20
|
+
typeof node.children === 'string' && node.children.trim().length > 0
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
if (node.type === Fragment) {
|
|
24
|
+
return Array.isArray(node.children)
|
|
25
|
+
? hasRenderableContent(node.children as VNode[])
|
|
26
|
+
: false
|
|
27
|
+
}
|
|
28
|
+
return true
|
|
29
|
+
})
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
/** True when the named slot has renderable content. */
|
|
33
|
+
export function hasSlotContent(slots: Slots, name: string): boolean {
|
|
34
|
+
const content = slots[name]?.()
|
|
35
|
+
return content ? hasRenderableContent(content) : false
|
|
36
|
+
}
|