@ui5/webcomponents-base 1.24.0-rc.4 → 2.0.0-rc.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/.eslintignore +0 -1
- package/CHANGELOG.md +271 -0
- package/README.md +0 -8
- package/bundle.esm.js +0 -1
- package/config/wdio.conf.cjs +0 -8
- package/dist/.tsbuildinfo +1 -1
- package/dist/Device.d.ts +1 -2
- package/dist/Device.js +5 -12
- package/dist/Device.js.map +1 -1
- package/dist/ManagedStyles.js +21 -99
- package/dist/ManagedStyles.js.map +1 -1
- package/dist/UI5Element.d.ts +5 -26
- package/dist/UI5Element.js +22 -53
- package/dist/UI5Element.js.map +1 -1
- package/dist/custom-elements-internal.json +0 -76
- package/dist/custom-elements.json +0 -76
- package/dist/decorators/customElement.d.ts +0 -2
- package/dist/decorators/customElement.js +2 -3
- package/dist/decorators/customElement.js.map +1 -1
- package/dist/features/OpenUI5Support.d.ts +0 -2
- package/dist/features/OpenUI5Support.js +2 -23
- package/dist/features/OpenUI5Support.js.map +1 -1
- package/dist/generated/VersionInfo.js +5 -5
- package/dist/generated/VersionInfo.js.map +1 -1
- package/dist/renderer/LitRenderer.js +2 -8
- package/dist/renderer/LitRenderer.js.map +1 -1
- 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/getEffectiveStyle.d.ts +1 -1
- package/dist/theming/getEffectiveStyle.js +5 -12
- package/dist/theming/getEffectiveStyle.js.map +1 -1
- package/dist/updateShadowRoot.d.ts +1 -2
- package/dist/updateShadowRoot.js +5 -29
- package/dist/updateShadowRoot.js.map +1 -1
- package/dist/util/PopupUtils.d.ts +1 -3
- package/dist/util/PopupUtils.js +1 -15
- package/dist/util/PopupUtils.js.map +1 -1
- package/dist/util/dragAndDrop/DragRegistry.d.ts +1 -1
- package/dist/util/dragAndDrop/DragRegistry.js.map +1 -1
- package/dist/util/getClassCopy.d.ts +1 -8
- package/index.js +0 -14
- package/package-scripts.cjs +1 -1
- package/package.json +3 -3
- package/dist/CSP.d.ts +0 -33
- package/dist/CSP.js +0 -54
- package/dist/CSP.js.map +0 -1
- package/dist/StaticAreaItem.d.ts +0 -35
- package/dist/StaticAreaItem.js +0 -100
- package/dist/StaticAreaItem.js.map +0 -1
- package/dist/theming/getEffectiveLinksHrefs.d.ts +0 -3
- package/dist/theming/getEffectiveLinksHrefs.js +0 -17
- package/dist/theming/getEffectiveLinksHrefs.js.map +0 -1
- package/dist/theming/preloadLinks.d.ts +0 -3
- package/dist/theming/preloadLinks.js +0 -19
- package/dist/theming/preloadLinks.js.map +0 -1
- package/dist/util/createStyleInHead.d.ts +0 -8
- package/dist/util/createStyleInHead.js +0 -18
- package/dist/util/createStyleInHead.js.map +0 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { registerFeature } from "../FeaturesRegistry.js";
|
|
2
2
|
import { setTheme } from "../config/Theme.js";
|
|
3
|
-
import { getCurrentZIndex } from "../util/PopupUtils.js";
|
|
4
3
|
class OpenUI5Support {
|
|
5
4
|
static isAtLeastVersion116() {
|
|
6
5
|
const version = window.sap.ui.version;
|
|
@@ -20,7 +19,7 @@ class OpenUI5Support {
|
|
|
20
19
|
return new Promise(resolve => {
|
|
21
20
|
window.sap.ui.require(["sap/ui/core/Core"], async (Core) => {
|
|
22
21
|
const callback = () => {
|
|
23
|
-
let deps = ["sap/ui/core/
|
|
22
|
+
let deps = ["sap/ui/core/LocaleData"];
|
|
24
23
|
if (OpenUI5Support.isAtLeastVersion116()) { // for versions since 1.116.0 and onward, use the modular core
|
|
25
24
|
deps = [
|
|
26
25
|
...deps,
|
|
@@ -31,10 +30,7 @@ class OpenUI5Support {
|
|
|
31
30
|
"sap/ui/core/date/CalendarUtils",
|
|
32
31
|
];
|
|
33
32
|
}
|
|
34
|
-
window.sap.ui.require(deps,
|
|
35
|
-
Popup.setInitialZIndex(getCurrentZIndex());
|
|
36
|
-
resolve();
|
|
37
|
-
});
|
|
33
|
+
window.sap.ui.require(deps, resolve);
|
|
38
34
|
};
|
|
39
35
|
if (OpenUI5Support.isAtLeastVersion116()) {
|
|
40
36
|
await Core.ready();
|
|
@@ -132,23 +128,6 @@ class OpenUI5Support {
|
|
|
132
128
|
}
|
|
133
129
|
return !!link.href.match(/\/css(-|_)variables\.css/);
|
|
134
130
|
}
|
|
135
|
-
static getNextZIndex() {
|
|
136
|
-
if (!OpenUI5Support.isOpenUI5Detected()) {
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
const Popup = window.sap.ui.require("sap/ui/core/Popup");
|
|
140
|
-
if (!Popup) {
|
|
141
|
-
console.warn(`The OpenUI5Support feature hasn't been initialized properly. Make sure you import the "@ui5/webcomponents-base/dist/features/OpenUI5Support.js" module before all components' modules.`); // eslint-disable-line
|
|
142
|
-
}
|
|
143
|
-
return Popup.getNextZIndex();
|
|
144
|
-
}
|
|
145
|
-
static setInitialZIndex() {
|
|
146
|
-
if (!OpenUI5Support.isOpenUI5Detected()) {
|
|
147
|
-
return;
|
|
148
|
-
}
|
|
149
|
-
const Popup = window.sap.ui.require("sap/ui/core/Popup");
|
|
150
|
-
Popup.setInitialZIndex(getCurrentZIndex());
|
|
151
|
-
}
|
|
152
131
|
}
|
|
153
132
|
registerFeature("OpenUI5Support", OpenUI5Support);
|
|
154
133
|
export default OpenUI5Support;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OpenUI5Support.js","sourceRoot":"","sources":["../../src/features/OpenUI5Support.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAoEzD,MAAM,cAAc;IACnB,MAAM,CAAC,mBAAmB;QACzB,MAAM,OAAO,GAAG,MAAM,CAAC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AAE,EAAE;YACxC,OAAO;SACP;QAED,MAAM,IAAI,GAAG,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,0BAA0B,CAAoB,CAAC,CAAC,yCAAyC;QACvJ,IAAI,CAAC,IAAI,EAAE;YACV,OAAO,KAAK,CAAC;SACb;QAED,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;IACtD,CAAC;IAED,MAAM,CAAC,aAAa;QACnB,IAAI,CAAC,cAAc,CAAC,iBAAiB,EAAE,EAAE;YACxC,OAAO;SACP;QAED,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,mBAAmB,CAAiB,CAAC;QAEzE,IAAI,CAAC,KAAK,EAAE;YACX,OAAO,CAAC,IAAI,CAAC,wLAAwL,CAAC,CAAC,CAAC,sBAAsB;SAC9N;QAED,OAAO,KAAK,CAAC,aAAa,EAAE,CAAC;IAC9B,CAAC;IAED,MAAM,CAAC,gBAAgB;QACtB,IAAI,CAAC,cAAc,CAAC,iBAAiB,EAAE,EAAE;YACxC,OAAO;SACP;QAED,MAAM,KAAK,GAAG,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,mBAAmB,CAAiB,CAAC;QACzE,KAAK,CAAC,gBAAgB,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC5C,CAAC;CACD;AAED,eAAe,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;AAElD,eAAe,cAAc,CAAC","sourcesContent":["import { registerFeature } from \"../FeaturesRegistry.js\";\nimport { setTheme } from \"../config/Theme.js\";\nimport { getCurrentZIndex } from \"../util/PopupUtils.js\";\nimport { CLDRData } from \"../asset-registries/LocaleData.js\";\nimport type { LegacyDateCalendarCustomizing } from \"../features/LegacyDateFormats.js\";\n\ntype OpenUI5Popup = {\n\tsetInitialZIndex: (zIndex: number) => void,\n\tgetNextZIndex: () => number,\n};\n\ntype OpenUI5Core = {\n\tattachInit: (callback: () => void) => void,\n\tready: () => Promise<void>,\n\tattachThemeChanged: (callback: () => void) => void,\n\tgetConfiguration: () => OpenUI5CoreConfiguration,\n};\n\ntype OpenUI5CoreConfiguration = {\n\tgetAnimationMode: () => string,\n\tgetLanguage: () => string,\n\tgetTheme: () => string,\n\tgetThemeRoot: () => string,\n\tgetRTL: () => string,\n\tgetTimezone: () => string,\n\tgetCalendarType: () => string,\n\tgetLocale: () => string,\n\tgetFormatSettings: () => {\n\t\tgetLegacyDateCalendarCustomizing: () => LegacyDateCalendarCustomizing;\n\t}\n};\n\ntype ControlBehavior = {\n\tgetAnimationMode: () => string,\n}\n\ntype Localization = {\n\tgetLanguage: () => string,\n\tgetLanguageTag: () => string,\n\tgetRTL: () => string,\n\tgetTimezone: () => string,\n}\n\ntype LocaleData = {\n\tgetInstance: (locale: string) => Locale,\n}\n\ntype Theming = {\n\tgetThemeRoot: () => string,\n\tgetTheme: () => string,\n\tattachApplied: (callback: () => void) => void,\n}\n\ntype Formatting = {\n\tgetCalendarType: () => string,\n\tgetLegacyDateCalendarCustomizing: () => LegacyDateCalendarCustomizing,\n\tgetCustomIslamicCalendarData?: () => LegacyDateCalendarCustomizing,\n}\n\ntype CalendarUtils = {\n\tgetWeekConfigurationValues: () => {\n\t\tfirstDayOfWeek: number | undefined,\n\t},\n}\n\ntype Locale = {\n\tgetFirstDayOfWeek: () => number,\n\t_get: () => CLDRData,\n};\n\nclass OpenUI5Support {\n\tstatic isAtLeastVersion116() {\n\t\tconst version = window.sap.ui!.version as string;\n\t\tconst parts = version.split(\".\");\n\t\tif (!parts || parts.length < 2) {\n\t\t\treturn false;\n\t\t}\n\t\treturn parseInt(parts[0]) > 1 || parseInt(parts[1]) >= 116;\n\t}\n\n\tstatic isOpenUI5Detected() {\n\t\treturn typeof window.sap?.ui?.require === \"function\";\n\t}\n\n\tstatic init() {\n\t\tif (!OpenUI5Support.isOpenUI5Detected()) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\n\t\treturn new Promise<void>(resolve => {\n\t\t\twindow.sap.ui.require([\"sap/ui/core/Core\"], async (Core: OpenUI5Core) => {\n\t\t\t\tconst callback = () => {\n\t\t\t\t\tlet deps: Array<string> = [\"sap/ui/core/Popup\", \"sap/ui/core/LocaleData\"];\n\t\t\t\t\tif (OpenUI5Support.isAtLeastVersion116()) { // for versions since 1.116.0 and onward, use the modular core\n\t\t\t\t\t\tdeps = [\n\t\t\t\t\t\t\t...deps,\n\t\t\t\t\t\t\t\"sap/base/i18n/Formatting\",\n\t\t\t\t\t\t\t\"sap/base/i18n/Localization\",\n\t\t\t\t\t\t\t\"sap/ui/core/ControlBehavior\",\n\t\t\t\t\t\t\t\"sap/ui/core/Theming\",\n\t\t\t\t\t\t\t\"sap/ui/core/date/CalendarUtils\",\n\t\t\t\t\t\t];\n\t\t\t\t\t}\n\t\t\t\t\twindow.sap.ui.require(deps, (Popup: OpenUI5Popup) => {\n\t\t\t\t\t\tPopup.setInitialZIndex(getCurrentZIndex());\n\t\t\t\t\t\tresolve();\n\t\t\t\t\t});\n\t\t\t\t};\n\t\t\t\tif (OpenUI5Support.isAtLeastVersion116()) {\n\t\t\t\t\tawait Core.ready();\n\t\t\t\t\tcallback();\n\t\t\t\t} else {\n\t\t\t\t\tCore.attachInit(callback);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n\tstatic getConfigurationSettingsObject() {\n\t\tif (!OpenUI5Support.isOpenUI5Detected()) {\n\t\t\treturn {};\n\t\t}\n\n\t\tif (OpenUI5Support.isAtLeastVersion116()) {\n\t\t\tconst ControlBehavior = window.sap.ui.require(\"sap/ui/core/ControlBehavior\") as ControlBehavior;\n\t\t\tconst Localization = window.sap.ui.require(\"sap/base/i18n/Localization\") as Localization;\n\t\t\tconst Theming = window.sap.ui.require(\"sap/ui/core/Theming\") as Theming;\n\t\t\tconst Formatting = window.sap.ui.require(\"sap/base/i18n/Formatting\") as Formatting;\n\t\t\tconst CalendarUtils = window.sap.ui.require(\"sap/ui/core/date/CalendarUtils\") as CalendarUtils;\n\n\t\t\treturn {\n\t\t\t\tanimationMode: ControlBehavior.getAnimationMode(),\n\t\t\t\tlanguage: Localization.getLanguage(),\n\t\t\t\ttheme: Theming.getTheme(),\n\t\t\t\tthemeRoot: Theming.getThemeRoot(),\n\t\t\t\trtl: Localization.getRTL(),\n\t\t\t\ttimezone: Localization.getTimezone(),\n\t\t\t\tcalendarType: Formatting.getCalendarType(),\n\t\t\t\tformatSettings: {\n\t\t\t\t\tfirstDayOfWeek: CalendarUtils.getWeekConfigurationValues().firstDayOfWeek,\n\t\t\t\t\tlegacyDateCalendarCustomizing: Formatting.getCustomIslamicCalendarData?.()\n\t\t\t\t\t\t\t\t\t\t\t\t?? Formatting.getLegacyDateCalendarCustomizing?.(),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tconst Core = window.sap.ui.require(\"sap/ui/core/Core\") as OpenUI5Core;\n\t\tconst config = Core.getConfiguration();\n\t\tconst LocaleData = window.sap.ui.require(\"sap/ui/core/LocaleData\") as LocaleData;\n\n\t\treturn {\n\t\t\tanimationMode: config.getAnimationMode(),\n\t\t\tlanguage: config.getLanguage(),\n\t\t\ttheme: config.getTheme(),\n\t\t\tthemeRoot: config.getThemeRoot(),\n\t\t\trtl: config.getRTL(),\n\t\t\ttimezone: config.getTimezone(),\n\t\t\tcalendarType: config.getCalendarType(),\n\t\t\tformatSettings: {\n\t\t\t\tfirstDayOfWeek: LocaleData ? LocaleData.getInstance(config.getLocale()).getFirstDayOfWeek() : undefined,\n\t\t\t\tlegacyDateCalendarCustomizing: config.getFormatSettings().getLegacyDateCalendarCustomizing(),\n\t\t\t},\n\t\t};\n\t}\n\n\tstatic getLocaleDataObject() {\n\t\tif (!OpenUI5Support.isOpenUI5Detected()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst LocaleData = window.sap.ui.require(\"sap/ui/core/LocaleData\") as LocaleData;\n\n\t\tif (OpenUI5Support.isAtLeastVersion116()) {\n\t\t\tconst Localization = window.sap.ui.require(\"sap/base/i18n/Localization\") as Localization;\n\t\t\treturn LocaleData.getInstance(Localization.getLanguageTag())._get();\n\t\t}\n\n\t\tconst Core = window.sap.ui.require(\"sap/ui/core/Core\") as OpenUI5Core;\n\t\tconst config = Core.getConfiguration();\n\t\treturn LocaleData.getInstance(config.getLocale())._get();\n\t}\n\n\tstatic _listenForThemeChange() {\n\t\tif (OpenUI5Support.isAtLeastVersion116()) {\n\t\t\tconst Theming: Theming = window.sap.ui.require(\"sap/ui/core/Theming\");\n\t\t\tTheming.attachApplied(() => {\n\t\t\t\tsetTheme(Theming.getTheme());\n\t\t\t});\n\t\t} else {\n\t\t\tconst Core = window.sap.ui.require(\"sap/ui/core/Core\") as OpenUI5Core;\n\t\t\tconst config = Core.getConfiguration();\n\t\t\tCore.attachThemeChanged(() => {\n\t\t\t\tsetTheme(config.getTheme());\n\t\t\t});\n\t\t}\n\t}\n\n\tstatic attachListeners() {\n\t\tif (!OpenUI5Support.isOpenUI5Detected()) {\n\t\t\treturn;\n\t\t}\n\n\t\tOpenUI5Support._listenForThemeChange();\n\t}\n\n\tstatic cssVariablesLoaded() {\n\t\tif (!OpenUI5Support.isOpenUI5Detected()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst link = [...document.head.children].find(el => el.id === \"sap-ui-theme-sap.ui.core\") as HTMLLinkElement; // more reliable than querySelector early\n\t\tif (!link) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn !!link.href.match(/\\/css(-|_)variables\\.css/);\n\t}\n\n\tstatic getNextZIndex() {\n\t\tif (!OpenUI5Support.isOpenUI5Detected()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst Popup = window.sap.ui.require(\"sap/ui/core/Popup\") as OpenUI5Popup;\n\n\t\tif (!Popup) {\n\t\t\tconsole.warn(`The OpenUI5Support feature hasn't been initialized properly. Make sure you import the \"@ui5/webcomponents-base/dist/features/OpenUI5Support.js\" module before all components' modules.`); // eslint-disable-line\n\t\t}\n\n\t\treturn Popup.getNextZIndex();\n\t}\n\n\tstatic setInitialZIndex() {\n\t\tif (!OpenUI5Support.isOpenUI5Detected()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst Popup = window.sap.ui.require(\"sap/ui/core/Popup\") as OpenUI5Popup;\n\t\tPopup.setInitialZIndex(getCurrentZIndex());\n\t}\n}\n\nregisterFeature(\"OpenUI5Support\", OpenUI5Support);\n\nexport default OpenUI5Support;\n"]}
|
|
1
|
+
{"version":3,"file":"OpenUI5Support.js","sourceRoot":"","sources":["../../src/features/OpenUI5Support.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AA+D9C,MAAM,cAAc;IACnB,MAAM,CAAC,mBAAmB;QACzB,MAAM,OAAO,GAAG,MAAM,CAAC,GAAG,CAAC,EAAG,CAAC,OAAiB,CAAC;QACjD,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACjC,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE;YAC/B,OAAO,KAAK,CAAC;SACb;QACD,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC;IAC5D,CAAC;IAED,MAAM,CAAC,iBAAiB;QACvB,OAAO,OAAO,MAAM,CAAC,GAAG,EAAE,EAAE,EAAE,OAAO,KAAK,UAAU,CAAC;IACtD,CAAC;IAED,MAAM,CAAC,IAAI;QACV,IAAI,CAAC,cAAc,CAAC,iBAAiB,EAAE,EAAE;YACxC,OAAO,OAAO,CAAC,OAAO,EAAE,CAAC;SACzB;QAED,OAAO,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aAAM;YACN,MAAM,IAAI,GAAG,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,CAAC,kBAAkB,CAAgB,CAAC;YACtE,MAAM,MAAM,GAAG,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACvC,IAAI,CAAC,kBAAkB,CAAC,GAAG,EAAE;gBAC5B,QAAQ,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAC;YAC7B,CAAC,CAAC,CAAC;SACH;IACF,CAAC;IAED,MAAM,CAAC,eAAe;QACrB,IAAI,CAAC,cAAc,CAAC,iBAAiB,EAAE,EAAE;YACxC,OAAO;SACP;QAED,cAAc,CAAC,qBAAqB,EAAE,CAAC;IACxC,CAAC;IAED,MAAM,CAAC,kBAAkB;QACxB,IAAI,CAAC,cAAc,CAAC,iBAAiB,EAAE,EAAE;YACxC,OAAO;SACP;QAED,MAAM,IAAI,GAAG,CAAC,GAAG,QAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,KAAK,0BAA0B,CAAoB,CAAC,CAAC,yCAAyC;QACvJ,IAAI,CAAC,IAAI,EAAE;YACV,OAAO,KAAK,CAAC;SACb;QAED,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,0BAA0B,CAAC,CAAC;IACtD,CAAC;CACD;AAED,eAAe,CAAC,gBAAgB,EAAE,cAAc,CAAC,CAAC;AAElD,eAAe,cAAc,CAAC","sourcesContent":["import { registerFeature } from \"../FeaturesRegistry.js\";\nimport { setTheme } from \"../config/Theme.js\";\nimport { CLDRData } from \"../asset-registries/LocaleData.js\";\nimport type { LegacyDateCalendarCustomizing } from \"../features/LegacyDateFormats.js\";\n\ntype OpenUI5Core = {\n\tattachInit: (callback: () => void) => void,\n\tready: () => Promise<void>,\n\tattachThemeChanged: (callback: () => void) => void,\n\tgetConfiguration: () => OpenUI5CoreConfiguration,\n};\n\ntype OpenUI5CoreConfiguration = {\n\tgetAnimationMode: () => string,\n\tgetLanguage: () => string,\n\tgetTheme: () => string,\n\tgetThemeRoot: () => string,\n\tgetRTL: () => string,\n\tgetTimezone: () => string,\n\tgetCalendarType: () => string,\n\tgetLocale: () => string,\n\tgetFormatSettings: () => {\n\t\tgetLegacyDateCalendarCustomizing: () => LegacyDateCalendarCustomizing;\n\t}\n};\n\ntype ControlBehavior = {\n\tgetAnimationMode: () => string,\n}\n\ntype Localization = {\n\tgetLanguage: () => string,\n\tgetLanguageTag: () => string,\n\tgetRTL: () => string,\n\tgetTimezone: () => string,\n}\n\ntype LocaleData = {\n\tgetInstance: (locale: string) => Locale,\n}\n\ntype Theming = {\n\tgetThemeRoot: () => string,\n\tgetTheme: () => string,\n\tattachApplied: (callback: () => void) => void,\n}\n\ntype Formatting = {\n\tgetCalendarType: () => string,\n\tgetLegacyDateCalendarCustomizing: () => LegacyDateCalendarCustomizing,\n\tgetCustomIslamicCalendarData?: () => LegacyDateCalendarCustomizing,\n}\n\ntype CalendarUtils = {\n\tgetWeekConfigurationValues: () => {\n\t\tfirstDayOfWeek: number | undefined,\n\t},\n}\n\ntype Locale = {\n\tgetFirstDayOfWeek: () => number,\n\t_get: () => CLDRData,\n};\n\nclass OpenUI5Support {\n\tstatic isAtLeastVersion116() {\n\t\tconst version = window.sap.ui!.version as string;\n\t\tconst parts = version.split(\".\");\n\t\tif (!parts || parts.length < 2) {\n\t\t\treturn false;\n\t\t}\n\t\treturn parseInt(parts[0]) > 1 || parseInt(parts[1]) >= 116;\n\t}\n\n\tstatic isOpenUI5Detected() {\n\t\treturn typeof window.sap?.ui?.require === \"function\";\n\t}\n\n\tstatic init() {\n\t\tif (!OpenUI5Support.isOpenUI5Detected()) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\n\t\treturn new Promise<void>(resolve => {\n\t\t\twindow.sap.ui.require([\"sap/ui/core/Core\"], async (Core: OpenUI5Core) => {\n\t\t\t\tconst callback = () => {\n\t\t\t\t\tlet deps: Array<string> = [\"sap/ui/core/LocaleData\"];\n\t\t\t\t\tif (OpenUI5Support.isAtLeastVersion116()) { // for versions since 1.116.0 and onward, use the modular core\n\t\t\t\t\t\tdeps = [\n\t\t\t\t\t\t\t...deps,\n\t\t\t\t\t\t\t\"sap/base/i18n/Formatting\",\n\t\t\t\t\t\t\t\"sap/base/i18n/Localization\",\n\t\t\t\t\t\t\t\"sap/ui/core/ControlBehavior\",\n\t\t\t\t\t\t\t\"sap/ui/core/Theming\",\n\t\t\t\t\t\t\t\"sap/ui/core/date/CalendarUtils\",\n\t\t\t\t\t\t];\n\t\t\t\t\t}\n\t\t\t\t\twindow.sap.ui.require(deps, resolve);\n\t\t\t\t};\n\t\t\t\tif (OpenUI5Support.isAtLeastVersion116()) {\n\t\t\t\t\tawait Core.ready();\n\t\t\t\t\tcallback();\n\t\t\t\t} else {\n\t\t\t\t\tCore.attachInit(callback);\n\t\t\t\t}\n\t\t\t});\n\t\t});\n\t}\n\n\tstatic getConfigurationSettingsObject() {\n\t\tif (!OpenUI5Support.isOpenUI5Detected()) {\n\t\t\treturn {};\n\t\t}\n\n\t\tif (OpenUI5Support.isAtLeastVersion116()) {\n\t\t\tconst ControlBehavior = window.sap.ui.require(\"sap/ui/core/ControlBehavior\") as ControlBehavior;\n\t\t\tconst Localization = window.sap.ui.require(\"sap/base/i18n/Localization\") as Localization;\n\t\t\tconst Theming = window.sap.ui.require(\"sap/ui/core/Theming\") as Theming;\n\t\t\tconst Formatting = window.sap.ui.require(\"sap/base/i18n/Formatting\") as Formatting;\n\t\t\tconst CalendarUtils = window.sap.ui.require(\"sap/ui/core/date/CalendarUtils\") as CalendarUtils;\n\n\t\t\treturn {\n\t\t\t\tanimationMode: ControlBehavior.getAnimationMode(),\n\t\t\t\tlanguage: Localization.getLanguage(),\n\t\t\t\ttheme: Theming.getTheme(),\n\t\t\t\tthemeRoot: Theming.getThemeRoot(),\n\t\t\t\trtl: Localization.getRTL(),\n\t\t\t\ttimezone: Localization.getTimezone(),\n\t\t\t\tcalendarType: Formatting.getCalendarType(),\n\t\t\t\tformatSettings: {\n\t\t\t\t\tfirstDayOfWeek: CalendarUtils.getWeekConfigurationValues().firstDayOfWeek,\n\t\t\t\t\tlegacyDateCalendarCustomizing: Formatting.getCustomIslamicCalendarData?.()\n\t\t\t\t\t\t\t\t\t\t\t\t?? Formatting.getLegacyDateCalendarCustomizing?.(),\n\t\t\t\t},\n\t\t\t};\n\t\t}\n\n\t\tconst Core = window.sap.ui.require(\"sap/ui/core/Core\") as OpenUI5Core;\n\t\tconst config = Core.getConfiguration();\n\t\tconst LocaleData = window.sap.ui.require(\"sap/ui/core/LocaleData\") as LocaleData;\n\n\t\treturn {\n\t\t\tanimationMode: config.getAnimationMode(),\n\t\t\tlanguage: config.getLanguage(),\n\t\t\ttheme: config.getTheme(),\n\t\t\tthemeRoot: config.getThemeRoot(),\n\t\t\trtl: config.getRTL(),\n\t\t\ttimezone: config.getTimezone(),\n\t\t\tcalendarType: config.getCalendarType(),\n\t\t\tformatSettings: {\n\t\t\t\tfirstDayOfWeek: LocaleData ? LocaleData.getInstance(config.getLocale()).getFirstDayOfWeek() : undefined,\n\t\t\t\tlegacyDateCalendarCustomizing: config.getFormatSettings().getLegacyDateCalendarCustomizing(),\n\t\t\t},\n\t\t};\n\t}\n\n\tstatic getLocaleDataObject() {\n\t\tif (!OpenUI5Support.isOpenUI5Detected()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst LocaleData = window.sap.ui.require(\"sap/ui/core/LocaleData\") as LocaleData;\n\n\t\tif (OpenUI5Support.isAtLeastVersion116()) {\n\t\t\tconst Localization = window.sap.ui.require(\"sap/base/i18n/Localization\") as Localization;\n\t\t\treturn LocaleData.getInstance(Localization.getLanguageTag())._get();\n\t\t}\n\n\t\tconst Core = window.sap.ui.require(\"sap/ui/core/Core\") as OpenUI5Core;\n\t\tconst config = Core.getConfiguration();\n\t\treturn LocaleData.getInstance(config.getLocale())._get();\n\t}\n\n\tstatic _listenForThemeChange() {\n\t\tif (OpenUI5Support.isAtLeastVersion116()) {\n\t\t\tconst Theming: Theming = window.sap.ui.require(\"sap/ui/core/Theming\");\n\t\t\tTheming.attachApplied(() => {\n\t\t\t\tsetTheme(Theming.getTheme());\n\t\t\t});\n\t\t} else {\n\t\t\tconst Core = window.sap.ui.require(\"sap/ui/core/Core\") as OpenUI5Core;\n\t\t\tconst config = Core.getConfiguration();\n\t\t\tCore.attachThemeChanged(() => {\n\t\t\t\tsetTheme(config.getTheme());\n\t\t\t});\n\t\t}\n\t}\n\n\tstatic attachListeners() {\n\t\tif (!OpenUI5Support.isOpenUI5Detected()) {\n\t\t\treturn;\n\t\t}\n\n\t\tOpenUI5Support._listenForThemeChange();\n\t}\n\n\tstatic cssVariablesLoaded() {\n\t\tif (!OpenUI5Support.isOpenUI5Detected()) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst link = [...document.head.children].find(el => el.id === \"sap-ui-theme-sap.ui.core\") as HTMLLinkElement; // more reliable than querySelector early\n\t\tif (!link) {\n\t\t\treturn false;\n\t\t}\n\n\t\treturn !!link.href.match(/\\/css(-|_)variables\\.css/);\n\t}\n}\n\nregisterFeature(\"OpenUI5Support\", OpenUI5Support);\n\nexport default OpenUI5Support;\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
const VersionInfo = {
|
|
2
|
-
version: "
|
|
3
|
-
major:
|
|
4
|
-
minor:
|
|
2
|
+
version: "2.0.0-rc.0",
|
|
3
|
+
major: 2,
|
|
4
|
+
minor: 0,
|
|
5
5
|
patch: 0,
|
|
6
|
-
suffix: "-rc.
|
|
6
|
+
suffix: "-rc.0",
|
|
7
7
|
isNext: false,
|
|
8
|
-
buildTime:
|
|
8
|
+
buildTime: 1712656957,
|
|
9
9
|
};
|
|
10
10
|
export default VersionInfo;
|
|
11
11
|
//# sourceMappingURL=VersionInfo.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VersionInfo.js","sourceRoot":"","sources":["../../src/generated/VersionInfo.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG;IACnB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"VersionInfo.js","sourceRoot":"","sources":["../../src/generated/VersionInfo.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG;IACnB,OAAO,EAAE,YAAY;IACrB,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,CAAC;IACR,MAAM,EAAE,OAAO;IACf,MAAM,EAAE,KAAK;IACb,SAAS,EAAE,UAAU;CACrB,CAAC;AACF,eAAe,WAAW,CAAC","sourcesContent":["const VersionInfo = {\n\tversion: \"2.0.0-rc.0\",\n\tmajor: 2,\n\tminor: 0,\n\tpatch: 0,\n\tsuffix: \"-rc.0\",\n\tisNext: false,\n\tbuildTime: 1712656957,\n};\nexport default VersionInfo;"]}
|
|
@@ -10,17 +10,11 @@ const effectiveSvg = (strings, ...values) => {
|
|
|
10
10
|
const fn = litStatic ? litStatic.svg : svg;
|
|
11
11
|
return fn(strings, ...values);
|
|
12
12
|
};
|
|
13
|
-
const litRender = (templateResult, container,
|
|
13
|
+
const litRender = (templateResult, container, options) => {
|
|
14
14
|
const openUI5Enablement = getFeature("OpenUI5Enablement");
|
|
15
|
-
if (openUI5Enablement
|
|
15
|
+
if (openUI5Enablement) {
|
|
16
16
|
templateResult = openUI5Enablement.wrapTemplateResultInBusyMarkup(effectiveHtml, options.host, templateResult);
|
|
17
17
|
}
|
|
18
|
-
if (typeof styleStrOrHrefsArr === "string") {
|
|
19
|
-
templateResult = effectiveHtml `<style>${styleStrOrHrefsArr}</style>${templateResult}`;
|
|
20
|
-
}
|
|
21
|
-
else if (Array.isArray(styleStrOrHrefsArr) && styleStrOrHrefsArr.length) {
|
|
22
|
-
templateResult = effectiveHtml `${styleStrOrHrefsArr.map(href => effectiveHtml `<link type="text/css" rel="stylesheet" href="${href}">`)}${templateResult}`;
|
|
23
|
-
}
|
|
24
18
|
render(templateResult, container, options);
|
|
25
19
|
};
|
|
26
20
|
const scopeTag = (tag, tags, suffix) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LitRenderer.js","sourceRoot":"","sources":["../../src/renderer/LitRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,MAAM,EACN,IAAI,EACJ,GAAG,GAEH,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAOpD,MAAM,aAAa,GAAG,CAAC,OAA6B,EAAE,GAAG,MAAsB,EAAE,EAAE;IAClF,MAAM,SAAS,GAAG,UAAU,CAAmB,WAAW,CAAC,CAAC;IAC5D,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;IAC7C,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEF,MAAM,YAAY,GAAG,CAAC,OAA6B,EAAE,GAAG,MAAsB,EAAE,EAAE;IACjF,MAAM,SAAS,GAAG,UAAU,CAAmB,WAAW,CAAC,CAAC;IAC5D,MAAM,EAAE,GAAG,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC;IAC3C,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,MAAM,CAAC,CAAC;AAC/B,CAAC,CAAC;AAEF,MAAM,SAAS,GAAa,CAAC,cAAsC,EAAE,SAAyC,EAAE,
|
|
1
|
+
{"version":3,"file":"LitRenderer.js","sourceRoot":"","sources":["../../src/renderer/LitRenderer.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,MAAM,EACN,IAAI,EACJ,GAAG,GAEH,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAOpD,MAAM,aAAa,GAAG,CAAC,OAA6B,EAAE,GAAG,MAAsB,EAAE,EAAE;I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F,CAAC,CAAC;AAEF,OAAO,EACN,aAAa,IAAI,IAAI,EACrB,YAAY,IAAI,GAAG,GACnB,CAAC;AACF,OAAO,EAAE,QAAQ,EAAE,CAAC;AACpB,OAAO,EAAE,MAAM,EAAE,MAAM,+BAA+B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,kCAAkC,CAAC;AAC5D,oCAAoC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,2BAA2B,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAEhE,eAAe,SAAS,CAAC","sourcesContent":["import {\n\trender,\n\thtml,\n\tsvg,\n\tTemplateResult,\n} from \"lit-html\";\n\nimport { getFeature } from \"../FeaturesRegistry.js\";\nimport type { LitStatic } from \"../CustomElementsScope.js\";\nimport type OpenUI5Enablement from \"../features/OpenUI5Enablement.js\";\nimport type UI5Element from \"../UI5Element.js\";\nimport type { Renderer, RendererOptions } from \"../UI5Element.js\";\nimport { TemplateFunctionResult } from \"./executeTemplate.js\";\n\nconst effectiveHtml = (strings: TemplateStringsArray, ...values: Array<unknown>) => {\n\tconst litStatic = getFeature<typeof LitStatic>(\"LitStatic\");\n\tconst fn = litStatic ? litStatic.html : html;\n\treturn fn(strings, ...values);\n};\n\nconst effectiveSvg = (strings: TemplateStringsArray, ...values: Array<unknown>) => {\n\tconst litStatic = getFeature<typeof LitStatic>(\"LitStatic\");\n\tconst fn = litStatic ? litStatic.svg : svg;\n\treturn fn(strings, ...values);\n};\n\nconst litRender: Renderer = (templateResult: TemplateFunctionResult, container: HTMLElement | DocumentFragment, options: RendererOptions) => {\n\tconst openUI5Enablement = getFeature<typeof OpenUI5Enablement>(\"OpenUI5Enablement\");\n\tif (openUI5Enablement) {\n\t\ttemplateResult = openUI5Enablement.wrapTemplateResultInBusyMarkup(effectiveHtml, options.host as UI5Element, templateResult as TemplateResult);\n\t}\n\n\trender(templateResult as TemplateResult, container, options);\n};\n\nconst scopeTag = (tag: string, tags: Array<string>, suffix: string) => {\n\tconst litStatic = getFeature<typeof LitStatic>(\"LitStatic\");\n\tif (litStatic) {\n\t\treturn litStatic.unsafeStatic((tags || []).includes(tag) ? `${tag}-${suffix}` : tag);\n\t}\n};\n\nexport {\n\teffectiveHtml as html,\n\teffectiveSvg as svg,\n};\nexport { scopeTag };\nexport { repeat } from \"lit-html/directives/repeat.js\";\nexport { classMap } from \"lit-html/directives/class-map.js\";\n// @ts-ignore style-map is a JS file\nexport { styleMap } from \"./directives/style-map.js\";\nexport { ifDefined } from \"lit-html/directives/if-defined.js\";\nexport { unsafeHTML } from \"lit-html/directives/unsafe-html.js\";\n\nexport default litRender;\n"]}
|
|
@@ -5,5 +5,5 @@ import UI5Element from "../UI5Element.js";
|
|
|
5
5
|
* @param ElementClass
|
|
6
6
|
* @returns {*}
|
|
7
7
|
*/
|
|
8
|
-
declare const getConstructableStyle: (ElementClass: typeof UI5Element
|
|
8
|
+
declare const getConstructableStyle: (ElementClass: typeof UI5Element) => CSSStyleSheet[];
|
|
9
9
|
export default getConstructableStyle;
|
|
@@ -10,11 +10,11 @@ attachCustomCSSChange((tag) => {
|
|
|
10
10
|
* @param ElementClass
|
|
11
11
|
* @returns {*}
|
|
12
12
|
*/
|
|
13
|
-
const getConstructableStyle = (ElementClass
|
|
13
|
+
const getConstructableStyle = (ElementClass) => {
|
|
14
14
|
const tag = ElementClass.getMetadata().getTag();
|
|
15
|
-
const key = `${tag}
|
|
15
|
+
const key = `${tag}_normal`;
|
|
16
16
|
if (!constructableStyleMap.has(key)) {
|
|
17
|
-
const styleContent = getEffectiveStyle(ElementClass
|
|
17
|
+
const styleContent = getEffectiveStyle(ElementClass);
|
|
18
18
|
const style = new CSSStyleSheet();
|
|
19
19
|
style.replaceSync(styleContent);
|
|
20
20
|
constructableStyleMap.set(key, [style]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getConstructableStyle.js","sourceRoot":"","sources":["../../src/theming/getConstructableStyle.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,MAAM,qBAAqB,GAAG,IAAI,GAAG,EAAgC,CAAC;AAEtE,qBAAqB,CAAC,CAAC,GAAW,EAAE,EAAE;IACrC,qBAAqB,CAAC,MAAM,CAAC,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,kFAAkF;AAClI,CAAC,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,qBAAqB,GAAG,CAAC,YAA+B,EAAE,
|
|
1
|
+
{"version":3,"file":"getConstructableStyle.js","sourceRoot":"","sources":["../../src/theming/getConstructableStyle.ts"],"names":[],"mappings":"AAAA,OAAO,iBAAiB,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAGzD,MAAM,qBAAqB,GAAG,IAAI,GAAG,EAAgC,CAAC;AAEtE,qBAAqB,CAAC,CAAC,GAAW,EAAE,EAAE;IACrC,qBAAqB,CAAC,MAAM,CAAC,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,kFAAkF;AAClI,CAAC,CAAC,CAAC;AAEH;;;;;GAKG;AACH,MAAM,qBAAqB,GAAG,CAAC,YAA+B,EAAE,EAAE;IACjE,MAAM,GAAG,GAAG,YAAY,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC;IAChD,MAAM,GAAG,GAAG,GAAG,GAAG,SAAS,CAAC;IAE5B,IAAI,CAAC,qBAAqB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;QACpC,MAAM,YAAY,GAAG,iBAAiB,CAAC,YAAY,CAAC,CAAC;QACrD,MAAM,KAAK,GAAG,IAAI,aAAa,EAAE,CAAC;QAClC,KAAK,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC;QAChC,qBAAqB,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;KACxC;IAED,OAAO,qBAAqB,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC;AACxC,CAAC,CAAC;AAEF,eAAe,qBAAqB,CAAC","sourcesContent":["import getEffectiveStyle from \"./getEffectiveStyle.js\";\nimport { attachCustomCSSChange } from \"./CustomStyle.js\";\nimport UI5Element from \"../UI5Element.js\";\n\nconst constructableStyleMap = new Map<string, Array<CSSStyleSheet>>();\n\nattachCustomCSSChange((tag: string) => {\n\tconstructableStyleMap.delete(`${tag}_normal`); // there is custom CSS only for the component itself, not for its static area part\n});\n\n/**\n * Returns (and caches) a constructable style sheet for a web component class\n * Note: Chrome\n * @param ElementClass\n * @returns {*}\n */\nconst getConstructableStyle = (ElementClass: typeof UI5Element) => {\n\tconst tag = ElementClass.getMetadata().getTag();\n\tconst key = `${tag}_normal`;\n\n\tif (!constructableStyleMap.has(key)) {\n\t\tconst styleContent = getEffectiveStyle(ElementClass);\n\t\tconst style = new CSSStyleSheet();\n\t\tstyle.replaceSync(styleContent);\n\t\tconstructableStyleMap.set(key, [style]);\n\t}\n\n\treturn constructableStyleMap.get(key)!;\n};\n\nexport default getConstructableStyle;\n"]}
|
|
@@ -5,25 +5,18 @@ const effectiveStyleMap = new Map();
|
|
|
5
5
|
attachCustomCSSChange((tag) => {
|
|
6
6
|
effectiveStyleMap.delete(`${tag}_normal`); // there is custom CSS only for the component itself, not for its static area part
|
|
7
7
|
});
|
|
8
|
-
const getEffectiveStyle = (ElementClass
|
|
8
|
+
const getEffectiveStyle = (ElementClass) => {
|
|
9
9
|
const tag = ElementClass.getMetadata().getTag();
|
|
10
|
-
const key = `${tag}
|
|
10
|
+
const key = `${tag}_normal`;
|
|
11
11
|
const openUI5Enablement = getFeature("OpenUI5Enablement");
|
|
12
12
|
if (!effectiveStyleMap.has(key)) {
|
|
13
|
-
let effectiveStyle;
|
|
14
13
|
let busyIndicatorStyles = "";
|
|
15
14
|
if (openUI5Enablement) {
|
|
16
15
|
busyIndicatorStyles = getStylesString(openUI5Enablement.getBusyIndicatorStyles());
|
|
17
16
|
}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
const customStyle = getCustomCSS(tag) || "";
|
|
23
|
-
const builtInStyles = getStylesString(ElementClass.styles);
|
|
24
|
-
effectiveStyle = `${builtInStyles} ${customStyle}`;
|
|
25
|
-
}
|
|
26
|
-
effectiveStyle = `${effectiveStyle} ${busyIndicatorStyles}`;
|
|
17
|
+
const customStyle = getCustomCSS(tag) || "";
|
|
18
|
+
const builtInStyles = getStylesString(ElementClass.styles);
|
|
19
|
+
const effectiveStyle = `${builtInStyles} ${customStyle} ${busyIndicatorStyles}`;
|
|
27
20
|
effectiveStyleMap.set(key, effectiveStyle);
|
|
28
21
|
}
|
|
29
22
|
return effectiveStyleMap.get(key); // The key is guaranteed to exist
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getEffectiveStyle.js","sourceRoot":"","sources":["../../src/theming/getEffectiveStyle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,eAAe,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAIpD,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEpD,qBAAqB,CAAC,CAAC,GAAW,EAAE,EAAE;IACrC,iBAAiB,CAAC,MAAM,CAAC,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,kFAAkF;AAC9H,CAAC,CAAC,CAAC;AAEH,MAAM,iBAAiB,GAAG,CAAC,YAA+B,EAAE,
|
|
1
|
+
{"version":3,"file":"getEffectiveStyle.js","sourceRoot":"","sources":["../../src/theming/getEffectiveStyle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,eAAe,MAAM,sBAAsB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAIpD,MAAM,iBAAiB,GAAG,IAAI,GAAG,EAAkB,CAAC;AAEpD,qBAAqB,CAAC,CAAC,GAAW,EAAE,EAAE;IACrC,iBAAiB,CAAC,MAAM,CAAC,GAAG,GAAG,SAAS,CAAC,CAAC,CAAC,kFAAkF;AAC9H,CAAC,CAAC,CAAC;AAEH,MAAM,iBAAiB,GAAG,CAAC,YAA+B,EAAE,EAAE;IAC7D,MAAM,GAAG,GAAG,YAAY,CAAC,WAAW,EAAE,CAAC,MAAM,EAAE,CAAC;IAChD,MAAM,GAAG,GAAG,GAAG,GAAG,SAAS,CAAC;IAC5B,MAAM,iBAAiB,GAAG,UAAU,CAA2B,mBAAmB,CAAC,CAAC;IAEpF,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE;QAChC,IAAI,mBAAmB,GAAG,EAAE,CAAC;QAE7B,IAAI,iBAAiB,EAAE;YACtB,mBAAmB,GAAG,eAAe,CAAC,iBAAiB,CAAC,sBAAsB,EAAE,CAAC,CAAC;SAClF;QAED,MAAM,WAAW,GAAG,YAAY,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QAC5C,MAAM,aAAa,GAAG,eAAe,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC;QAE3D,MAAM,cAAc,GAAG,GAAG,aAAa,IAAI,WAAW,IAAI,mBAAmB,EAAE,CAAC;QAChF,iBAAiB,CAAC,GAAG,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC;KAC3C;IAED,OAAO,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAE,CAAC,CAAC,iCAAiC;AACtE,CAAC,CAAC;AAEF,eAAe,iBAAiB,CAAC","sourcesContent":["import { getCustomCSS, attachCustomCSSChange } from \"./CustomStyle.js\";\nimport getStylesString from \"./getStylesString.js\";\nimport { getFeature } from \"../FeaturesRegistry.js\";\nimport type UI5Element from \"../UI5Element.js\";\nimport OpenUI5Enablement from \"../features/OpenUI5Enablement.js\";\n\nconst effectiveStyleMap = new Map<string, string>();\n\nattachCustomCSSChange((tag: string) => {\n\teffectiveStyleMap.delete(`${tag}_normal`); // there is custom CSS only for the component itself, not for its static area part\n});\n\nconst getEffectiveStyle = (ElementClass: typeof UI5Element) => {\n\tconst tag = ElementClass.getMetadata().getTag();\n\tconst key = `${tag}_normal`;\n\tconst openUI5Enablement = getFeature<typeof OpenUI5Enablement>(\"OpenUI5Enablement\");\n\n\tif (!effectiveStyleMap.has(key)) {\n\t\tlet busyIndicatorStyles = \"\";\n\n\t\tif (openUI5Enablement) {\n\t\t\tbusyIndicatorStyles = getStylesString(openUI5Enablement.getBusyIndicatorStyles());\n\t\t}\n\n\t\tconst customStyle = getCustomCSS(tag) || \"\";\n\t\tconst builtInStyles = getStylesString(ElementClass.styles);\n\n\t\tconst effectiveStyle = `${builtInStyles} ${customStyle} ${busyIndicatorStyles}`;\n\t\teffectiveStyleMap.set(key, effectiveStyle);\n\t}\n\n\treturn effectiveStyleMap.get(key)!; // The key is guaranteed to exist\n};\n\nexport default getEffectiveStyle;\n"]}
|
|
@@ -2,7 +2,6 @@ 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
|
|
6
5
|
*/
|
|
7
|
-
declare const updateShadowRoot: (element: UI5Element
|
|
6
|
+
declare const updateShadowRoot: (element: UI5Element) => void;
|
|
8
7
|
export default updateShadowRoot;
|
package/dist/updateShadowRoot.js
CHANGED
|
@@ -1,42 +1,18 @@
|
|
|
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";
|
|
6
2
|
/**
|
|
7
3
|
* Updates the shadow root of a UI5Element or its static area item
|
|
8
4
|
* @param element
|
|
9
|
-
* @param forStaticArea
|
|
10
5
|
*/
|
|
11
|
-
const updateShadowRoot = (element
|
|
12
|
-
let styleStrOrHrefsArr;
|
|
6
|
+
const updateShadowRoot = (element) => {
|
|
13
7
|
const ctor = element.constructor;
|
|
14
|
-
const shadowRoot =
|
|
15
|
-
|
|
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
|
-
}
|
|
8
|
+
const shadowRoot = element.shadowRoot;
|
|
9
|
+
const renderResult = element.render(); // this is checked before calling updateShadowRoot
|
|
22
10
|
if (!shadowRoot) {
|
|
23
11
|
console.warn(`There is no shadow root to update`); // eslint-disable-line
|
|
24
12
|
return;
|
|
25
13
|
}
|
|
26
|
-
|
|
27
|
-
|
|
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 });
|
|
14
|
+
shadowRoot.adoptedStyleSheets = getConstructableStyle(ctor);
|
|
15
|
+
ctor.renderer(renderResult, shadowRoot, { host: element });
|
|
40
16
|
};
|
|
41
17
|
export default updateShadowRoot;
|
|
42
18
|
//# 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;AAGvE;;;GAGG;AACH,MAAM,gBAAgB,GAAG,CAAC,OAAmB,EAAE,EAAE;IAChD,MAAM,IAAI,GAAG,OAAO,CAAC,WAAgC,CAAC;IACtD,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;IACtC,MAAM,YAAY,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,kDAAkD;IAEzF,IAAI,CAAC,UAAU,EAAE;QAChB,OAAO,CAAC,IAAI,CAAC,mCAAmC,CAAC,CAAC,CAAC,sBAAsB;QACzE,OAAO;KACP;IAED,UAAU,CAAC,kBAAkB,GAAG,qBAAqB,CAAC,IAAI,CAAC,CAAC;IAE5D,IAAI,CAAC,QAAQ,CAAC,YAAY,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;AAC5D,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC","sourcesContent":["import getConstructableStyle from \"./theming/getConstructableStyle.js\";\nimport type UI5Element from \"./UI5Element.js\";\n\n/**\n * Updates the shadow root of a UI5Element or its static area item\n * @param element\n */\nconst updateShadowRoot = (element: UI5Element) => {\n\tconst ctor = element.constructor as typeof UI5Element;\n\tconst shadowRoot = element.shadowRoot;\n\tconst renderResult = element.render(); // this is checked before calling updateShadowRoot\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\tshadowRoot.adoptedStyleSheets = getConstructableStyle(ctor);\n\n\tctor.renderer(renderResult, shadowRoot, { host: element });\n};\n\nexport default updateShadowRoot;\n"]}
|
|
@@ -2,6 +2,4 @@ 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
|
-
|
|
6
|
-
declare const getCurrentZIndex: () => number;
|
|
7
|
-
export { getFocusedElement, isClickInRect, getClosedPopupParent, getNextZIndex, getCurrentZIndex, isFocusedElementWithinNode, };
|
|
5
|
+
export { getFocusedElement, isClickInRect, getClosedPopupParent, isFocusedElementWithinNode, };
|
package/dist/util/PopupUtils.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import getSharedResource from "../getSharedResource.js";
|
|
2
|
-
import { getFeature } from "../FeaturesRegistry.js";
|
|
3
1
|
import getActiveElement from "./getActiveElement.js";
|
|
4
|
-
const popupUtilsData = getSharedResource("PopupUtilsData", { currentZIndex: 100 });
|
|
5
2
|
const getFocusedElement = () => {
|
|
6
3
|
const element = getActiveElement();
|
|
7
4
|
return (element && typeof element.focus === "function") ? element : null;
|
|
@@ -59,16 +56,5 @@ const getClosedPopupParent = (el) => {
|
|
|
59
56
|
}
|
|
60
57
|
return getClosedPopupParent(parent);
|
|
61
58
|
};
|
|
62
|
-
|
|
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, };
|
|
59
|
+
export { getFocusedElement, isClickInRect, getClosedPopupParent, isFocusedElementWithinNode, };
|
|
74
60
|
//# sourceMappingURL=PopupUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PopupUtils.js","sourceRoot":"","sources":["../../src/util/PopupUtils.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"PopupUtils.js","sourceRoot":"","sources":["../../src/util/PopupUtils.ts"],"names":[],"mappings":"AAAA,OAAO,gBAAgB,MAAM,uBAAuB,CAAC;AAErD,MAAM,iBAAiB,GAAG,GAAG,EAAE;IAC9B,MAAM,OAAO,GAAG,gBAAgB,EAAiB,CAAC;IAClD,OAAO,CAAC,OAAO,IAAI,OAAO,OAAO,CAAC,KAAK,KAAK,UAAU,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC;AAC1E,CAAC,CAAC;AAEF,MAAM,0BAA0B,GAAG,CAAC,IAAiB,EAAE,EAAE;IACxD,MAAM,EAAE,GAAG,iBAAiB,EAAE,CAAC;IAE/B,IAAI,EAAE,EAAE;QACP,OAAO,qBAAqB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;KACvC;IAED,OAAO,KAAK,CAAC;AACd,CAAC,CAAC;AAEF,MAAM,qBAAqB,GAAG,CAAC,MAAmB,EAAE,KAAkB,EAAW,EAAE;IAClF,IAAI,WAAW,GAA4B,MAAM,CAAC;IAElD,IAAI,WAAW,CAAC,UAAU,EAAE;QAC3B,MAAM,QAAQ,GAAG,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,QAAQ,CAAuB,CAAC;QACnF,WAAW,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,KAAK,OAAO,CAAC,CAAC;QAE1D,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IACnC,OAAO,cAAc,IAAI,MAAM,IAAI,OAAO,IAAI,MAAM,CAAC;AACtD,CAAC;AAED,MAAM,oBAAoB,GAAG,CAAC,EAAe,EAAe,EAAE;IAC7D,MAAM,MAAM,GAAG,EAAE,CAAC,aAAa,IAAI,CAAC,EAAE,CAAC,WAAW,IAAK,EAAE,CAAC,WAAW,EAAiB,CAAC,IAAI,CAAC,CAAC;IAE7F,IAAI,MAAM,IAAI,CAAC,CAAC,eAAe,CAAC,MAAM,CAAC,IAAI,MAAM,KAAK,QAAQ,CAAC,eAAe,CAAC,CAAC,EAAE;QACjF,OAAO,MAAqB,CAAC;KAC7B;IAED,OAAO,oBAAoB,CAAC,MAAqB,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF,OAAO,EACN,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,0BAA0B,GAC1B,CAAC","sourcesContent":["import getActiveElement from \"./getActiveElement.js\";\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\nexport {\n\tgetFocusedElement,\n\tisClickInRect,\n\tgetClosedPopupParent,\n\tisFocusedElementWithinNode,\n};\n"]}
|
|
@@ -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,CAAC,CAAC,YAAY,CAA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AAS,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\te.dataTransfer.dropEffect = \"move\";\n\te.dataTransfer.effectAllowed = \"move\";\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"]}
|
|
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;A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AAC,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.js\";\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\te.dataTransfer.dropEffect = \"move\";\n\te.dataTransfer.effectAllowed = \"move\";\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"]}
|
|
@@ -20,10 +20,8 @@ declare const getClassCopy: (klass: typeof UI5Element, constructorCallback: () =
|
|
|
20
20
|
_doNotSyncAttributes: Set<string>;
|
|
21
21
|
_state: import("../UI5ElementMetadata.js").State;
|
|
22
22
|
_getRealDomRef?: (() => HTMLElement) | undefined;
|
|
23
|
-
staticAreaItem?: import("../StaticAreaItem.js").default | undefined;
|
|
24
23
|
readonly _id: string;
|
|
25
24
|
render(): object;
|
|
26
|
-
renderStatic(): object;
|
|
27
25
|
connectedCallback(): Promise<void>;
|
|
28
26
|
disconnectedCallback(): void;
|
|
29
27
|
onBeforeRendering(): void;
|
|
@@ -72,7 +70,6 @@ declare const getClassCopy: (klass: typeof UI5Element, constructorCallback: () =
|
|
|
72
70
|
readonly isUI5Element: boolean;
|
|
73
71
|
readonly classes: import("../types.js").ClassMap;
|
|
74
72
|
readonly accessibilityInfo: import("../types.js").AccessibilityInfo;
|
|
75
|
-
getStaticAreaItemDomRef(): Promise<ShadowRoot | null>;
|
|
76
73
|
accessKey: string;
|
|
77
74
|
readonly accessKeyLabel: string;
|
|
78
75
|
autocapitalize: string;
|
|
@@ -399,17 +396,13 @@ declare const getClassCopy: (klass: typeof UI5Element, constructorCallback: () =
|
|
|
399
396
|
blur(): void;
|
|
400
397
|
};
|
|
401
398
|
template?: import("../renderer/executeTemplate.js").TemplateFunction | undefined;
|
|
402
|
-
staticAreaTemplate?: import("../renderer/executeTemplate.js").TemplateFunction | undefined;
|
|
403
399
|
_metadata: import("../UI5ElementMetadata.js").default;
|
|
404
|
-
|
|
405
|
-
renderer?: import("../UI5Element.js").Renderer | undefined;
|
|
400
|
+
renderer: import("../UI5Element.js").Renderer;
|
|
406
401
|
readonly observedAttributes: string[];
|
|
407
402
|
_needsShadowDOM(): boolean;
|
|
408
|
-
_needsStaticArea(): boolean;
|
|
409
403
|
_generateAccessors(): void;
|
|
410
404
|
metadata: import("../UI5ElementMetadata.js").Metadata;
|
|
411
405
|
styles: import("../types.js").ComponentStylesData;
|
|
412
|
-
readonly staticAreaStyles: import("../types.js").ComponentStylesData;
|
|
413
406
|
readonly dependencies: (typeof UI5Element)[];
|
|
414
407
|
getUniqueDependencies(this: typeof UI5Element): (typeof UI5Element)[];
|
|
415
408
|
whenDependenciesDefined(): Promise<(typeof UI5Element)[]>;
|
package/index.js
CHANGED
|
@@ -56,13 +56,6 @@ 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
|
-
|
|
66
59
|
// CustomElementsScope.ts
|
|
67
60
|
import {
|
|
68
61
|
setCustomElementsScopingSuffix,
|
|
@@ -75,7 +68,6 @@ import {
|
|
|
75
68
|
// Device.ts
|
|
76
69
|
import {
|
|
77
70
|
supportsTouch,
|
|
78
|
-
isIE,
|
|
79
71
|
isSafari,
|
|
80
72
|
isChrome,
|
|
81
73
|
isFirefox,
|
|
@@ -173,11 +165,6 @@ export {
|
|
|
173
165
|
// Boot.ts
|
|
174
166
|
attachBoot,
|
|
175
167
|
|
|
176
|
-
// CSP.ts
|
|
177
|
-
setPackageCSSRoot,
|
|
178
|
-
setUseLinks,
|
|
179
|
-
setPreloadLinks,
|
|
180
|
-
|
|
181
168
|
// CustomElementsScope.ts
|
|
182
169
|
setCustomElementsScopingSuffix,
|
|
183
170
|
getCustomElementsScopingSuffix,
|
|
@@ -187,7 +174,6 @@ export {
|
|
|
187
174
|
|
|
188
175
|
// Device.ts
|
|
189
176
|
supportsTouch,
|
|
190
|
-
isIE,
|
|
191
177
|
isSafari,
|
|
192
178
|
isChrome,
|
|
193
179
|
isFirefox,
|
package/package-scripts.cjs
CHANGED
|
@@ -13,7 +13,7 @@ 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
|
|
16
|
+
clean: "rimraf src/generated && rimraf dist && rimraf .port",
|
|
17
17
|
lint: `eslint .`,
|
|
18
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",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/webcomponents-base",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0-rc.0",
|
|
4
4
|
"description": "UI5 Web Components: webcomponents.base",
|
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"@openui5/sap.ui.core": "1.120.5",
|
|
48
|
-
"@ui5/webcomponents-tools": "
|
|
48
|
+
"@ui5/webcomponents-tools": "2.0.0-rc.0",
|
|
49
49
|
"chromedriver": "^122.0.6",
|
|
50
50
|
"clean-css": "^5.2.2",
|
|
51
51
|
"copy-and-watch": "^0.1.5",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"replace-in-file": "^6.3.5",
|
|
56
56
|
"resolve": "^1.20.0"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "f07f56dbe228e7d6d5acedeac5284b131acf551a"
|
|
59
59
|
}
|
package/dist/CSP.d.ts
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Use this function to provide the path to the directory where the css resources for the given package will be served from.
|
|
3
|
-
*
|
|
4
|
-
* @public
|
|
5
|
-
* @param packageName name of the package that is being configured
|
|
6
|
-
* @param root path, accessible by the server that will serve the css resources
|
|
7
|
-
*/
|
|
8
|
-
declare const setPackageCSSRoot: (packageName: string, root: string) => void;
|
|
9
|
-
declare const getUrl: (packageName: string, path: string) => string;
|
|
10
|
-
/**
|
|
11
|
-
* Call this function to enable or disable the usage of `<link>` tags instead of `<style>` tags to achieve CSP compliance
|
|
12
|
-
*
|
|
13
|
-
* Example: "setUseLinks(true)" will unconditionally use `<link>` tags for all browsers.
|
|
14
|
-
*
|
|
15
|
-
* Example: "setUseLinks(!document.adoptedStyleSheets) will only enable the usage of `<link>` tags for browsers that do not support constructable stylesheets.
|
|
16
|
-
*
|
|
17
|
-
* @public
|
|
18
|
-
* @param use whether links will be used
|
|
19
|
-
*/
|
|
20
|
-
declare const setUseLinks: (use: boolean) => void;
|
|
21
|
-
/**
|
|
22
|
-
* Call this function to enable or disable the preloading of `<link>` tags.
|
|
23
|
-
*
|
|
24
|
-
* **Note:** only taken into account when `<link>` tags are being used.
|
|
25
|
-
* **Note:** links are being preloaded by default, so call "setPreloadLinks(false)" to opt out of this.
|
|
26
|
-
*
|
|
27
|
-
* @public
|
|
28
|
-
* @param preload
|
|
29
|
-
*/
|
|
30
|
-
declare const setPreloadLinks: (preload: boolean) => void;
|
|
31
|
-
declare const shouldUseLinks: () => boolean;
|
|
32
|
-
declare const shouldPreloadLinks: () => boolean;
|
|
33
|
-
export { setPackageCSSRoot, getUrl, setUseLinks, setPreloadLinks, shouldUseLinks, shouldPreloadLinks, };
|