@ui5/webcomponents-base 0.0.0-7c7170d4a → 0.0.0-7d8c57f70
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/.eslintignore +18 -0
- package/.eslintrc.cjs +3 -0
- package/CHANGELOG.md +22 -411
- package/README.md +8 -0
- package/bundle.esm.js +66 -0
- package/config/wdio.conf.cjs +8 -0
- package/dist/.tsbuildinfo +1 -1
- package/dist/Boot.js +4 -3
- package/dist/Boot.js.map +1 -1
- package/dist/CSP.d.ts +33 -0
- package/dist/CSP.js +54 -0
- package/dist/CSP.js.map +1 -0
- package/dist/Device.d.ts +2 -1
- package/dist/Device.js +12 -5
- package/dist/Device.js.map +1 -1
- package/dist/FeaturesRegistry.d.ts +10 -1
- package/dist/FeaturesRegistry.js +37 -1
- package/dist/FeaturesRegistry.js.map +1 -1
- package/dist/Keys.d.ts +1 -3
- package/dist/Keys.js +1 -5
- package/dist/Keys.js.map +1 -1
- package/dist/ManagedStyles.js +99 -21
- package/dist/ManagedStyles.js.map +1 -1
- package/dist/StaticAreaItem.d.ts +35 -0
- package/dist/StaticAreaItem.js +100 -0
- package/dist/StaticAreaItem.js.map +1 -0
- package/dist/UI5Element.d.ts +27 -12
- package/dist/UI5Element.js +64 -54
- package/dist/UI5Element.js.map +1 -1
- package/dist/UI5ElementMetadata.d.ts +6 -7
- package/dist/UI5ElementMetadata.js +7 -9
- package/dist/UI5ElementMetadata.js.map +1 -1
- package/dist/asset-registries/Icons.js +1 -1
- package/dist/asset-registries/Icons.js.map +1 -1
- package/dist/asset-registries/util/getIconCollectionByTheme.d.ts +3 -3
- package/dist/asset-registries/util/getIconCollectionByTheme.js +3 -3
- package/dist/asset-registries/util/getIconCollectionByTheme.js.map +1 -1
- package/dist/config/AnimationMode.js +1 -2
- package/dist/config/AnimationMode.js.map +1 -1
- package/dist/config/Theme.d.ts +2 -3
- package/dist/config/Theme.js +3 -7
- package/dist/config/Theme.js.map +1 -1
- package/dist/custom-elements-internal.json +2863 -0
- package/dist/custom-elements.json +2593 -0
- package/dist/decorators/customElement.d.ts +3 -2
- package/dist/decorators/customElement.js +5 -8
- package/dist/decorators/customElement.js.map +1 -1
- package/dist/features/OpenUI5Support.d.ts +2 -0
- package/dist/features/OpenUI5Support.js +25 -5
- package/dist/features/OpenUI5Support.js.map +1 -1
- package/dist/features/patchPopup.d.ts +3 -7
- package/dist/features/patchPopup.js +8 -43
- package/dist/features/patchPopup.js.map +1 -1
- package/dist/generated/AssetParameters.js +1 -1
- package/dist/generated/AssetParameters.js.map +1 -1
- package/dist/generated/VersionInfo.js +6 -6
- package/dist/generated/VersionInfo.js.map +1 -1
- package/dist/renderer/LitRenderer.js +8 -2
- package/dist/renderer/LitRenderer.js.map +1 -1
- package/dist/renderer/executeTemplate.d.ts +0 -8
- package/dist/renderer/executeTemplate.js +0 -1
- package/dist/renderer/executeTemplate.js.map +1 -1
- package/dist/sap/ui/thirdparty/caja-html-sanitizer.js +1 -1
- package/dist/ssr-dom.js +3 -0
- package/dist/ssr-dom.js.map +1 -0
- package/dist/theming/getConstructableStyle.d.ts +1 -1
- package/dist/theming/getConstructableStyle.js +3 -3
- package/dist/theming/getConstructableStyle.js.map +1 -1
- package/dist/theming/getEffectiveLinksHrefs.d.ts +3 -0
- package/dist/theming/getEffectiveLinksHrefs.js +17 -0
- package/dist/theming/getEffectiveLinksHrefs.js.map +1 -0
- package/dist/theming/getEffectiveStyle.d.ts +1 -1
- package/dist/theming/getEffectiveStyle.js +12 -5
- package/dist/theming/getEffectiveStyle.js.map +1 -1
- package/dist/theming/preloadLinks.d.ts +3 -0
- package/dist/theming/preloadLinks.js +19 -0
- package/dist/theming/preloadLinks.js.map +1 -0
- package/dist/types/ValueState.d.ts +3 -3
- package/dist/types/ValueState.js +3 -3
- package/dist/types/ValueState.js.map +1 -1
- package/dist/types.d.ts +2 -15
- package/dist/types.js.map +1 -1
- package/dist/updateShadowRoot.d.ts +2 -1
- package/dist/updateShadowRoot.js +29 -5
- package/dist/updateShadowRoot.js.map +1 -1
- package/dist/util/PopupUtils.d.ts +3 -1
- package/dist/util/PopupUtils.js +15 -1
- package/dist/util/PopupUtils.js.map +1 -1
- package/dist/util/createStyleInHead.d.ts +8 -0
- package/dist/util/createStyleInHead.js +18 -0
- package/dist/util/createStyleInHead.js.map +1 -0
- package/dist/util/dragAndDrop/DragRegistry.d.ts +1 -1
- package/dist/util/dragAndDrop/DragRegistry.js +0 -2
- package/dist/util/dragAndDrop/DragRegistry.js.map +1 -1
- package/dist/util/getClassCopy.d.ts +9 -8
- package/dist/vscode.html-custom-data.json +22 -0
- package/index.js +14 -0
- package/lib/generate-asset-parameters/index.js +27 -0
- package/lib/generate-styles/index.js +31 -0
- package/lib/generate-version-info/index.js +32 -0
- package/package-scripts.cjs +2 -9
- package/package.json +6 -13
- package/tsconfig.json +2 -2
- package/used-modules.txt +14 -0
- package/dist/features/InputElementsFormSupport.d.ts +0 -18
- package/dist/features/InputElementsFormSupport.js +0 -40
- package/dist/features/InputElementsFormSupport.js.map +0 -1
- package/dist/features/patchPatcher.d.ts +0 -11
- package/dist/features/patchPatcher.js +0 -11
- package/dist/features/patchPatcher.js.map +0 -1
- package/dist/locale/timezoneChange.d.ts +0 -5
- package/dist/types/AriaHasPopup.d.ts +0 -32
- package/dist/types/AriaHasPopup.js +0 -34
- package/dist/types/AriaHasPopup.js.map +0 -1
- package/dist/types/AriaLandmarkRole.d.ts +0 -79
- package/dist/types/AriaLandmarkRole.js +0 -81
- package/dist/types/AriaLandmarkRole.js.map +0 -1
- package/dist/types/AriaRole.d.ts +0 -27
- package/dist/types/AriaRole.js +0 -29
- package/dist/types/AriaRole.js.map +0 -1
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import getEffectiveLinksHrefs from "./getEffectiveLinksHrefs.js";
|
|
2
|
+
import createLinkInHead from "../util/createLinkInHead.js";
|
|
3
|
+
import { shouldUseLinks, shouldPreloadLinks } from "../CSP.js";
|
|
4
|
+
const preloaded = new Set();
|
|
5
|
+
const preloadLinks = (ElementClass) => {
|
|
6
|
+
if (!shouldUseLinks() || !shouldPreloadLinks()) {
|
|
7
|
+
return;
|
|
8
|
+
}
|
|
9
|
+
const linksHrefs = getEffectiveLinksHrefs(ElementClass, false) || [];
|
|
10
|
+
const staticAreaLinksHrefs = getEffectiveLinksHrefs(ElementClass, true) || [];
|
|
11
|
+
[...linksHrefs, ...staticAreaLinksHrefs].forEach(href => {
|
|
12
|
+
if (!preloaded.has(href)) {
|
|
13
|
+
createLinkInHead(href, { rel: "preload", as: "style" });
|
|
14
|
+
preloaded.add(href);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
export default preloadLinks;
|
|
19
|
+
//# sourceMappingURL=preloadLinks.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preloadLinks.js","sourceRoot":"","sources":["../../src/theming/preloadLinks.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,MAAM,6BAA6B,CAAC;AACjE,OAAO,gBAAgB,MAAM,6BAA6B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAG/D,MAAM,SAAS,GAAG,IAAI,GAAG,EAAU,CAAC;AAEpC,MAAM,YAAY,GAAG,CAAC,YAA+B,EAAE,EAAE;IACxD,IAAI,CAAC,cAAc,EAAE,IAAI,CAAC,kBAAkB,EAAE,EAAE;QAC/C,OAAO;KACP;IAED,MAAM,UAAU,GAAG,sBAAsB,CAAC,YAAY,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;IACrE,MAAM,oBAAoB,GAAG,sBAAsB,CAAC,YAAY,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC;IAE9E,CAAC,GAAG,UAAU,EAAE,GAAG,oBAAoB,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE;QACvD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE;YACzB,gBAAgB,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,SAAS,EAAE,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;YACxD,SAAS,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;SACpB;IACF,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import getEffectiveLinksHrefs from \"./getEffectiveLinksHrefs.js\";\nimport createLinkInHead from \"../util/createLinkInHead.js\";\nimport { shouldUseLinks, shouldPreloadLinks } from \"../CSP.js\";\nimport type UI5Element from \"../UI5Element.js\";\n\nconst preloaded = new Set<string>();\n\nconst preloadLinks = (ElementClass: typeof UI5Element) => {\n\tif (!shouldUseLinks() || !shouldPreloadLinks()) {\n\t\treturn;\n\t}\n\n\tconst linksHrefs = getEffectiveLinksHrefs(ElementClass, false) || [];\n\tconst staticAreaLinksHrefs = getEffectiveLinksHrefs(ElementClass, true) || [];\n\n\t[...linksHrefs, ...staticAreaLinksHrefs].forEach(href => {\n\t\tif (!preloaded.has(href)) {\n\t\t\tcreateLinkInHead(href, { rel: \"preload\", as: \"style\" });\n\t\t\tpreloaded.add(href);\n\t\t}\n\t});\n};\n\nexport default preloadLinks;\n"]}
|
|
@@ -11,15 +11,15 @@ declare enum ValueState {
|
|
|
11
11
|
/**
|
|
12
12
|
* @public
|
|
13
13
|
*/
|
|
14
|
-
|
|
14
|
+
Success = "Success",
|
|
15
15
|
/**
|
|
16
16
|
* @public
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
Warning = "Warning",
|
|
19
19
|
/**
|
|
20
20
|
* @public
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
Error = "Error",
|
|
23
23
|
/**
|
|
24
24
|
* @public
|
|
25
25
|
*/
|
package/dist/types/ValueState.js
CHANGED
|
@@ -12,15 +12,15 @@ var ValueState;
|
|
|
12
12
|
/**
|
|
13
13
|
* @public
|
|
14
14
|
*/
|
|
15
|
-
ValueState["
|
|
15
|
+
ValueState["Success"] = "Success";
|
|
16
16
|
/**
|
|
17
17
|
* @public
|
|
18
18
|
*/
|
|
19
|
-
ValueState["
|
|
19
|
+
ValueState["Warning"] = "Warning";
|
|
20
20
|
/**
|
|
21
21
|
* @public
|
|
22
22
|
*/
|
|
23
|
-
ValueState["
|
|
23
|
+
ValueState["Error"] = "Error";
|
|
24
24
|
/**
|
|
25
25
|
* @public
|
|
26
26
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ValueState.js","sourceRoot":"","sources":["../../src/types/ValueState.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,IAAK,UAyBJ;AAzBD,WAAK,UAAU;IACd;;OAEG;IACH,2BAAa,CAAA;IAEb;;OAEG;IACH,
|
|
1
|
+
{"version":3,"file":"ValueState.js","sourceRoot":"","sources":["../../src/types/ValueState.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,IAAK,UAyBJ;AAzBD,WAAK,UAAU;IACd;;OAEG;IACH,2BAAa,CAAA;IAEb;;OAEG;IACH,iCAAmB,CAAA;IAEnB;;OAEG;IACH,iCAAmB,CAAA;IAEnB;;OAEG;IACH,6BAAe,CAAA;IAEf;;OAEG;IACH,yCAA2B,CAAA;AAC5B,CAAC,EAzBI,UAAU,KAAV,UAAU,QAyBd;AAED,eAAe,UAAU,CAAC","sourcesContent":["/**\n * Different types of ValueStates.\n *\n * @public\n */\nenum ValueState {\n\t/**\n\t * @public\n\t */\n\tNone = \"None\",\n\n\t/**\n\t * @public\n\t */\n\tSuccess = \"Success\",\n\n\t/**\n\t * @public\n\t */\n\tWarning = \"Warning\",\n\n\t/**\n\t * @public\n\t */\n\tError = \"Error\",\n\n\t/**\n\t * @public\n\t */\n\tInformation = \"Information\",\n}\n\nexport default ValueState;\n"]}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import type AriaHasPopup from "./types/AriaHasPopup.js";
|
|
2
|
-
import type AriaRole from "./types/AriaRole.js";
|
|
3
1
|
type PromiseResolve = (value: void | PromiseLike<void>) => void;
|
|
4
2
|
type Timeout = ReturnType<typeof setTimeout>;
|
|
5
3
|
type Interval = ReturnType<typeof setInterval>;
|
|
@@ -18,10 +16,8 @@ type PassiveEventListenerObject = EventListenerObject & {
|
|
|
18
16
|
passive: boolean;
|
|
19
17
|
};
|
|
20
18
|
type LowercaseString<T> = T extends string ? Lowercase<T> : never;
|
|
21
|
-
type ARIARoles = LowercaseString<AriaRole>;
|
|
22
|
-
type ARIAHasPopup = LowercaseString<AriaHasPopup>;
|
|
23
19
|
type AccessibilityInfo = {
|
|
24
|
-
role?:
|
|
20
|
+
role?: LowercaseString<string>;
|
|
25
21
|
type?: LowercaseString<string>;
|
|
26
22
|
description?: string;
|
|
27
23
|
disabled?: boolean;
|
|
@@ -29,13 +25,4 @@ type AccessibilityInfo = {
|
|
|
29
25
|
required?: boolean;
|
|
30
26
|
children?: Array<HTMLElement>;
|
|
31
27
|
};
|
|
32
|
-
type
|
|
33
|
-
ariaSetsize?: number;
|
|
34
|
-
ariaPosinset?: number;
|
|
35
|
-
controls?: LowercaseString<string>;
|
|
36
|
-
expanded?: "true" | "false" | boolean;
|
|
37
|
-
hasPopup?: ARIAHasPopup;
|
|
38
|
-
name?: string;
|
|
39
|
-
role?: ARIARoles;
|
|
40
|
-
};
|
|
41
|
-
export type { AccessibilityInfo, AccessibilityAttributes, PromiseResolve, Timeout, Interval, StyleData, StyleDataCSP, ComponentStylesData, ClassMap, ClassMapValue, PassiveEventListenerObject, };
|
|
28
|
+
export type { AccessibilityInfo, PromiseResolve, Timeout, Interval, StyleData, StyleDataCSP, ComponentStylesData, ClassMap, ClassMapValue, PassiveEventListenerObject, };
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"","sourcesContent":["type PromiseResolve = (value: void | PromiseLike<void>) => void;\ntype Timeout = ReturnType<typeof setTimeout>;\ntype Interval = ReturnType<typeof setInterval>;\n\ntype StyleDataCSP = {\n\tcontent: string,\n\tpackageName: string,\n\tfileName: string,\n};\n\ntype StyleData = StyleDataCSP | string;\n\ntype ComponentStylesData = Array<ComponentStylesData> | Array<StyleData> | StyleData;\n\ntype ClassMapValue = Record<string, boolean>\n\ntype ClassMap = { [x: string] : ClassMapValue | ClassMap };\n\ntype PassiveEventListenerObject = EventListenerObject & { passive: boolean };\n\ntype LowercaseString<T> = T extends string ? Lowercase<T> : never;\n\ntype AccessibilityInfo = {\n\t// The WAI-ARIA role of the component.\n\trole?: LowercaseString<string>,\n\n\t// A translated text that represents the component type. Used when several components share same role,\n\t// f.e. Select and ComboBox both have role=\"combobox\".\n\ttype?: LowercaseString<string>,\n\n\t// A translated text that represents relevant component description/state - value, placeholder, label, etc.\n\tdescription?: string,\n\n\t // The component disabled state.\n\tdisabled?: boolean,\n\n\t// The component readonly state.\n\treadonly?: boolean,\n\n\t// The component required state.\n\trequired?: boolean,\n\n\t// An array of elements, aggregated by the component\n\t// <b>Note:</b> Children should only be provided when it is helpful to understand the accessibility context.\n\tchildren?: Array<HTMLElement>,\n}\n\nexport type {\n\tAccessibilityInfo,\n\tPromiseResolve,\n\tTimeout,\n\tInterval,\n\tStyleData,\n\tStyleDataCSP,\n\tComponentStylesData,\n\tClassMap,\n\tClassMapValue,\n\tPassiveEventListenerObject,\n};\n"]}
|
|
@@ -2,6 +2,7 @@ import type UI5Element from "./UI5Element.js";
|
|
|
2
2
|
/**
|
|
3
3
|
* Updates the shadow root of a UI5Element or its static area item
|
|
4
4
|
* @param element
|
|
5
|
+
* @param forStaticArea
|
|
5
6
|
*/
|
|
6
|
-
declare const updateShadowRoot: (element: UI5Element) => void;
|
|
7
|
+
declare const updateShadowRoot: (element: UI5Element, forStaticArea?: boolean) => void;
|
|
7
8
|
export default updateShadowRoot;
|
package/dist/updateShadowRoot.js
CHANGED
|
@@ -1,18 +1,42 @@
|
|
|
1
1
|
import getConstructableStyle from "./theming/getConstructableStyle.js";
|
|
2
|
+
import getEffectiveStyle from "./theming/getEffectiveStyle.js";
|
|
3
|
+
import getEffectiveLinksHrefs from "./theming/getEffectiveLinksHrefs.js";
|
|
4
|
+
import { shouldUseLinks } from "./CSP.js";
|
|
5
|
+
import { isSafari } from "./Device.js";
|
|
2
6
|
/**
|
|
3
7
|
* Updates the shadow root of a UI5Element or its static area item
|
|
4
8
|
* @param element
|
|
9
|
+
* @param forStaticArea
|
|
5
10
|
*/
|
|
6
|
-
const updateShadowRoot = (element) => {
|
|
11
|
+
const updateShadowRoot = (element, forStaticArea = false) => {
|
|
12
|
+
let styleStrOrHrefsArr;
|
|
7
13
|
const ctor = element.constructor;
|
|
8
|
-
const shadowRoot = element.shadowRoot;
|
|
9
|
-
|
|
14
|
+
const shadowRoot = forStaticArea ? element.staticAreaItem.shadowRoot : element.shadowRoot;
|
|
15
|
+
let renderResult;
|
|
16
|
+
if (forStaticArea) {
|
|
17
|
+
renderResult = element.renderStatic(); // this is checked before calling updateShadowRoot
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
renderResult = element.render(); // this is checked before calling updateShadowRoot
|
|
21
|
+
}
|
|
10
22
|
if (!shadowRoot) {
|
|
11
23
|
console.warn(`There is no shadow root to update`); // eslint-disable-line
|
|
12
24
|
return;
|
|
13
25
|
}
|
|
14
|
-
|
|
15
|
-
|
|
26
|
+
if (shouldUseLinks()) {
|
|
27
|
+
styleStrOrHrefsArr = getEffectiveLinksHrefs(ctor, forStaticArea);
|
|
28
|
+
}
|
|
29
|
+
else if (document.adoptedStyleSheets && !isSafari()) { // Chrome
|
|
30
|
+
shadowRoot.adoptedStyleSheets = getConstructableStyle(ctor, forStaticArea);
|
|
31
|
+
}
|
|
32
|
+
else { // FF, Safari
|
|
33
|
+
styleStrOrHrefsArr = getEffectiveStyle(ctor, forStaticArea);
|
|
34
|
+
}
|
|
35
|
+
if (ctor.renderer) {
|
|
36
|
+
ctor.renderer(renderResult, shadowRoot, styleStrOrHrefsArr, forStaticArea, { host: element });
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
ctor.render(renderResult, shadowRoot, styleStrOrHrefsArr, forStaticArea, { host: element });
|
|
16
40
|
};
|
|
17
41
|
export default updateShadowRoot;
|
|
18
42
|
//# sourceMappingURL=updateShadowRoot.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updateShadowRoot.js","sourceRoot":"","sources":["../src/updateShadowRoot.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,oCAAoC,CAAC;
|
|
1
|
+
{"version":3,"file":"updateShadowRoot.js","sourceRoot":"","sources":["../src/updateShadowRoot.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,oCAAoC,CAAC;AACvE,OAAO,iBAAiB,MAAM,gCAAgC,CAAC;AAC/D,OAAO,sBAAsB,MAAM,qCAAqC,CAAC;AACzE,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC;;;;GAIG;AACH,MAAM,gBAAgB,GAAG,CAAC,OAAmB,EAAE,aAAa,GAAG,KAAK,EAAE,EAAE;IACvE,IAAI,kBAAkB,CAAC;IACvB,MAAM,IAAI,GAAG,OAAO,CAAC,WAAgC,CAAC;IACtD,MAAM,UAAU,GAAG,aAAa,CAAC,CAAC,CAAC,OAAO,CAAC,cAAe,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,UAAU,CAAC;IAC3F,IAAI,YAAY,CAAC;IACjB,IAAI,aAAa,EAAE;QAClB,YAAY,GAAG,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC,kDAAkD;KACzF;SAAM;QACN,YAAY,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,kDAAkD;KACnF;IAED,IAAI,CAAC,UAAU,EAAE;QAChB,OAAO,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC,CAAC,sBAAsB;QACzE,OAAO;KACP;IAED,IAAI,cAAc,EAAE,EAAE;QACrB,kBAAkB,GAAG,sBAAsB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;KACjE;SAAM,IAAI,QAAQ,CAAC,kBAAkB,IAAI,CAAC,QAAQ,EAAE,EAAE,EAAE,SAAS;QACjE,UAAU,CAAC,kBAAkB,GAAG,qBAAqB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;KAC3E;SAAM,EAAE,aAAa;QACrB,kBAAkB,GAAG,iBAAiB,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;KAC5D;IAED,IAAI,IAAI,CAAC,QAAQ,EAAE;QAClB,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAE,aAAa,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;QAC9F,OAAO;KACP;IAED,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAE,aAAa,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;AAC7F,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import getConstructableStyle from \"./theming/getConstructableStyle.js\";\nimport getEffectiveStyle from \"./theming/getEffectiveStyle.js\";\nimport getEffectiveLinksHrefs from \"./theming/getEffectiveLinksHrefs.js\";\nimport { shouldUseLinks } from \"./CSP.js\";\nimport type UI5Element from \"./UI5Element.js\";\nimport { isSafari } from \"./Device.js\";\n\n/**\n * Updates the shadow root of a UI5Element or its static area item\n * @param element\n * @param forStaticArea\n */\nconst updateShadowRoot = (element: UI5Element, forStaticArea = false) => {\n\tlet styleStrOrHrefsArr;\n\tconst ctor = element.constructor as typeof UI5Element;\n\tconst shadowRoot = forStaticArea ? element.staticAreaItem!.shadowRoot : element.shadowRoot;\n\tlet renderResult;\n\tif (forStaticArea) {\n\t\trenderResult = element.renderStatic(); // this is checked before calling updateShadowRoot\n\t} else {\n\t\trenderResult = element.render(); // this is checked before calling updateShadowRoot\n\t}\n\n\tif (!shadowRoot) {\n\t\tconsole.warn(`There is no shadow root to update`); // eslint-disable-line\n\t\treturn;\n\t}\n\n\tif (shouldUseLinks()) {\n\t\tstyleStrOrHrefsArr = getEffectiveLinksHrefs(ctor, forStaticArea);\n\t} else if (document.adoptedStyleSheets && !isSafari()) { // Chrome\n\t\tshadowRoot.adoptedStyleSheets = getConstructableStyle(ctor, forStaticArea);\n\t} else { // FF, Safari\n\t\tstyleStrOrHrefsArr = getEffectiveStyle(ctor, forStaticArea);\n\t}\n\n\tif (ctor.renderer) {\n\t\tctor.renderer(renderResult, shadowRoot, styleStrOrHrefsArr, forStaticArea, { host: element });\n\t\treturn;\n\t}\n\n\tctor.render(renderResult, shadowRoot, styleStrOrHrefsArr, forStaticArea, { host: element });\n};\n\nexport default updateShadowRoot;\n"]}
|
|
@@ -2,4 +2,6 @@ declare const getFocusedElement: () => HTMLElement | null;
|
|
|
2
2
|
declare const isFocusedElementWithinNode: (node: HTMLElement) => boolean;
|
|
3
3
|
declare const isClickInRect: (e: MouseEvent | TouchEvent, rect: DOMRect) => boolean;
|
|
4
4
|
declare const getClosedPopupParent: (el: HTMLElement) => HTMLElement;
|
|
5
|
-
|
|
5
|
+
declare const getNextZIndex: () => number | undefined;
|
|
6
|
+
declare const getCurrentZIndex: () => number;
|
|
7
|
+
export { getFocusedElement, isClickInRect, getClosedPopupParent, getNextZIndex, getCurrentZIndex, isFocusedElementWithinNode, };
|
package/dist/util/PopupUtils.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import getSharedResource from "../getSharedResource.js";
|
|
2
|
+
import { getFeature } from "../FeaturesRegistry.js";
|
|
1
3
|
import getActiveElement from "./getActiveElement.js";
|
|
4
|
+
const popupUtilsData = getSharedResource("PopupUtilsData", { currentZIndex: 100 });
|
|
2
5
|
const getFocusedElement = () => {
|
|
3
6
|
const element = getActiveElement();
|
|
4
7
|
return (element && typeof element.focus === "function") ? element : null;
|
|
@@ -56,5 +59,16 @@ const getClosedPopupParent = (el) => {
|
|
|
56
59
|
}
|
|
57
60
|
return getClosedPopupParent(parent);
|
|
58
61
|
};
|
|
59
|
-
|
|
62
|
+
const getNextZIndex = () => {
|
|
63
|
+
const openUI5Support = getFeature("OpenUI5Support");
|
|
64
|
+
if (openUI5Support && openUI5Support.isOpenUI5Detected()) { // use OpenUI5 for getting z-index values, if loaded
|
|
65
|
+
return openUI5Support.getNextZIndex();
|
|
66
|
+
}
|
|
67
|
+
popupUtilsData.currentZIndex += 2;
|
|
68
|
+
return popupUtilsData.currentZIndex;
|
|
69
|
+
};
|
|
70
|
+
const getCurrentZIndex = () => {
|
|
71
|
+
return popupUtilsData.currentZIndex;
|
|
72
|
+
};
|
|
73
|
+
export { getFocusedElement, isClickInRect, getClosedPopupParent, getNextZIndex, getCurrentZIndex, isFocusedElementWithinNode, };
|
|
60
74
|
//# sourceMappingURL=PopupUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupUtils.js","sourceRoot":"","sources":["../../src/util/PopupUtils.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"PopupUtils.js","sourceRoot":"","sources":["../../src/util/PopupUtils.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,yBAAyB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AAOrD,MAAM,cAAc,GAAG,iBAAiB,CAAiB,gBAAgB,EAAE,EAAE,aAAa,EAAE,GAAG,EAAE,CAAC,CAAC;AAEnG,MAAM,iBAAiB,GAAG,GAAG,EAAE;IAC9B,MAAM,OAAO,GAAG,gBAAg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IAC1B,MAAM,cAAc,GAAG,UAAU,CAAwB,gBAAgB,CAAC,CAAC;IAC3E,IAAI,cAAc,IAAI,cAAc,CAAC,iBAAiB,EAAE,EAAE,EAAE,oDAAoD;QAC/G,OAAO,cAAc,CAAC,aAAa,EAAE,CAAC;KACtC;IAED,cAAc,CAAC,aAAa,IAAI,CAAC,CAAC;IAClC,OAAO,cAAc,CAAC,aAAa,CAAC;AACrC,CAAC,CAAC;AAEF,MAAM,gBAAgB,GAAG,GAAG,EAAE;IAC7B,OAAO,cAAc,CAAC,aAAa,CAAC;AACrC,CAAC,CAAC;AAEF,OAAO,EACN,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,0BAA0B,GAC1B,CAAC","sourcesContent":["import getSharedResource from \"../getSharedResource.js\";\nimport { getFeature } from \"../FeaturesRegistry.js\";\nimport getActiveElement from \"./getActiveElement.js\";\nimport type OpenUI5Support from \"../features/OpenUI5Support.js\";\n\ntype PopupUtilsData = {\n\tcurrentZIndex: number\n};\n\nconst popupUtilsData = getSharedResource<PopupUtilsData>(\"PopupUtilsData\", { currentZIndex: 100 });\n\nconst getFocusedElement = () => {\n\tconst element = getActiveElement() as HTMLElement;\n\treturn (element && typeof element.focus === \"function\") ? element : null;\n};\n\nconst isFocusedElementWithinNode = (node: HTMLElement) => {\n\tconst fe = getFocusedElement();\n\n\tif (fe) {\n\t\treturn isNodeContainedWithin(node, fe);\n\t}\n\n\treturn false;\n};\n\nconst isNodeContainedWithin = (parent: HTMLElement, child: HTMLElement): boolean => {\n\tlet currentNode: HTMLElement | undefined = parent;\n\n\tif (currentNode.shadowRoot) {\n\t\tconst children = Array.from(currentNode.shadowRoot.children) as Array<HTMLElement>;\n\t\tcurrentNode = children.find(n => n.localName !== \"style\");\n\n\t\tif (!currentNode) {\n\t\t\treturn false;\n\t\t}\n\t}\n\n\tif (currentNode === child) {\n\t\treturn true;\n\t}\n\n\tconst childNodes = currentNode.localName === \"slot\" ? (currentNode as HTMLSlotElement).assignedNodes() : currentNode.children;\n\n\tif (childNodes) {\n\t\treturn Array.from(childNodes).some(n => isNodeContainedWithin(n as HTMLElement, child));\n\t}\n\n\treturn false;\n};\n\nconst isPointInRect = (x: number, y: number, rect: DOMRect) => {\n\treturn x >= rect.left && x <= rect.right\n\t\t&& y >= rect.top && y <= rect.bottom;\n};\n\nconst isClickInRect = (e: MouseEvent | TouchEvent, rect: DOMRect) => {\n\tlet x;\n\tlet y;\n\n\tif (e instanceof MouseEvent) {\n\t\tx = e.clientX;\n\t\ty = e.clientY;\n\t} else {\n\t\tconst touch = e.touches[0];\n\t\tx = touch.clientX;\n\t\ty = touch.clientY;\n\t}\n\n\treturn isPointInRect(x, y, rect);\n};\n\ninterface PopupInterface { // Refactor: replace with Popup.js\n\t_show: () => void,\n\topen: boolean,\n}\nfunction instanceOfPopup(object: any): object is PopupInterface {\n\treturn \"isUI5Element\" in object && \"_show\" in object;\n}\n\nconst getClosedPopupParent = (el: HTMLElement): HTMLElement => {\n\tconst parent = el.parentElement || (el.getRootNode && (el.getRootNode() as ShadowRoot).host);\n\n\tif (parent && ((instanceOfPopup(parent) || parent === document.documentElement))) {\n\t\treturn parent as HTMLElement;\n\t}\n\n\treturn getClosedPopupParent(parent as HTMLElement);\n};\n\nconst getNextZIndex = () => {\n\tconst openUI5Support = getFeature<typeof OpenUI5Support>(\"OpenUI5Support\");\n\tif (openUI5Support && openUI5Support.isOpenUI5Detected()) { // use OpenUI5 for getting z-index values, if loaded\n\t\treturn openUI5Support.getNextZIndex();\n\t}\n\n\tpopupUtilsData.currentZIndex += 2;\n\treturn popupUtilsData.currentZIndex;\n};\n\nconst getCurrentZIndex = () => {\n\treturn popupUtilsData.currentZIndex;\n};\n\nexport {\n\tgetFocusedElement,\n\tisClickInRect,\n\tgetClosedPopupParent,\n\tgetNextZIndex,\n\tgetCurrentZIndex,\n\tisFocusedElementWithinNode,\n};\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a `<style>` tag in the `<head>` tag
|
|
3
|
+
* @param cssText - the CSS
|
|
4
|
+
* @param attributes - optional attributes to add to the tag
|
|
5
|
+
* @returns {HTMLElement}
|
|
6
|
+
*/
|
|
7
|
+
declare const createStyleInHead: (cssText: string, attributes?: Record<string, string>) => HTMLStyleElement;
|
|
8
|
+
export default createStyleInHead;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Creates a `<style>` tag in the `<head>` tag
|
|
3
|
+
* @param cssText - the CSS
|
|
4
|
+
* @param attributes - optional attributes to add to the tag
|
|
5
|
+
* @returns {HTMLElement}
|
|
6
|
+
*/
|
|
7
|
+
const createStyleInHead = (cssText, attributes) => {
|
|
8
|
+
const style = document.createElement("style");
|
|
9
|
+
style.type = "text/css";
|
|
10
|
+
if (attributes) {
|
|
11
|
+
Object.entries(attributes).forEach(pair => style.setAttribute(...pair));
|
|
12
|
+
}
|
|
13
|
+
style.textContent = cssText;
|
|
14
|
+
document.head.appendChild(style);
|
|
15
|
+
return style;
|
|
16
|
+
};
|
|
17
|
+
export default createStyleInHead;
|
|
18
|
+
//# sourceMappingURL=createStyleInHead.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createStyleInHead.js","sourceRoot":"","sources":["../../src/util/createStyleInHead.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,iBAAiB,GAAG,CAAC,OAAe,EAAE,UAAmC,EAAE,EAAE;IAClF,MAAM,KAAK,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC9C,KAAK,CAAC,IAAI,GAAG,UAAU,CAAC;IAExB,IAAI,UAAU,EAAE;QACf,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;KACxE;IAED,KAAK,CAAC,WAAW,GAAG,OAAO,CAAC;IAC5B,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IACjC,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["/**\n * Creates a `<style>` tag in the `<head>` tag\n * @param cssText - the CSS\n * @param attributes - optional attributes to add to the tag\n * @returns {HTMLElement}\n */\nconst createStyleInHead = (cssText: string, attributes?: Record<string, string>) => {\n\tconst style = document.createElement(\"style\");\n\tstyle.type = \"text/css\";\n\n\tif (attributes) {\n\t\tObject.entries(attributes).forEach(pair => style.setAttribute(...pair));\n\t}\n\n\tstyle.textContent = cssText;\n\tdocument.head.appendChild(style);\n\treturn style;\n};\n\nexport default createStyleInHead;\n"]}
|
|
@@ -6,8 +6,6 @@ const ondragstart = (e) => {
|
|
|
6
6
|
if (!e.dataTransfer || !(e.target instanceof HTMLElement)) {
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
|
-
e.dataTransfer.dropEffect = "move";
|
|
10
|
-
e.dataTransfer.effectAllowed = "move";
|
|
11
9
|
if (!selfManagedDragAreas.has(e.target)) {
|
|
12
10
|
draggedElement = e.target;
|
|
13
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragRegistry.js","sourceRoot":"","sources":["../../../src/util/dragAndDrop/DragRegistry.ts"],"names":[],"mappings":"AAEA,IAAI,cAAc,GAAuB,IAAI,CAAC;AAC9C,IAAI,sBAAsB,GAAG,KAAK,CAAC;AACnC,MAAM,WAAW,GAAG,IAAI,GAAG,EAAc,CAAC;AAC1C,MAAM,oBAAoB,GAAG,IAAI,GAAG,EAA4B,CAAC;AAEjE,MAAM,WAAW,GAAG,CAAC,CAAY,EAAE,EAAE;IACpC,IAAI,CAAC,CAAC,CAAC,YAAY,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,YAAY,WAAW,CAAC,EAAE;QAC1D,OAAO;KACP;IAED,
|
|
1
|
+
{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AC,CAAC;AAEF,MAAM,oBAAoB,GAAG,GAAG,EAAE;IACjC,QAAQ,CAAC,IAAI,CAAC,mBAAmB,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAC5D,QAAQ,CAAC,IAAI,CAAC,mBAAmB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACxD,QAAQ,CAAC,IAAI,CAAC,mBAAmB,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClD,sBAAsB,GAAG,KAAK,CAAC;AAChC,CAAC,CAAC;AAEF,MAAM,SAAS,GAAG,CAAC,UAAsB,EAAE,EAAE;IAC5C,WAAW,CAAC,GAAG,CAAC,UAAU,CAAC,CAAC;IAE5B,IAAI,CAAC,sBAAsB,EAAE;QAC5B,oBAAoB,EAAE,CAAC;KACvB;AACF,CAAC,CAAC;AAEF,MAAM,WAAW,GAAG,CAAC,UAAsB,EAAE,EAAE;IAC9C,WAAW,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAE/B,IAAI,WAAW,CAAC,IAAI,KAAK,CAAC,IAAI,sBAAsB,EAAE;QACrD,oBAAoB,EAAE,CAAC;KACvB;AACF,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,IAA8B,EAAE,EAAE;IAC7D,oBAAoB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAE/B,OAAO,iBAAiB,CAAC;AAC1B,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAAC,IAA8B,EAAE,EAAE;IAChE,oBAAoB,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACnC,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG;IACpB,SAAS;IACT,WAAW;IACX,kBAAkB;IAClB,qBAAqB;IACrB,iBAAiB;CACjB,CAAC;AAEF,eAAe,YAAY,CAAC","sourcesContent":["import type UI5Element from \"../../UI5Element\";\n\nlet draggedElement: HTMLElement | null = null;\nlet globalHandlersAttached = false;\nconst subscribers = new Set<UI5Element>();\nconst selfManagedDragAreas = new Set<HTMLElement | ShadowRoot>();\n\nconst ondragstart = (e: DragEvent) => {\n\tif (!e.dataTransfer || !(e.target instanceof HTMLElement)) {\n\t\treturn;\n\t}\n\n\tif (!selfManagedDragAreas.has(e.target)) {\n\t\tdraggedElement = e.target;\n\t}\n};\n\nconst ondragend = () => {\n\tdraggedElement = null;\n};\n\nconst ondrop = () => {\n\tdraggedElement = null;\n};\n\nconst setDraggedElement = (element: HTMLElement | null) => {\n\tdraggedElement = element;\n};\ntype SetDraggedElementFunction = typeof setDraggedElement;\n\nconst getDraggedElement = () => {\n\treturn draggedElement;\n};\n\nconst attachGlobalHandlers = () => {\n\tif (globalHandlersAttached) {\n\t\treturn;\n\t}\n\n\tdocument.body.addEventListener(\"dragstart\", ondragstart);\n\tdocument.body.addEventListener(\"dragend\", ondragend);\n\tdocument.body.addEventListener(\"drop\", ondrop);\n};\n\nconst detachGlobalHandlers = () => {\n\tdocument.body.removeEventListener(\"dragstart\", ondragstart);\n\tdocument.body.removeEventListener(\"dragend\", ondragend);\n\tdocument.body.removeEventListener(\"drop\", ondrop);\n\tglobalHandlersAttached = false;\n};\n\nconst subscribe = (subscriber: UI5Element) => {\n\tsubscribers.add(subscriber);\n\n\tif (!globalHandlersAttached) {\n\t\tattachGlobalHandlers();\n\t}\n};\n\nconst unsubscribe = (subscriber: UI5Element) => {\n\tsubscribers.delete(subscriber);\n\n\tif (subscribers.size === 0 && globalHandlersAttached) {\n\t\tdetachGlobalHandlers();\n\t}\n};\n\nconst addSelfManagedArea = (area: HTMLElement | ShadowRoot) => {\n\tselfManagedDragAreas.add(area);\n\n\treturn setDraggedElement;\n};\n\nconst removeSelfManagedArea = (area: HTMLElement | ShadowRoot) => {\n\tselfManagedDragAreas.delete(area);\n};\n\nconst DragRegistry = {\n\tsubscribe,\n\tunsubscribe,\n\taddSelfManagedArea,\n\tremoveSelfManagedArea,\n\tgetDraggedElement,\n};\n\nexport default DragRegistry;\nexport type {\n\tSetDraggedElementFunction,\n};\n"]}
|
|
@@ -19,10 +19,11 @@ declare const getClassCopy: (klass: typeof UI5Element, constructorCallback: () =
|
|
|
19
19
|
};
|
|
20
20
|
_doNotSyncAttributes: Set<string>;
|
|
21
21
|
_state: import("../UI5ElementMetadata.js").State;
|
|
22
|
-
_internals?: ElementInternals | undefined;
|
|
23
22
|
_getRealDomRef?: (() => HTMLElement) | undefined;
|
|
23
|
+
staticAreaItem?: import("../StaticAreaItem.js").default | undefined;
|
|
24
24
|
readonly _id: string;
|
|
25
25
|
render(): object;
|
|
26
|
+
renderStatic(): object;
|
|
26
27
|
connectedCallback(): Promise<void>;
|
|
27
28
|
disconnectedCallback(): void;
|
|
28
29
|
onBeforeRendering(): void;
|
|
@@ -42,7 +43,6 @@ declare const getClassCopy: (klass: typeof UI5Element, constructorCallback: () =
|
|
|
42
43
|
}) => void): void;
|
|
43
44
|
_onChildChange(slotName: string, childChangeInfo: import("../UI5Element.js").ChangeInfo): void;
|
|
44
45
|
attributeChangedCallback(name: string, oldValue: string | null, newValue: string | null): void;
|
|
45
|
-
formAssociatedCallback(): void;
|
|
46
46
|
_updateAttribute(name: string, newValue: import("../UI5ElementMetadata.js").PropertyValue): void;
|
|
47
47
|
_upgradeProperty(this: Record<string, any>, propertyName: string): void;
|
|
48
48
|
_upgradeAllProperties(): void;
|
|
@@ -72,10 +72,7 @@ declare const getClassCopy: (klass: typeof UI5Element, constructorCallback: () =
|
|
|
72
72
|
readonly isUI5Element: boolean;
|
|
73
73
|
readonly classes: import("../types.js").ClassMap;
|
|
74
74
|
readonly accessibilityInfo: import("../types.js").AccessibilityInfo;
|
|
75
|
-
|
|
76
|
-
readonly validationMessage: string | undefined;
|
|
77
|
-
checkValidity(): boolean | undefined;
|
|
78
|
-
reportValidity(): boolean | undefined;
|
|
75
|
+
getStaticAreaItemDomRef(): Promise<ShadowRoot | null>;
|
|
79
76
|
accessKey: string;
|
|
80
77
|
readonly accessKeyLabel: string;
|
|
81
78
|
autocapitalize: string;
|
|
@@ -402,15 +399,19 @@ declare const getClassCopy: (klass: typeof UI5Element, constructorCallback: () =
|
|
|
402
399
|
blur(): void;
|
|
403
400
|
};
|
|
404
401
|
template?: import("../renderer/executeTemplate.js").TemplateFunction | undefined;
|
|
402
|
+
staticAreaTemplate?: import("../renderer/executeTemplate.js").TemplateFunction | undefined;
|
|
405
403
|
_metadata: import("../UI5ElementMetadata.js").default;
|
|
406
|
-
|
|
407
|
-
|
|
404
|
+
render: import("../UI5Element.js").Renderer;
|
|
405
|
+
renderer?: import("../UI5Element.js").Renderer | undefined;
|
|
408
406
|
readonly observedAttributes: string[];
|
|
409
407
|
_needsShadowDOM(): boolean;
|
|
408
|
+
_needsStaticArea(): boolean;
|
|
410
409
|
_generateAccessors(): void;
|
|
411
410
|
metadata: import("../UI5ElementMetadata.js").Metadata;
|
|
412
411
|
styles: import("../types.js").ComponentStylesData;
|
|
412
|
+
readonly staticAreaStyles: import("../types.js").ComponentStylesData;
|
|
413
413
|
readonly dependencies: (typeof UI5Element)[];
|
|
414
|
+
cacheUniqueDependencies(this: typeof UI5Element): void;
|
|
414
415
|
getUniqueDependencies(this: typeof UI5Element): (typeof UI5Element)[];
|
|
415
416
|
whenDependenciesDefined(): Promise<(typeof UI5Element)[]>;
|
|
416
417
|
onDefine(): Promise<void>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1.1,
|
|
3
|
+
"tags": [
|
|
4
|
+
{
|
|
5
|
+
"name": "ui5element",
|
|
6
|
+
"description": "Base class for all UI5 Web Components\n\n\n---\n\n\n\n\n### **Methods:**\n - **onBeforeRendering(): _void_** - Called every time before the component renders.\n- **onAfterRendering(): _void_** - Called every time after the component renders.\n- **onEnterDOM(): _void_** - Called on connectedCallback - added to the DOM.\n- **onExitDOM(): _void_** - Called on disconnectedCallback - removed from the DOM.\n- **attachInvalidate(callback: _(param: InvalidationInfo) => void_): _void_** - Attach a callback that will be executed whenever the component is invalidated\n- **detachInvalidate(callback: _(param: InvalidationInfo) => void_): _void_** - Detach the callback that is executed whenever the component is invalidated\n- **onInvalidation(changeInfo: _ChangeInfo_): _void_** - A callback that is executed each time an already rendered component is invalidated (scheduled for re-rendering)\n- **getDomRef(): _HTMLElement | undefined_** - Returns the DOM Element inside the Shadow Root that corresponds to the opening tag in the UI5 Web Component's template\n*Note:* For logical (abstract) elements (items, options, etc...), returns the part of the parent's DOM that represents this option\nUse this method instead of \"this.shadowRoot\" to read the Shadow DOM, if ever necessary\n- **getFocusDomRef(): _HTMLElement | undefined_** - Returns the DOM Element marked with \"data-sap-focus-ref\" inside the template.\nThis is the element that will receive the focus by default.\n- **getFocusDomRefAsync(): _Promise<HTMLElement | undefined>_** - Waits for dom ref and then returns the DOM Element marked with \"data-sap-focus-ref\" inside the template.\nThis is the element that will receive the focus by default.\n- **focus(focusOptions: _FocusOptions_): _Promise<void>_** - Set the focus to the element, returned by \"getFocusDomRef()\" (marked by \"data-sap-focus-ref\")\n- **getSlottedNodes(): _Array<T>_** - Returns the actual children, associated with a slot.\nUseful when there are transitive slots in nested component scenarios and you don't want to get a list of the slots, but rather of their content.\n- **attachComponentStateFinalized(callback: _() => void_): _void_** - Attach a callback that will be executed whenever the component's state is finalized\n- **detachComponentStateFinalized(callback: _() => void_): _void_** - Detach the callback that is executed whenever the component's state is finalized\n- **getUniqueDependencies(): _Array<typeof UI5Element>_** - Returns a list of the unique dependencies for this UI5 Web Component\n- **define(): _Promise<typeof UI5Element>_** - Registers a UI5 Web Component in the browser window object\n- **getMetadata(): _UI5ElementMetadata_** - Returns an instance of UI5ElementMetadata.js representing this UI5 Web Component's full metadata (its and its parents')\nNote: not to be confused with the \"get metadata()\" method, which returns an object for this class's metadata only",
|
|
7
|
+
"attributes": [
|
|
8
|
+
{
|
|
9
|
+
"name": "effective-dir",
|
|
10
|
+
"description": "Determines whether the component should be rendered in RTL mode or not.\nReturns: \"rtl\", \"ltr\" or undefined",
|
|
11
|
+
"values": [{ "name": "any" }]
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
"name": "is-ui5-element",
|
|
15
|
+
"description": "Used to duck-type UI5 elements without using instanceof",
|
|
16
|
+
"values": [{ "name": "any" }]
|
|
17
|
+
}
|
|
18
|
+
],
|
|
19
|
+
"references": []
|
|
20
|
+
}
|
|
21
|
+
]
|
|
22
|
+
}
|
package/index.js
CHANGED
|
@@ -56,6 +56,13 @@ import { registerIconLoader } from "./dist/asset-registries/Icons.js";
|
|
|
56
56
|
// Boot.ts
|
|
57
57
|
import { attachBoot } from "./dist/Boot.js";
|
|
58
58
|
|
|
59
|
+
// CSP.ts
|
|
60
|
+
import {
|
|
61
|
+
setPackageCSSRoot,
|
|
62
|
+
setUseLinks,
|
|
63
|
+
setPreloadLinks,
|
|
64
|
+
} from "./dist/CSP.js";
|
|
65
|
+
|
|
59
66
|
// CustomElementsScope.ts
|
|
60
67
|
import {
|
|
61
68
|
setCustomElementsScopingSuffix,
|
|
@@ -68,6 +75,7 @@ import {
|
|
|
68
75
|
// Device.ts
|
|
69
76
|
import {
|
|
70
77
|
supportsTouch,
|
|
78
|
+
isIE,
|
|
71
79
|
isSafari,
|
|
72
80
|
isChrome,
|
|
73
81
|
isFirefox,
|
|
@@ -165,6 +173,11 @@ export {
|
|
|
165
173
|
// Boot.ts
|
|
166
174
|
attachBoot,
|
|
167
175
|
|
|
176
|
+
// CSP.ts
|
|
177
|
+
setPackageCSSRoot,
|
|
178
|
+
setUseLinks,
|
|
179
|
+
setPreloadLinks,
|
|
180
|
+
|
|
168
181
|
// CustomElementsScope.ts
|
|
169
182
|
setCustomElementsScopingSuffix,
|
|
170
183
|
getCustomElementsScopingSuffix,
|
|
@@ -174,6 +187,7 @@ export {
|
|
|
174
187
|
|
|
175
188
|
// Device.ts
|
|
176
189
|
supportsTouch,
|
|
190
|
+
isIE,
|
|
177
191
|
isSafari,
|
|
178
192
|
isChrome,
|
|
179
193
|
isFirefox,
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import fs from "fs/promises";
|
|
2
|
+
import assets from "@ui5/webcomponents-tools/assets-meta.js";
|
|
3
|
+
|
|
4
|
+
const fileContent = `const assetParameters = ${JSON.stringify(assets)};
|
|
5
|
+
|
|
6
|
+
const DEFAULT_THEME = assetParameters.themes.default;
|
|
7
|
+
const SUPPORTED_THEMES = assetParameters.themes.all;
|
|
8
|
+
const DEFAULT_LANGUAGE = assetParameters.languages.default;
|
|
9
|
+
const DEFAULT_LOCALE = assetParameters.locales.default;
|
|
10
|
+
const SUPPORTED_LOCALES = assetParameters.locales.all;
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
DEFAULT_THEME,
|
|
14
|
+
SUPPORTED_THEMES,
|
|
15
|
+
DEFAULT_LANGUAGE,
|
|
16
|
+
DEFAULT_LOCALE,
|
|
17
|
+
SUPPORTED_LOCALES,
|
|
18
|
+
};`;
|
|
19
|
+
|
|
20
|
+
const generate = async () => {
|
|
21
|
+
await fs.mkdir("src/generated/", { recursive: true });
|
|
22
|
+
return fs.writeFile("src/generated/AssetParameters.ts", fileContent);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
generate().then(() => {
|
|
26
|
+
console.log("Assets parameters generated.");
|
|
27
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import fs from 'fs/promises';
|
|
2
|
+
import path from "path";
|
|
3
|
+
import CleanCSS from "clean-css";
|
|
4
|
+
|
|
5
|
+
const generate = async () => {
|
|
6
|
+
await fs.mkdir("src/generated/css/", {recursive: true});
|
|
7
|
+
|
|
8
|
+
const files = (await fs.readdir("src/css/")).filter(file => file.endsWith(".css"));
|
|
9
|
+
const filesPromises = files.map(async file => {
|
|
10
|
+
let content = await fs.readFile(path.join("src/css/", file));
|
|
11
|
+
const res = new CleanCSS().minify(`${content}`);
|
|
12
|
+
content = `import type { StyleData } from "../../types.js";
|
|
13
|
+
|
|
14
|
+
const styleData: StyleData = {
|
|
15
|
+
packageName: "@ui5/webcomponents-base",
|
|
16
|
+
fileName: "${file}",
|
|
17
|
+
content: \`${res.styles}\`,
|
|
18
|
+
};
|
|
19
|
+
|
|
20
|
+
export default styleData;
|
|
21
|
+
`;
|
|
22
|
+
|
|
23
|
+
return fs.writeFile(path.join("src/generated/css/", `${file}.ts`), content);
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
return Promise.all(filesPromises);
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
generate().then(() => {
|
|
30
|
+
console.log("Styles files generated.");
|
|
31
|
+
});
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import fs from "fs/promises";
|
|
2
|
+
|
|
3
|
+
const generate = async () => {
|
|
4
|
+
const version = JSON.parse(await fs.readFile("package.json")).version;
|
|
5
|
+
|
|
6
|
+
// Parse version
|
|
7
|
+
const matches = version.match(/^([0-9]+)\.([0-9]+)\.([0-9]+)(.*)$/);
|
|
8
|
+
if (!matches) {
|
|
9
|
+
throw new Error("Unsupported version format");
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const isNext = version.match(/[a-f0-9]{9}$/);
|
|
13
|
+
const buildTime = Math.floor(new Date().getTime() / 1000);
|
|
14
|
+
|
|
15
|
+
const fileContent = `const VersionInfo = {
|
|
16
|
+
version: "${version}",
|
|
17
|
+
major: ${matches[1]},
|
|
18
|
+
minor: ${matches[2]},
|
|
19
|
+
patch: ${matches[3]},
|
|
20
|
+
suffix: "${matches[4]}",
|
|
21
|
+
isNext: ${isNext ? "true" : "false"},
|
|
22
|
+
buildTime: ${buildTime},
|
|
23
|
+
};
|
|
24
|
+
export default VersionInfo;`;
|
|
25
|
+
|
|
26
|
+
await fs.mkdir("src/generated/", { recursive: true });
|
|
27
|
+
await fs.writeFile("src/generated/VersionInfo.ts", fileContent);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
generate().then(() => {
|
|
31
|
+
console.log("Version info file generated.");
|
|
32
|
+
});
|
package/package-scripts.cjs
CHANGED
|
@@ -13,9 +13,9 @@ const LIB = path.join(__dirname, `../tools/lib/`);
|
|
|
13
13
|
const viteConfig = `-c "${require.resolve("@ui5/webcomponents-tools/components-package/vite.config.js")}"`;
|
|
14
14
|
|
|
15
15
|
const scripts = {
|
|
16
|
-
clean: "rimraf src/generated && rimraf dist && rimraf .port",
|
|
16
|
+
clean: "rimraf jsdoc-dist && rimraf src/generated && rimraf dist && rimraf .port",
|
|
17
17
|
lint: `eslint .`,
|
|
18
|
-
generate: "cross-env UI5_TS=true nps clean integrate copy generateAssetParameters generateVersionInfo generateStyles generateTemplates
|
|
18
|
+
generate: "cross-env UI5_TS=true nps clean integrate copy generateAssetParameters generateVersionInfo generateStyles generateTemplates",
|
|
19
19
|
prepare: "cross-env UI5_TS=true nps clean integrate copy generateAssetParameters generateVersionInfo generateStyles generateTemplates typescript integrate.no-remaining-require",
|
|
20
20
|
typescript: "tsc -b",
|
|
21
21
|
integrate: {
|
|
@@ -40,14 +40,7 @@ const scripts = {
|
|
|
40
40
|
generateAssetParameters: `node "${assetParametersScript}"`,
|
|
41
41
|
generateVersionInfo: `node "${versionScript}"`,
|
|
42
42
|
generateStyles: `node "${stylesScript}"`,
|
|
43
|
-
// these files are ignored in TS because the import in UI5Elments tries to load them from the dist and throws an error. create them empty here
|
|
44
|
-
generateSsrDom: `yarn nodetouch dist/ssr-dom.js dist/ssr-dom.d.ts`,
|
|
45
43
|
generateTemplates: `mkdirp src/generated/templates && cross-env UI5_BASE=true UI5_TS=true node "${LIB}/hbs2ui5/index.js" -d test/elements -o src/generated/templates`,
|
|
46
|
-
generateProd: {
|
|
47
|
-
"default": "nps generateProd.remove-dev-mode generateProd.copy-prod",
|
|
48
|
-
"remove-dev-mode": `node "${LIB}/remove-dev-mode/remove-dev-mode.mjs"`,
|
|
49
|
-
"copy-prod": `copy-and-watch "dist/sap/**/*" dist/prod/sap/`,
|
|
50
|
-
},
|
|
51
44
|
generateAPI: {
|
|
52
45
|
default: "nps generateAPI.generateCEM generateAPI.validateCEM",
|
|
53
46
|
generateCEM: `cem analyze --config "${LIB}/cem/custom-elements-manifest.config.mjs" --dev`,
|