Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .yarn/patches/playground-elements-npm-0.18.1-d292eadd94.patch
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,19 @@ index 1c2996fe16a91fe52074e65144aca9e1098043fd..4259730b04a73d0f5f5fec00d558d97c
], PlaygroundPreview.prototype, "iframe", void 0);
__decorate([
query('slot')
diff --git a/playground-project.js b/playground-project.js
index 6d6c8452286d3c0d2cde0c22d65327881bcb1fbd..0b5be95e67a41fbfd8a12b573b500253351d2b4a 100644
--- a/playground-project.js
+++ b/playground-project.js
@@ -178,7 +178,7 @@ let PlaygroundProject = class PlaygroundProject extends LitElement {
return this._validImportMap;
}
get _normalizedSandboxBaseUrl() {
- const url = new URL(this.sandboxBaseUrl, import.meta.url);
+ const url = new URL(this.sandboxBaseUrl, location.href);
url.pathname = endWithSlash(url.pathname);
return url;
}
diff --git a/playground-typescript-worker.js b/playground-typescript-worker.js
index 764edfea8a536a660ad983d0aeb369c064ebfc22..6ff369d0bd0c28f80d83868932171c3608806a8a 100644
--- a/playground-typescript-worker.js
Expand Down
2 changes: 1 addition & 1 deletion packages/ai/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
"@custom-elements-manifest/analyzer": "^0.10.10",
"@ui5/cypress-internal": "0.1.0",
"@ui5/webcomponents-tools": "2.25.0-rc.0",
"cypress": "15.9.0",
"cypress": "15.18.1",
"vite": "5.4.21"
}
}
2 changes: 1 addition & 1 deletion packages/base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"@ui5/cypress-internal": "0.1.0",
"@ui5/webcomponents-tools": "2.25.0-rc.0",
"clean-css": "^5.2.2",
"cypress": "15.9.0",
"cypress": "15.18.1",
"mocha": "^11.7.2",
"replace-in-file": "^6.3.5",
"resolve": "^1.20.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/cypress-ct-ui5-webc/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"dependencies": {
"@cypress/mount-utils": "^4.1.2",
"cypress": "^15.3.0",
"cypress": "^15.18.1",
"preact": "^10.25.4"
},
"peerDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/cypress-internal/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
"dependencies": {
"@cypress/code-coverage": "^3.14.6",
"@ui5/cypress-ct-ui5-webc": "0.0.4",
"cypress": "15.9.0",
"cypress": "15.18.1",
"cypress-real-events": "^1.15.0",
"eslint-plugin-cypress": "^3.4.0",
"rimraf": "^3.0.2",
"typescript": "^5.6.2"
},
"peerDependencies": {
"@ui5/webcomponents-base": "2.14.0-rc.6"
"@ui5/webcomponents-base": "^2.14.0"
}
}
2 changes: 1 addition & 1 deletion packages/fiori/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
"@custom-elements-manifest/analyzer": "^0.10.10",
"@ui5/cypress-internal": "0.1.0",
"@ui5/webcomponents-tools": "2.25.0-rc.0",
"cypress": "15.9.0",
"cypress": "15.18.1",
"lit": "^2.0.0",
"vite": "5.4.21",
"yarn": "^1.22.22"
Expand Down
4 changes: 2 additions & 2 deletions packages/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,10 @@
"@custom-elements-manifest/analyzer": "^0.10.10",
"@ui5/cypress-internal": "0.1.0",
"@ui5/webcomponents-tools": "2.25.0-rc.0",
"cypress": "15.9.0",
"cypress": "15.18.1",
"jsdom": "^26.0.0",
"lit": "^2.0.0",
"vite": "5.4.21",
"vitest": "^3.0.2"
"vitest": "^3.2.7"
}
}
12 changes: 6 additions & 6 deletions packages/tools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
"@custom-elements-manifest/analyzer": "^0.10.10",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"@wdio/cli": "^7.19.7",
"@wdio/dot-reporter": "^7.19.7",
"@wdio/local-runner": "^7.19.7",
"@wdio/mocha-framework": "^7.19.7",
"@wdio/spec-reporter": "^7.19.7",
"@wdio/static-server-service": "^7.19.5",
"@wdio/cli": "^7.40.0",
"@wdio/dot-reporter": "^7.40.0",
"@wdio/local-runner": "^7.40.0",
"@wdio/mocha-framework": "^7.40.0",
"@wdio/spec-reporter": "^7.40.0",
"@wdio/static-server-service": "^7.40.0",
"ajv": "^8.12.0",
"cem-plugin-vs-code-custom-data-generator": "^1.4.2",
"chai": "^4.3.4",
Expand Down
10 changes: 5 additions & 5 deletions packages/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
},
"dependencies": {
"@babel/standalone": "^7.24.0",
"@docusaurus/core": "3.1.1",
"@docusaurus/preset-classic": "3.1.1",
"@docusaurus/core": "3.10.2",
"@docusaurus/preset-classic": "3.10.2",
"@mdx-js/react": "^3.0.0",
"@monaco-editor/react": "^4.6.0",
"clsx": "^2.0.0",
Expand All @@ -51,9 +51,9 @@
"tarts": "^2.0.1"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "3.1.1",
"@docusaurus/tsconfig": "3.1.1",
"@docusaurus/types": "3.1.1",
"@docusaurus/module-type-aliases": "3.10.2",
"@docusaurus/tsconfig": "3.10.2",
"@docusaurus/types": "3.10.2",
"copy-and-watch": "^0.1.5",
"dotenv-cli": "^7.4.1",
"pako": "^2.1.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/website/src/theme/DocItem/Content/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import clsx from 'clsx';
import {ThemeClassNames} from '@docusaurus/theme-common';
import {useDoc} from '@docusaurus/theme-common/internal';
import {useDoc} from '@docusaurus/plugin-content-docs/client';
import Heading from '@theme/Heading';
import MDXContent from '@theme/MDXContent';
import AskAI from '@site/src/components/AskAI';
Expand Down
132 changes: 92 additions & 40 deletions packages/website/src/theme/DocSidebarItem/Category/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,49 +7,53 @@ import {
Collapsible,
useCollapsible,
} from '@docusaurus/theme-common';
import {isSamePath} from '@docusaurus/theme-common/internal';
import {
isActiveSidebarItem,
findFirstSidebarItemLink,
useDocSidebarItemsExpandedState,
isSamePath,
} from '@docusaurus/theme-common/internal';
useVisibleSidebarItems,
} from '@docusaurus/plugin-content-docs/client';
import Link from '@docusaurus/Link';
import {translate} from '@docusaurus/Translate';
import useIsBrowser from '@docusaurus/useIsBrowser';
import DocSidebarItems from '@theme/DocSidebarItems';
// If we navigate to a category and it becomes active, it should automatically
// expand itself
function useAutoExpandActiveCategory({isActive, collapsed, updateCollapsed}) {
import DocSidebarItemLink from '@theme/DocSidebarItem/Link';
import styles from './styles.module.css';

function useAutoExpandActiveCategory({isActive, collapsed, updateCollapsed, activePath}) {
const wasActive = usePrevious(isActive);
const previousActivePath = usePrevious(activePath);
useEffect(() => {
const justBecameActive = isActive && !wasActive;
if (justBecameActive && collapsed) {
const stillActiveButPathChanged =
isActive && wasActive && activePath !== previousActivePath;
if ((justBecameActive || stillActiveButPathChanged) && collapsed) {
updateCollapsed(false);
}
}, [isActive, wasActive, collapsed, updateCollapsed]);
}, [
isActive,
wasActive,
collapsed,
updateCollapsed,
activePath,
previousActivePath,
]);
}
/**
* When a collapsible category has no link, we still link it to its first child
* during SSR as a temporary fallback. This allows to be able to navigate inside
* the category even when JS fails to load, is delayed or simply disabled
* React hydration becomes an optional progressive enhancement
* see https://github.com/facebookincubator/infima/issues/36#issuecomment-772543188
* see https://github.com/facebook/docusaurus/issues/3030
*/

function useCategoryHrefWithSSRFallback(item) {
const isBrowser = useIsBrowser();
return useMemo(() => {
if (item.href && !item.linkUnlisted) {
return item.href;
}
// In these cases, it's not necessary to render a fallback
// We skip the "findFirstCategoryLink" computation
if (isBrowser || !item.collapsible) {
return undefined;
}
return findFirstSidebarItemLink(item);
}, [item, isBrowser]);
}

function CollapseButton({collapsed, categoryLabel, onClick}) {
return (
<button
Expand All @@ -72,13 +76,54 @@ function CollapseButton({collapsed, categoryLabel, onClick}) {
{label: categoryLabel},
)
}
aria-expanded={!collapsed}
type="button"
className="clean-btn menu__caret"
onClick={onClick}
/>
);
}
export default function DocSidebarItemCategory({

function CategoryLinkLabel({label}) {
return <span className={styles.categoryLinkLabel}>{label}</span>;
}

export default function DocSidebarItemCategory(props) {
const visibleChildren = useVisibleSidebarItems(
props.item.items,
props.activePath,
);
if (visibleChildren.length === 0) {
return <DocSidebarItemCategoryEmpty {...props} />;
} else {
return <DocSidebarItemCategoryCollapsible {...props} />;
}
}

function isCategoryWithHref(category) {
return typeof category.href === 'string';
}

function DocSidebarItemCategoryEmpty({item, ...props}) {
if (!isCategoryWithHref(item)) {
return null;
}
const {
type,
collapsed,
collapsible,
items,
linkUnlisted,
...forwardableProps
} = item;
const linkItem = {
type: 'link',
...forwardableProps,
};
return <DocSidebarItemLink item={linkItem} {...props} />;
}

function DocSidebarItemCategoryCollapsible({
item,
onItemClick,
activePath,
Expand All @@ -96,8 +141,6 @@ export default function DocSidebarItemCategory({
const isActive = isActiveSidebarItem(item, activePath);
const isCurrentPage = isSamePath(href, activePath);
const {collapsed, setCollapsed} = useCollapsible({
// Active categories are always initialized as expanded. The default
// (`item.collapsed`) is only used for non-active categories.
initialState: () => {
if (!collapsible) {
return false;
Expand All @@ -106,12 +149,16 @@ export default function DocSidebarItemCategory({
},
});
const {expandedItem, setExpandedItem} = useDocSidebarItemsExpandedState();
// Use this instead of `setCollapsed`, because it is also reactive
const updateCollapsed = (toCollapsed = !collapsed) => {
setExpandedItem(toCollapsed ? null : index);
setCollapsed(toCollapsed);
};
useAutoExpandActiveCategory({isActive, collapsed, updateCollapsed});
useAutoExpandActiveCategory({
isActive,
collapsed,
updateCollapsed,
activePath,
});
useEffect(() => {
if (
collapsible &&
Expand All @@ -122,6 +169,24 @@ export default function DocSidebarItemCategory({
setCollapsed(true);
}
}, [collapsible, expandedItem, index, setCollapsed, autoCollapseCategories]);

const handleItemClick = (e) => {
onItemClick?.(item);
if (collapsible) {
if (href) {
if (isCurrentPage) {
e.preventDefault();
updateCollapsed();
} else {
updateCollapsed(false);
}
} else {
e.preventDefault();
updateCollapsed();
}
}
};

return (
<li
className={clsx(
Expand All @@ -140,31 +205,18 @@ export default function DocSidebarItemCategory({
'menu__list-item-collapsible--active': isCurrentPage,
})}>
<Link
className={clsx('menu__link', {
className={clsx(styles.categoryLink, 'menu__link', {
'menu__link--sublist': collapsible,
'menu__link--sublist-caret': !href && collapsible,
'menu__link--active': isActive,
})}
onClick={
collapsible
? (e) => {
onItemClick?.(item);
if (href) {
updateCollapsed(false);
} else {
e.preventDefault();
updateCollapsed();
}
}
: () => {
onItemClick?.(item);
}
}
onClick={handleItemClick}
aria-current={isCurrentPage ? 'page' : undefined}
aria-expanded={collapsible ? !collapsed : undefined}
role={collapsible && !href ? 'button' : undefined}
aria-expanded={collapsible && !href ? !collapsed : undefined}
href={collapsible ? hrefWithSSRFallback ?? '#' : hrefWithSSRFallback}
{...props}>
{label}
<CategoryLinkLabel label={label} />
</Link>
{href && collapsible && (
<CollapseButton
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
.categoryLink {
overflow: hidden;
}

:global(.menu__link--sublist-caret)::after {
margin-left: var(--ifm-menu-link-padding-vertical);
}

.categoryLinkLabel {
flex: 1;
overflow: hidden;
display: -webkit-box;
line-clamp: 2;
-webkit-box-orient: vertical;
-webkit-line-clamp: 2;
}
Loading
Loading