@plastic-js/plastic 1.0.8 → 1.0.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/package.json +1 -1
- package/src/jsx-runtime.js +6 -5
- package/src/router.js +10 -1
package/package.json
CHANGED
package/src/jsx-runtime.js
CHANGED
|
@@ -1339,12 +1339,13 @@ const setProp = (element, key, accessor)=> {
|
|
|
1339
1339
|
const renderApp = (container, node)=> {
|
|
1340
1340
|
const appNode = node2Element(node)
|
|
1341
1341
|
container.appendChild(appNode)
|
|
1342
|
-
//
|
|
1342
|
+
// Walk the full DOM subtree to find all component owners and fire their
|
|
1343
|
+
// onMount callbacks. The root node may be a native element (e.g. <div>)
|
|
1344
|
+
// which never gets an OWNER reference, but nested component outputs do.
|
|
1345
|
+
mountOwnedSubtree(appNode)
|
|
1346
|
+
|
|
1347
|
+
// Keep the root owner reference for cleanup disposal.
|
|
1343
1348
|
const owner = appNode[OWNER]
|
|
1344
|
-
// Execute root onMount callbacks if owner exists
|
|
1345
|
-
if (owner){
|
|
1346
|
-
runOwnerMounts(owner)
|
|
1347
|
-
}
|
|
1348
1349
|
|
|
1349
1350
|
// Return a disposer function
|
|
1350
1351
|
let disposed = false
|
package/src/router.js
CHANGED
|
@@ -813,6 +813,7 @@ const NavLink = ({
|
|
|
813
813
|
activeClass = 'active',
|
|
814
814
|
ariaCurrent = 'page',
|
|
815
815
|
end = false,
|
|
816
|
+
disabled = false,
|
|
816
817
|
...props
|
|
817
818
|
})=> {
|
|
818
819
|
const location = useLocation()
|
|
@@ -830,12 +831,20 @@ const NavLink = ({
|
|
|
830
831
|
})
|
|
831
832
|
const resolvedClassName = ()=> {
|
|
832
833
|
const baseClassName = typeof className === 'function' ? className() : className
|
|
833
|
-
const tokens = [baseClassName, isActive() ? activeClass : '']
|
|
834
|
+
const tokens = [baseClassName, isActive() && !disabled ? activeClass : '']
|
|
834
835
|
.filter(value=> typeof value === 'string' && value.trim())
|
|
835
836
|
.map(value=> value.trim())
|
|
836
837
|
return tokens.join(' ')
|
|
837
838
|
}
|
|
838
839
|
|
|
840
|
+
if (disabled){
|
|
841
|
+
return h('span', {
|
|
842
|
+
...props,
|
|
843
|
+
'aria-disabled': 'true',
|
|
844
|
+
className: resolvedClassName,
|
|
845
|
+
}, children)
|
|
846
|
+
}
|
|
847
|
+
|
|
839
848
|
return h(Link, {
|
|
840
849
|
...props,
|
|
841
850
|
to,
|