Skip to content

Commit

Permalink
Merge branch 'main' into textareastorybooksampleupdate
Browse files Browse the repository at this point in the history
  • Loading branch information
niyap committed Aug 30, 2023
2 parents 32cdffd + d512116 commit 7f393b4
Show file tree
Hide file tree
Showing 151 changed files with 4,725 additions and 452 deletions.
23 changes: 23 additions & 0 deletions .github/workflows/test-storybook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: CI - Storybook

on:
pull_request:
push:
branches:
- 'main'
jobs:
check:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'

- name: Install and Build
run: |
export NODE_OPTIONS="--max_old_space_size=4096"
yarn install
yarn build:playground
41 changes: 41 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,47 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [1.17.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.17.0-rc.1...v1.17.0-rc.2) (2023-08-24)


### Bug Fixes

* **icons:** fix "employee-approvals" icon cutt-off ([#7461](https://github.com/SAP/ui5-webcomponents/issues/7461)) ([40eb99c](https://github.com/SAP/ui5-webcomponents/commit/40eb99c76c93229d43c79797dee970fa53e7c8ad)), closes [#7410](https://github.com/SAP/ui5-webcomponents/issues/7410)
* **ui5-input:** apply correct button's box-shadow on hover ([#7439](https://github.com/SAP/ui5-webcomponents/issues/7439)) ([b77db6b](https://github.com/SAP/ui5-webcomponents/commit/b77db6b04579cfa479fe0802406da691edca0b04))
* **ui5-message-strip:** enhance storybook samples ([#7464](https://github.com/SAP/ui5-webcomponents/issues/7464)) ([0283e28](https://github.com/SAP/ui5-webcomponents/commit/0283e28b8993a37b98fc0acfb2e15d6fc6bc77f8))
* **ui5-multi-combobox:** adjust storybook sample ([#7441](https://github.com/SAP/ui5-webcomponents/issues/7441)) ([52562ec](https://github.com/SAP/ui5-webcomponents/commit/52562ecb5f6c91a447210827c0ff27c9f726cf9b))
* **ui5-page:** enhance storybook samples ([#7448](https://github.com/SAP/ui5-webcomponents/issues/7448)) ([d0b8b01](https://github.com/SAP/ui5-webcomponents/commit/d0b8b01c053853915646b077860a247400cff691))
* **ui5-panel:** enhance storybook samples ([#7403](https://github.com/SAP/ui5-webcomponents/issues/7403)) ([52be839](https://github.com/SAP/ui5-webcomponents/commit/52be839e70e1cb94b86e177ea3a1efc66fd7a981))
* **ui5-rating-indicator:** enhance storybook samples ([#7446](https://github.com/SAP/ui5-webcomponents/issues/7446)) ([dfc18f3](https://github.com/SAP/ui5-webcomponents/commit/dfc18f375d45183b36be13c14d98f5fc5683fb84))
* **ui5-slider:** enhance storybook samples ([#7460](https://github.com/SAP/ui5-webcomponents/issues/7460)) ([f942c9e](https://github.com/SAP/ui5-webcomponents/commit/f942c9eab70d9129624e306bb8a255b221f8db4c))
* **ui5-toast:** enhance storybook samples ([#7451](https://github.com/SAP/ui5-webcomponents/issues/7451)) ([9298747](https://github.com/SAP/ui5-webcomponents/commit/92987476d2238f512bae871aa1b8559a31b0a450))
* **ui5-wizard:** enhance storybook samples ([#7445](https://github.com/SAP/ui5-webcomponents/issues/7445)) ([62603b3](https://github.com/SAP/ui5-webcomponents/commit/62603b3e46061e1ccf761d58af5409aaad9f2a7c))





# [1.17.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.17.0-rc.0...v1.17.0-rc.1) (2023-08-17)


### Bug Fixes

* **ui5-date-picker:** align value state to react binding ([#7396](https://github.com/SAP/ui5-webcomponents/issues/7396)) ([c6e6a7b](https://github.com/SAP/ui5-webcomponents/commit/c6e6a7b5674e4934e590e66d391b731c29101e4a)), closes [#6993](https://github.com/SAP/ui5-webcomponents/issues/6993)
* **ui5-multi-combobox:** adjust 'paste' handling ([#7440](https://github.com/SAP/ui5-webcomponents/issues/7440)) ([dd658c5](https://github.com/SAP/ui5-webcomponents/commit/dd658c561bfcf56a4634355d3ac1b0f0113f9b05)), closes [#7330](https://github.com/SAP/ui5-webcomponents/issues/7330)
* **ui5-select:** fix header on phone & update items on options change ([#7455](https://github.com/SAP/ui5-webcomponents/issues/7455)) ([116594c](https://github.com/SAP/ui5-webcomponents/commit/116594c40fd9ba2800b325f15ab2de9fe10222c8))
* **ui5-split-button:** add css variables for active state ([#7450](https://github.com/SAP/ui5-webcomponents/issues/7450)) ([2885a4d](https://github.com/SAP/ui5-webcomponents/commit/2885a4d276bce1420c4e1589bd1fdc7e98933d05))


### Features

* **framework:** scope css variables per runtime and version ([#7449](https://github.com/SAP/ui5-webcomponents/issues/7449)) ([d3f6c2e](https://github.com/SAP/ui5-webcomponents/commit/d3f6c2efba9cfda389ea4d700a375f75b3e2996b))
* **ui5-menu:** make the item click event cancellable ([#7360](https://github.com/SAP/ui5-webcomponents/issues/7360)) ([18b21bf](https://github.com/SAP/ui5-webcomponents/commit/18b21bfdb90ba2672aeb055d9443f1875cf381c7)), closes [#5600](https://github.com/SAP/ui5-webcomponents/issues/5600)
* **ui5-multi-input, ui5-multi-combobox:** implement popover keyboard handling ([#7368](https://github.com/SAP/ui5-webcomponents/issues/7368)) ([3c047b4](https://github.com/SAP/ui5-webcomponents/commit/3c047b464fb6e6ece4c043531db239f991befd36))





# [1.17.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.16.0...v1.17.0-rc.0) (2023-08-10)


Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"packages/playground",
"packages/create-package"
],
"version": "1.17.0-rc.0",
"version": "1.17.0-rc.2",
"command": {
"publish": {
"allowBranch": "*",
Expand Down
19 changes: 19 additions & 0 deletions packages/base/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,25 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [1.17.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.17.0-rc.1...v1.17.0-rc.2) (2023-08-24)

**Note:** Version bump only for package @ui5/webcomponents-base





# [1.17.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.17.0-rc.0...v1.17.0-rc.1) (2023-08-17)


### Features

* **framework:** scope css variables per runtime and version ([#7449](https://github.com/SAP/ui5-webcomponents/issues/7449)) ([d3f6c2e](https://github.com/SAP/ui5-webcomponents/commit/d3f6c2efba9cfda389ea4d700a375f75b3e2996b))





# [1.17.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.16.0...v1.17.0-rc.0) (2023-08-10)


Expand Down
2 changes: 1 addition & 1 deletion packages/base/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// animations/
import scroll from "./dist/animations/scroll.js";
import slideDown from "./dist/animations/slideDown.js";
import slideUp from "./dist/animations/slideup.js";
import slideUp from "./dist/animations/slideUp.js";

// config/
import { getAnimationMode, setAnimationMode } from "./dist/config/AnimationMode.js";
Expand Down
6 changes: 3 additions & 3 deletions packages/base/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ui5/webcomponents-base",
"version": "1.17.0-rc.0",
"version": "1.17.0-rc.2",
"description": "UI5 Web Components: webcomponents.base",
"author": "SAP SE (https://www.sap.com)",
"license": "Apache-2.0",
Expand Down Expand Up @@ -37,8 +37,8 @@
"devDependencies": {
"@buxlabs/amd-to-es6": "0.16.1",
"@openui5/sap.ui.core": "1.116.0",
"@ui5/webcomponents-tools": "1.17.0-rc.0",
"chromedriver": "114.0.0",
"@ui5/webcomponents-tools": "1.17.0-rc.2",
"chromedriver": "116.0.0",
"clean-css": "^5.2.2",
"copy-and-watch": "^0.1.5",
"cross-env": "^7.0.3",
Expand Down
2 changes: 2 additions & 0 deletions packages/base/src/CustomElementsScope.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
getCustomElementsScopingRules,
shouldScopeCustomElement,
getEffectiveScopingSuffixForTag,
getScopedVarName,
} from "./CustomElementsScopeUtils.js";
import { registerFeature } from "./FeaturesRegistry.js";

Expand All @@ -30,4 +31,5 @@ export {
getCustomElementsScopingRules,
shouldScopeCustomElement,
getEffectiveScopingSuffixForTag,
getScopedVarName,
};
15 changes: 15 additions & 0 deletions packages/base/src/CustomElementsScopeUtils.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import VersionInfo from "./generated/VersionInfo.js";

let suf: string;

type Rules = {
Expand Down Expand Up @@ -105,11 +107,24 @@ const getEffectiveScopingSuffixForTag = (tag: string) => {
}
};

/**
* @public
* Used for getting a scoped name for a CSS variable using the same transformation used in the build
* @name the name of the css variable as written in the code
* @returns a variable name with the current version inserted as available at runtime
*/
const getScopedVarName = (name: string) => {
const versionStr = `v${VersionInfo.version.replaceAll(".", "-")}`;
const expr = /(--_?ui5)([^,:)\s]+)/g;
return name.replaceAll(expr, `$1-${versionStr}$2`);
};

export {
setCustomElementsScopingSuffix,
getCustomElementsScopingSuffix,
setCustomElementsScopingRules,
getCustomElementsScopingRules,
shouldScopeCustomElement,
getEffectiveScopingSuffixForTag,
getScopedVarName,
};
13 changes: 2 additions & 11 deletions packages/base/src/ManagedStyles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,14 @@ import createStyleInHead from "./util/createStyleInHead.js";
import createLinkInHead from "./util/createLinkInHead.js";
import { shouldUseLinks, getUrl } from "./CSP.js";
import { StyleData, StyleDataCSP } from "./types.js";
import { getCurrentRuntimeIndex } from "./Runtimes.js";
import { isSafari } from "./Device.js";

const getStyleId = (name: string, value: string) => {
return value ? `${name}|${value}` : name;
};

const createStyle = (data: StyleData, name: string, value = "") => {
let content = typeof data === "string" ? data : data.content;

if (content.includes("[_ui5host]")) {
content = content.replaceAll("[_ui5host]", `[_ui5rt${getCurrentRuntimeIndex()}]`);
}
const content = typeof data === "string" ? data : data.content;

if (shouldUseLinks()) {
const attributes = {} as Record<string, any>;
Expand All @@ -34,11 +29,7 @@ const createStyle = (data: StyleData, name: string, value = "") => {
};

const updateStyle = (data: StyleData, name: string, value = "") => {
let content = typeof data === "string" ? data : data.content;

if (content.includes("[_ui5host]")) {
content = content.replaceAll("[_ui5host]", `[_ui5rt${getCurrentRuntimeIndex()}]`);
}
const content = typeof data === "string" ? data : data.content;

if (shouldUseLinks()) {
const link = document.querySelector(`head>link[${name}="${value}"]`) as HTMLLinkElement;
Expand Down
3 changes: 0 additions & 3 deletions packages/base/src/StaticAreaItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import getEffectiveContentDensity from "./util/getEffectiveContentDensity.js";
import { getEffectiveScopingSuffixForTag } from "./CustomElementsScopeUtils.js";
import getEffectiveDir from "./locale/getEffectiveDir.js";
import type UI5Element from "./UI5Element.js";
import { getCurrentRuntimeIndex } from "./Runtimes.js";

const pureTagName = "ui5-static-area-item";
const popupIntegrationAttr = "data-sap-ui-integration-popup-content";
Expand Down Expand Up @@ -79,8 +78,6 @@ class StaticAreaItem extends HTMLElement {
}

_updateAdditionalAttrs() {
this.setAttribute(`_ui5rt${getCurrentRuntimeIndex()}`, "");
this.setAttribute("_ui5host", "");
this.setAttribute(pureTagName, "");
this.setAttribute(popupIntegrationAttr, "");
}
Expand Down
3 changes: 0 additions & 3 deletions packages/base/src/UI5Element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import arraysAreEqual from "./util/arraysAreEqual.js";
import { markAsRtlAware } from "./locale/RTLAwareRegistry.js";
import preloadLinks from "./theming/preloadLinks.js";
import executeTemplate from "./renderer/executeTemplate.js";
import { getCurrentRuntimeIndex } from "./Runtimes.js";
import type { TemplateFunction, TemplateFunctionResult } from "./renderer/executeTemplate.js";
import type { PromiseResolve, ComponentStylesData, ClassMap } from "./types.js";

Expand Down Expand Up @@ -175,8 +174,6 @@ abstract class UI5Element extends HTMLElement {
async connectedCallback() {
const ctor = this.constructor as typeof UI5Element;

this.setAttribute(`_ui5rt${getCurrentRuntimeIndex()}`, "");
this.setAttribute("_ui5host", "");
this.setAttribute(ctor.getMetadata().getPureTag(), "");
if (ctor.getMetadata().supportsF6FastNavigation()) {
this.setAttribute("data-sap-ui-fastnavgroup", "true");
Expand Down
77 changes: 77 additions & 0 deletions packages/base/src/connectToComponent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
import type UI5Element from "./UI5Element.js";
import { renderDeferred } from "./Render.js";
import { Interval } from "./types.js";

const MISSING_ELEMENT_POLL_TIMEOUT = 500; // how often to poll for not-yet-in-DOM friend elements
const connections = new Map<string, HTMLElement>();
const intervals = new Map<string, Interval>();

type ConnectOptions = {
host: UI5Element;
propName: string;
onConnect?: (friend: HTMLElement) => void;
onDisconnect?: (friend: HTMLElement) => void;
}

const connectToComponent = (options: ConnectOptions): HTMLElement | undefined => {
const host = options.host;
const propName = options.propName;
const friend = host[propName as keyof typeof host] as HTMLElement | string | undefined;

let connectedTo: HTMLElement | undefined;
if (friend === undefined || friend === "") {
connectedTo = undefined; // do not return early even if a "menu" property is not set - it may have been set before and cleanup must run
} else if (friend instanceof HTMLElement) {
connectedTo = friend;
} else {
const rootNode = host.getRootNode() as Document;
connectedTo = (rootNode.getElementById && rootNode.getElementById(friend)) || undefined;
}

const key = `${host._id}-${propName}`;
const prevConnectedTo = connections.get(key);

// Not connected - return undefined
if (!connectedTo) {
if (prevConnectedTo) { // but first disconnect, if needed
options.onDisconnect && options.onDisconnect(prevConnectedTo);
connections.delete(key);
}

// if friend element not in DOM yet, start polling
if (typeof friend === "string" && friend && !intervals.has(key)) {
const interval = setInterval(() => {
const rootNode = host.getRootNode() as Document;
const found = (rootNode.getElementById && rootNode.getElementById(friend));

if (found) {
clearInterval(intervals.get(key));
intervals.delete(key);
renderDeferred(host);
}
}, MISSING_ELEMENT_POLL_TIMEOUT);
intervals.set(key, interval);
}

return;
}

// If connected, but still polling, stop polling
if (intervals.has(key)) {
clearInterval(intervals.get(key));
intervals.delete(key);
}

// Connected - either for the first time, or to something else
if (prevConnectedTo !== connectedTo) {
if (prevConnectedTo) {
options.onDisconnect && options.onDisconnect(prevConnectedTo);
}
options.onConnect && options.onConnect(connectedTo);
connections.set(key, connectedTo);
}

return connections.get(key);
};

export default connectToComponent;
4 changes: 2 additions & 2 deletions packages/base/src/theming/applyTheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import getThemeDesignerTheme from "./getThemeDesignerTheme.js";
import { fireThemeLoaded } from "./ThemeLoaded.js";
import { getFeature } from "../FeaturesRegistry.js";
import { attachCustomThemeStylesToHead, getThemeRoot } from "../config/ThemeRoot.js";
import OpenUI5Support from "../features/OpenUI5Support.js";
import type OpenUI5Support from "../features/OpenUI5Support.js";
import { DEFAULT_THEME } from "../generated/AssetParameters.js";
import { getCurrentRuntimeIndex } from "../Runtimes.js";

Expand Down Expand Up @@ -56,7 +56,7 @@ const detectExternalTheme = async (theme: string) => {

// If OpenUI5Support is enabled, try to find out if it loaded variables
const openUI5Support = getFeature<typeof OpenUI5Support>("OpenUI5Support");
if (openUI5Support && OpenUI5Support.isOpenUI5Detected()) {
if (openUI5Support && openUI5Support.isOpenUI5Detected()) {
const varsLoaded = openUI5Support.cssVariablesLoaded();
if (varsLoaded) {
return {
Expand Down
16 changes: 16 additions & 0 deletions packages/create-package/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,22 @@
All notable changes to this project will be documented in this file.
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.

# [1.17.0-rc.2](https://github.com/SAP/ui5-webcomponents/compare/v1.17.0-rc.1...v1.17.0-rc.2) (2023-08-24)

**Note:** Version bump only for package @ui5/create-webcomponents-package





# [1.17.0-rc.1](https://github.com/SAP/ui5-webcomponents/compare/v1.17.0-rc.0...v1.17.0-rc.1) (2023-08-17)

**Note:** Version bump only for package @ui5/create-webcomponents-package





# [1.17.0-rc.0](https://github.com/SAP/ui5-webcomponents/compare/v1.16.0...v1.17.0-rc.0) (2023-08-10)

**Note:** Version bump only for package @ui5/create-webcomponents-package
Expand Down
2 changes: 1 addition & 1 deletion packages/create-package/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ui5/create-webcomponents-package",
"version": "1.17.0-rc.0",
"version": "1.17.0-rc.2",
"description": "UI5 Web Components: create package",
"author": "SAP SE (https://www.sap.com)",
"license": "Apache-2.0",
Expand Down
Loading

0 comments on commit 7f393b4

Please sign in to comment.