@ui5/webcomponents-base 2.20.0-rc.1 → 2.20.0-rc.2
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/CHANGELOG.md +12 -0
- package/dist/.tsbuildinfobuild +1 -1
- package/dist/CustomElementsScopeUtils.d.ts +9 -2
- package/dist/CustomElementsScopeUtils.js +12 -2
- package/dist/CustomElementsScopeUtils.js.map +1 -1
- package/dist/generated/VersionInfo.js +3 -3
- package/dist/generated/VersionInfo.js.map +1 -1
- package/dist/prod/CustomElementsScopeUtils.js +1 -1
- package/dist/prod/CustomElementsScopeUtils.js.map +3 -3
- package/dist/prod/generated/VersionInfo.js +1 -1
- package/dist/prod/generated/VersionInfo.js.map +1 -1
- package/dist/prod/util/dragAndDrop/DragRegistry.js +1 -1
- package/dist/prod/util/dragAndDrop/DragRegistry.js.map +3 -3
- package/dist/util/dragAndDrop/DragRegistry.d.ts +1 -1
- package/dist/util/dragAndDrop/DragRegistry.js +5 -1
- package/dist/util/dragAndDrop/DragRegistry.js.map +1 -1
- package/package.json +3 -3
|
@@ -57,8 +57,15 @@ declare const getEffectiveScopingSuffixForTag: (tag: string) => string | undefin
|
|
|
57
57
|
/**
|
|
58
58
|
* @public
|
|
59
59
|
* Used for getting a scoped name for a CSS variable using the same transformation used in the build
|
|
60
|
-
* @name the name of the css variable as written in the code
|
|
60
|
+
* @param name the name of the css variable as written in the code
|
|
61
|
+
* @param withVersion whether to include the version in the scoped name
|
|
61
62
|
* @returns a variable name with the current version inserted as available at runtime
|
|
63
|
+
* @deprecated As of version 2.19.0 this method is no longer required. Variables can now be defined at the component level
|
|
64
|
+
* and are automatically encapsulated within each component’s Shadow DOM.
|
|
65
|
+
* As a result, runtime scoping logic is no longer necessary.
|
|
66
|
+
*
|
|
67
|
+
* It is still needed for third-party packages that have not yet migrated to the
|
|
68
|
+
* component-level variable approach.
|
|
62
69
|
*/
|
|
63
|
-
declare const getScopedVarName: (name: string) => string;
|
|
70
|
+
declare const getScopedVarName: (name: string, withVersion?: boolean) => string;
|
|
64
71
|
export { setCustomElementsScopingSuffix, getCustomElementsScopingSuffix, setCustomElementsScopingRules, getCustomElementsScopingRules, shouldScopeCustomElement, getEffectiveScopingSuffixForTag, getScopedVarName, };
|
|
@@ -97,10 +97,20 @@ const getEffectiveScopingSuffixForTag = (tag) => {
|
|
|
97
97
|
/**
|
|
98
98
|
* @public
|
|
99
99
|
* Used for getting a scoped name for a CSS variable using the same transformation used in the build
|
|
100
|
-
* @name the name of the css variable as written in the code
|
|
100
|
+
* @param name the name of the css variable as written in the code
|
|
101
|
+
* @param withVersion whether to include the version in the scoped name
|
|
101
102
|
* @returns a variable name with the current version inserted as available at runtime
|
|
103
|
+
* @deprecated As of version 2.19.0 this method is no longer required. Variables can now be defined at the component level
|
|
104
|
+
* and are automatically encapsulated within each component’s Shadow DOM.
|
|
105
|
+
* As a result, runtime scoping logic is no longer necessary.
|
|
106
|
+
*
|
|
107
|
+
* It is still needed for third-party packages that have not yet migrated to the
|
|
108
|
+
* component-level variable approach.
|
|
102
109
|
*/
|
|
103
|
-
const getScopedVarName = (name) => {
|
|
110
|
+
const getScopedVarName = (name, withVersion = false) => {
|
|
111
|
+
if (!withVersion) {
|
|
112
|
+
return name;
|
|
113
|
+
}
|
|
104
114
|
const versionStr = `v${VersionInfo.version.replaceAll(".", "-")}`;
|
|
105
115
|
const expr = /(--_?ui5)([^,:)\s]+)/g;
|
|
106
116
|
return name.replaceAll(expr, `$1-${versionStr}$2`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CustomElementsScopeUtils.js","sourceRoot":"","sources":["../src/CustomElementsScopeUtils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,WAAW,MAAM,4BAA4B,CAAC;AAErD,IAAI,GAAW,CAAC;AAOhB,IAAI,QAAQ,GAAU;IACrB,OAAO,EAAE,CAAC,OAA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IAAI,CAAC,WAAW,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IACb,CAAC;IAED,MAAM,UAAU,GAAG,IAAI,WAAW,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,CAAC;IAClE,MAAM,IAAI,GAAG,uBAAuB,CAAC;IACrC,OAAO,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,UAAU,IAAI,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF,OAAO,EACN,8BAA8B,EAC9B,8BAA8B,EAC9B,6BAA6B,EAC7B,6BAA6B,EAC7B,wBAAwB,EACxB,+BAA+B,EAC/B,gBAAgB,GAChB,CAAC","sourcesContent":["import { hasRegisteredTags } from \"./CustomElementsRegistry.js\";\nimport VersionInfo from \"./generated/VersionInfo.js\";\n\nlet suf: string;\n\ntype Rules = {\n\tinclude: Array<RegExp>,\n\texclude: Array<RegExp>,\n};\n\nlet rulesObj: Rules = {\n\tinclude: [/^ui5-/],\n\texclude: [],\n};\n\nconst tagsCache = new Map<string, boolean>(); // true/false means the tag should/should not be cached, undefined means not known yet.\n\n/**\n * Sets the suffix to be used for custom elements scoping, f.e. pass \"demo\" to get tags such as \"ui5-button-demo\".\n *\n * **Note:** By default all tags starting with \"ui5-\" will be scoped, unless you change this by calling \"setCustomElementsScopingRules\"\n * **Note:** Setting the scoping suffix must be done before importing any components.\n *\n * @public\n * @param suffix The scoping suffix\n */\nconst setCustomElementsScopingSuffix = (suffix: string) => {\n\tif (!suffix.match(/^[a-zA-Z0-9_-]+$/)) {\n\t\tthrow new Error(\"Only alphanumeric characters and dashes allowed for the scoping suffix\");\n\t}\n\n\tif (hasRegisteredTags()) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\"Setting the scoping suffix must be done before importing any components. For proper usage, read the scoping section: https://github.com/UI5/webcomponents/blob/main/docs/2-advanced/06-scoping.md.\");\n\t}\n\n\tsuf = suffix;\n};\n\n/**\n * Returns the currently set scoping suffix, or undefined if not set.\n *\n * @public\n * @returns {String|undefined}\n */\nconst getCustomElementsScopingSuffix = (): string | undefined => {\n\treturn suf;\n};\n\n/**\n * Sets the rules, governing which custom element tags to scope and which not, f.e.\n * setCustomElementsScopingRules({include: [/^ui5-/]}, exclude: [/^ui5-mylib-/, /^ui5-carousel$/]);\n * will scope all elements starting with \"ui5-\" but not the ones starting with \"ui5-mylib-\" and not \"ui5-carousel\".\n *\n * @public\n * @param rules Object with \"include\" and \"exclude\" properties, both arrays of regular expressions. Note that \"include\"\n * rules are applied first and \"exclude\" rules second.\n */\nconst setCustomElementsScopingRules = (rules: Rules) => {\n\tif (!rules || !rules.include) {\n\t\tthrow new Error(`\"rules\" must be an object with at least an \"include\" property`);\n\t}\n\n\tif (!Array.isArray(rules.include) || rules.include.some(rule => !(rule instanceof RegExp))) {\n\t\tthrow new Error(`\"rules.include\" must be an array of regular expressions`);\n\t}\n\n\tif (rules.exclude && (!Array.isArray(rules.exclude) || rules.exclude.some(rule => !(rule instanceof RegExp)))) {\n\t\tthrow new Error(`\"rules.exclude\" must be an array of regular expressions`);\n\t}\n\n\trules.exclude = rules.exclude || [];\n\trulesObj = rules;\n\ttagsCache.clear(); // reset the cache upon setting new rules\n};\n\n/**\n * Returns the rules, governing which custom element tags to scope and which not. By default, all elements\n * starting with \"ui5-\" are scoped. The default rules are: {include: [/^ui5-/]}.\n *\n * @public\n * @returns {Object}\n */\nconst getCustomElementsScopingRules = () => {\n\treturn rulesObj;\n};\n\n/**\n * Determines whether custom elements with the given tag should be scoped or not.\n * The tag is first matched against the \"include\" rules and then against the \"exclude\" rules and the\n * result is cached until new rules are set.\n *\n * @public\n * @param tag\n */\nconst shouldScopeCustomElement = (tag: string) => {\n\tif (!tagsCache.has(tag)) {\n\t\tconst result = rulesObj.include.some(rule => tag.match(rule)) && !rulesObj.exclude.some(rule => tag.match(rule));\n\t\ttagsCache.set(tag, result);\n\t}\n\n\treturn tagsCache.get(tag);\n};\n\n/**\n * Returns the currently set scoping suffix, if any and if the tag should be scoped, or undefined otherwise.\n *\n * @public\n * @param tag\n * @returns {String}\n */\nconst getEffectiveScopingSuffixForTag = (tag: string) => {\n\tif (shouldScopeCustomElement(tag)) {\n\t\treturn getCustomElementsScopingSuffix();\n\t}\n};\n\n/**\n * @public\n * Used for getting a scoped name for a CSS variable using the same transformation used in the build\n * @param name the name of the css variable as written in the code\n * @param withVersion whether to include the version in the scoped name\n * @returns a variable name with the current version inserted as available at runtime\n * @deprecated As of version 2.19.0 this method is no longer required. Variables can now be defined at the component level\n * and are automatically encapsulated within each component’s Shadow DOM.\n * As a result, runtime scoping logic is no longer necessary.\n *\n * It is still needed for third-party packages that have not yet migrated to the\n * component-level variable approach.\n */\nconst getScopedVarName = (name: string, withVersion: boolean = false) => {\n\tif (!withVersion) {\n\t\treturn name;\n\t}\n\n\tconst versionStr = `v${VersionInfo.version.replaceAll(\".\", \"-\")}`;\n\tconst expr = /(--_?ui5)([^,:)\\s]+)/g;\n\treturn name.replaceAll(expr, `$1-${versionStr}$2`);\n};\n\nexport {\n\tsetCustomElementsScopingSuffix,\n\tgetCustomElementsScopingSuffix,\n\tsetCustomElementsScopingRules,\n\tgetCustomElementsScopingRules,\n\tshouldScopeCustomElement,\n\tgetEffectiveScopingSuffixForTag,\n\tgetScopedVarName,\n};\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
const VersionInfo = {
|
|
2
|
-
version: "2.20.0-rc.
|
|
2
|
+
version: "2.20.0-rc.2",
|
|
3
3
|
major: 2,
|
|
4
4
|
minor: 20,
|
|
5
5
|
patch: 0,
|
|
6
|
-
suffix: "-rc.
|
|
6
|
+
suffix: "-rc.2",
|
|
7
7
|
isNext: false,
|
|
8
|
-
buildTime:
|
|
8
|
+
buildTime: 1772093629,
|
|
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,aAAa;IACtB,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,EAAE;IACT,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.20.0-rc.
|
|
1
|
+
{"version":3,"file":"VersionInfo.js","sourceRoot":"","sources":["../../src/generated/VersionInfo.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,GAAG;IACnB,OAAO,EAAE,aAAa;IACtB,KAAK,EAAE,CAAC;IACR,KAAK,EAAE,EAAE;IACT,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.20.0-rc.2\",\n\tmajor: 2,\n\tminor: 20,\n\tpatch: 0,\n\tsuffix: \"-rc.2\",\n\tisNext: false,\n\tbuildTime: 1772093629,\n};\nexport default VersionInfo;"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";import{hasRegisteredTags as
|
|
1
|
+
"use strict";import{hasRegisteredTags as u}from"./CustomElementsRegistry.js";import l from"./generated/VersionInfo.js";let s,t={include:[/^ui5-/],exclude:[]};const o=new Map,p=e=>{if(!e.match(/^[a-zA-Z0-9_-]+$/))throw new Error("Only alphanumeric characters and dashes allowed for the scoping suffix");u()&&console.warn("Setting the scoping suffix must be done before importing any components. For proper usage, read the scoping section: https://github.com/UI5/webcomponents/blob/main/docs/2-advanced/06-scoping.md."),s=e},c=()=>s,g=e=>{if(!e||!e.include)throw new Error('"rules" must be an object with at least an "include" property');if(!Array.isArray(e.include)||e.include.some(n=>!(n instanceof RegExp)))throw new Error('"rules.include" must be an array of regular expressions');if(e.exclude&&(!Array.isArray(e.exclude)||e.exclude.some(n=>!(n instanceof RegExp))))throw new Error('"rules.exclude" must be an array of regular expressions');e.exclude=e.exclude||[],t=e,o.clear()},m=()=>t,i=e=>{if(!o.has(e)){const n=t.include.some(r=>e.match(r))&&!t.exclude.some(r=>e.match(r));o.set(e,n)}return o.get(e)},d=e=>{if(i(e))return c()},f=(e,n=!1)=>{if(!n)return e;const r=`v${l.version.replaceAll(".","-")}`,a=/(--_?ui5)([^,:)\s]+)/g;return e.replaceAll(a,`$1-${r}$2`)};export{p as setCustomElementsScopingSuffix,c as getCustomElementsScopingSuffix,g as setCustomElementsScopingRules,m as getCustomElementsScopingRules,i as shouldScopeCustomElement,d as getEffectiveScopingSuffixForTag,f as getScopedVarName};
|
|
2
2
|
//# sourceMappingURL=CustomElementsScopeUtils.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/CustomElementsScopeUtils.ts"],
|
|
4
|
-
"sourcesContent": ["import { hasRegisteredTags } from \"./CustomElementsRegistry.js\";\nimport VersionInfo from \"./generated/VersionInfo.js\";\n\nlet suf: string;\n\ntype Rules = {\n\tinclude: Array<RegExp>,\n\texclude: Array<RegExp>,\n};\n\nlet rulesObj: Rules = {\n\tinclude: [/^ui5-/],\n\texclude: [],\n};\n\nconst tagsCache = new Map<string, boolean>(); // true/false means the tag should/should not be cached, undefined means not known yet.\n\n/**\n * Sets the suffix to be used for custom elements scoping, f.e. pass \"demo\" to get tags such as \"ui5-button-demo\".\n *\n * **Note:** By default all tags starting with \"ui5-\" will be scoped, unless you change this by calling \"setCustomElementsScopingRules\"\n * **Note:** Setting the scoping suffix must be done before importing any components.\n *\n * @public\n * @param suffix The scoping suffix\n */\nconst setCustomElementsScopingSuffix = (suffix: string) => {\n\tif (!suffix.match(/^[a-zA-Z0-9_-]+$/)) {\n\t\tthrow new Error(\"Only alphanumeric characters and dashes allowed for the scoping suffix\");\n\t}\n\n\tif (hasRegisteredTags()) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\"Setting the scoping suffix must be done before importing any components. For proper usage, read the scoping section: https://github.com/UI5/webcomponents/blob/main/docs/2-advanced/06-scoping.md.\");\n\t}\n\n\tsuf = suffix;\n};\n\n/**\n * Returns the currently set scoping suffix, or undefined if not set.\n *\n * @public\n * @returns {String|undefined}\n */\nconst getCustomElementsScopingSuffix = (): string | undefined => {\n\treturn suf;\n};\n\n/**\n * Sets the rules, governing which custom element tags to scope and which not, f.e.\n * setCustomElementsScopingRules({include: [/^ui5-/]}, exclude: [/^ui5-mylib-/, /^ui5-carousel$/]);\n * will scope all elements starting with \"ui5-\" but not the ones starting with \"ui5-mylib-\" and not \"ui5-carousel\".\n *\n * @public\n * @param rules Object with \"include\" and \"exclude\" properties, both arrays of regular expressions. Note that \"include\"\n * rules are applied first and \"exclude\" rules second.\n */\nconst setCustomElementsScopingRules = (rules: Rules) => {\n\tif (!rules || !rules.include) {\n\t\tthrow new Error(`\"rules\" must be an object with at least an \"include\" property`);\n\t}\n\n\tif (!Array.isArray(rules.include) || rules.include.some(rule => !(rule instanceof RegExp))) {\n\t\tthrow new Error(`\"rules.include\" must be an array of regular expressions`);\n\t}\n\n\tif (rules.exclude && (!Array.isArray(rules.exclude) || rules.exclude.some(rule => !(rule instanceof RegExp)))) {\n\t\tthrow new Error(`\"rules.exclude\" must be an array of regular expressions`);\n\t}\n\n\trules.exclude = rules.exclude || [];\n\trulesObj = rules;\n\ttagsCache.clear(); // reset the cache upon setting new rules\n};\n\n/**\n * Returns the rules, governing which custom element tags to scope and which not. By default, all elements\n * starting with \"ui5-\" are scoped. The default rules are: {include: [/^ui5-/]}.\n *\n * @public\n * @returns {Object}\n */\nconst getCustomElementsScopingRules = () => {\n\treturn rulesObj;\n};\n\n/**\n * Determines whether custom elements with the given tag should be scoped or not.\n * The tag is first matched against the \"include\" rules and then against the \"exclude\" rules and the\n * result is cached until new rules are set.\n *\n * @public\n * @param tag\n */\nconst shouldScopeCustomElement = (tag: string) => {\n\tif (!tagsCache.has(tag)) {\n\t\tconst result = rulesObj.include.some(rule => tag.match(rule)) && !rulesObj.exclude.some(rule => tag.match(rule));\n\t\ttagsCache.set(tag, result);\n\t}\n\n\treturn tagsCache.get(tag);\n};\n\n/**\n * Returns the currently set scoping suffix, if any and if the tag should be scoped, or undefined otherwise.\n *\n * @public\n * @param tag\n * @returns {String}\n */\nconst getEffectiveScopingSuffixForTag = (tag: string) => {\n\tif (shouldScopeCustomElement(tag)) {\n\t\treturn getCustomElementsScopingSuffix();\n\t}\n};\n\n/**\n * @public\n * Used for getting a scoped name for a CSS variable using the same transformation used in the build\n * @name the name of the css variable as written in the code\n * @returns a variable name with the current version inserted as available at runtime\n */\nconst getScopedVarName = (name: string) => {\n\tconst versionStr = `v${VersionInfo.version.replaceAll(\".\", \"-\")}`;\n\tconst expr = /(--_?ui5)([^,:)\\s]+)/g;\n\treturn name.replaceAll(expr, `$1-${versionStr}$2`);\n};\n\nexport {\n\tsetCustomElementsScopingSuffix,\n\tgetCustomElementsScopingSuffix,\n\tsetCustomElementsScopingRules,\n\tgetCustomElementsScopingRules,\n\tshouldScopeCustomElement,\n\tgetEffectiveScopingSuffixForTag,\n\tgetScopedVarName,\n};\n"],
|
|
5
|
-
"mappings": "aAAA,OAAS,qBAAAA,MAAyB,8BAClC,OAAOC,MAAiB,6BAExB,IAAIC,EAOAC,EAAkB,CACrB,QAAS,CAAC,OAAO,EACjB,QAAS,CAAC,CACX,EAEA,MAAMC,EAAY,IAAI,IAWhBC,EAAkCC,GAAmB,CAC1D,GAAI,CAACA,EAAO,MAAM,kBAAkB,EACnC,MAAM,IAAI,MAAM,wEAAwE,EAGrFN,EAAkB,GAErB,QAAQ,KAAK,oMAAoM,EAGlNE,EAAMI,CACP,EAQMC,EAAiC,IAC/BL,EAYFM,EAAiCC,GAAiB,CACvD,GAAI,CAACA,GAAS,CAACA,EAAM,QACpB,MAAM,IAAI,MAAM,+DAA+D,EAGhF,GAAI,CAAC,MAAM,QAAQA,EAAM,OAAO,GAAKA,EAAM,QAAQ,KAAKC,GAAQ,EAAEA,aAAgB,OAAO,EACxF,MAAM,IAAI,MAAM,yDAAyD,EAG1E,GAAID,EAAM,UAAY,CAAC,MAAM,QAAQA,EAAM,OAAO,GAAKA,EAAM,QAAQ,KAAKC,GAAQ,EAAEA,aAAgB,OAAO,GAC1G,MAAM,IAAI,MAAM,yDAAyD,EAG1ED,EAAM,QAAUA,EAAM,SAAW,CAAC,EAClCN,EAAWM,EACXL,EAAU,MAAM,CACjB,EASMO,EAAgC,IAC9BR,EAWFS,EAA4BC,GAAgB,CACjD,GAAI,CAACT,EAAU,IAAIS,CAAG,EAAG,CACxB,MAAMC,EAASX,EAAS,QAAQ,KAAKO,GAAQG,EAAI,MAAMH,CAAI,CAAC,GAAK,CAACP,EAAS,QAAQ,KAAKO,GAAQG,EAAI,MAAMH,CAAI,CAAC,EAC/GN,EAAU,IAAIS,EAAKC,CAAM,CAC1B,CAEA,OAAOV,EAAU,IAAIS,CAAG,CACzB,EASME,EAAmCF,GAAgB,CACxD,GAAID,EAAyBC,CAAG,EAC/B,OAAON,EAA+B,CAExC,
|
|
6
|
-
"names": ["hasRegisteredTags", "VersionInfo", "suf", "rulesObj", "tagsCache", "setCustomElementsScopingSuffix", "suffix", "getCustomElementsScopingSuffix", "setCustomElementsScopingRules", "rules", "rule", "getCustomElementsScopingRules", "shouldScopeCustomElement", "tag", "result", "getEffectiveScopingSuffixForTag", "getScopedVarName", "name", "versionStr", "expr"]
|
|
4
|
+
"sourcesContent": ["import { hasRegisteredTags } from \"./CustomElementsRegistry.js\";\nimport VersionInfo from \"./generated/VersionInfo.js\";\n\nlet suf: string;\n\ntype Rules = {\n\tinclude: Array<RegExp>,\n\texclude: Array<RegExp>,\n};\n\nlet rulesObj: Rules = {\n\tinclude: [/^ui5-/],\n\texclude: [],\n};\n\nconst tagsCache = new Map<string, boolean>(); // true/false means the tag should/should not be cached, undefined means not known yet.\n\n/**\n * Sets the suffix to be used for custom elements scoping, f.e. pass \"demo\" to get tags such as \"ui5-button-demo\".\n *\n * **Note:** By default all tags starting with \"ui5-\" will be scoped, unless you change this by calling \"setCustomElementsScopingRules\"\n * **Note:** Setting the scoping suffix must be done before importing any components.\n *\n * @public\n * @param suffix The scoping suffix\n */\nconst setCustomElementsScopingSuffix = (suffix: string) => {\n\tif (!suffix.match(/^[a-zA-Z0-9_-]+$/)) {\n\t\tthrow new Error(\"Only alphanumeric characters and dashes allowed for the scoping suffix\");\n\t}\n\n\tif (hasRegisteredTags()) {\n\t\t// eslint-disable-next-line no-console\n\t\tconsole.warn(\"Setting the scoping suffix must be done before importing any components. For proper usage, read the scoping section: https://github.com/UI5/webcomponents/blob/main/docs/2-advanced/06-scoping.md.\");\n\t}\n\n\tsuf = suffix;\n};\n\n/**\n * Returns the currently set scoping suffix, or undefined if not set.\n *\n * @public\n * @returns {String|undefined}\n */\nconst getCustomElementsScopingSuffix = (): string | undefined => {\n\treturn suf;\n};\n\n/**\n * Sets the rules, governing which custom element tags to scope and which not, f.e.\n * setCustomElementsScopingRules({include: [/^ui5-/]}, exclude: [/^ui5-mylib-/, /^ui5-carousel$/]);\n * will scope all elements starting with \"ui5-\" but not the ones starting with \"ui5-mylib-\" and not \"ui5-carousel\".\n *\n * @public\n * @param rules Object with \"include\" and \"exclude\" properties, both arrays of regular expressions. Note that \"include\"\n * rules are applied first and \"exclude\" rules second.\n */\nconst setCustomElementsScopingRules = (rules: Rules) => {\n\tif (!rules || !rules.include) {\n\t\tthrow new Error(`\"rules\" must be an object with at least an \"include\" property`);\n\t}\n\n\tif (!Array.isArray(rules.include) || rules.include.some(rule => !(rule instanceof RegExp))) {\n\t\tthrow new Error(`\"rules.include\" must be an array of regular expressions`);\n\t}\n\n\tif (rules.exclude && (!Array.isArray(rules.exclude) || rules.exclude.some(rule => !(rule instanceof RegExp)))) {\n\t\tthrow new Error(`\"rules.exclude\" must be an array of regular expressions`);\n\t}\n\n\trules.exclude = rules.exclude || [];\n\trulesObj = rules;\n\ttagsCache.clear(); // reset the cache upon setting new rules\n};\n\n/**\n * Returns the rules, governing which custom element tags to scope and which not. By default, all elements\n * starting with \"ui5-\" are scoped. The default rules are: {include: [/^ui5-/]}.\n *\n * @public\n * @returns {Object}\n */\nconst getCustomElementsScopingRules = () => {\n\treturn rulesObj;\n};\n\n/**\n * Determines whether custom elements with the given tag should be scoped or not.\n * The tag is first matched against the \"include\" rules and then against the \"exclude\" rules and the\n * result is cached until new rules are set.\n *\n * @public\n * @param tag\n */\nconst shouldScopeCustomElement = (tag: string) => {\n\tif (!tagsCache.has(tag)) {\n\t\tconst result = rulesObj.include.some(rule => tag.match(rule)) && !rulesObj.exclude.some(rule => tag.match(rule));\n\t\ttagsCache.set(tag, result);\n\t}\n\n\treturn tagsCache.get(tag);\n};\n\n/**\n * Returns the currently set scoping suffix, if any and if the tag should be scoped, or undefined otherwise.\n *\n * @public\n * @param tag\n * @returns {String}\n */\nconst getEffectiveScopingSuffixForTag = (tag: string) => {\n\tif (shouldScopeCustomElement(tag)) {\n\t\treturn getCustomElementsScopingSuffix();\n\t}\n};\n\n/**\n * @public\n * Used for getting a scoped name for a CSS variable using the same transformation used in the build\n * @param name the name of the css variable as written in the code\n * @param withVersion whether to include the version in the scoped name\n * @returns a variable name with the current version inserted as available at runtime\n * @deprecated As of version 2.19.0 this method is no longer required. Variables can now be defined at the component level\n * and are automatically encapsulated within each component\u2019s Shadow DOM.\n * As a result, runtime scoping logic is no longer necessary.\n *\n * It is still needed for third-party packages that have not yet migrated to the\n * component-level variable approach.\n */\nconst getScopedVarName = (name: string, withVersion: boolean = false) => {\n\tif (!withVersion) {\n\t\treturn name;\n\t}\n\n\tconst versionStr = `v${VersionInfo.version.replaceAll(\".\", \"-\")}`;\n\tconst expr = /(--_?ui5)([^,:)\\s]+)/g;\n\treturn name.replaceAll(expr, `$1-${versionStr}$2`);\n};\n\nexport {\n\tsetCustomElementsScopingSuffix,\n\tgetCustomElementsScopingSuffix,\n\tsetCustomElementsScopingRules,\n\tgetCustomElementsScopingRules,\n\tshouldScopeCustomElement,\n\tgetEffectiveScopingSuffixForTag,\n\tgetScopedVarName,\n};\n"],
|
|
5
|
+
"mappings": "aAAA,OAAS,qBAAAA,MAAyB,8BAClC,OAAOC,MAAiB,6BAExB,IAAIC,EAOAC,EAAkB,CACrB,QAAS,CAAC,OAAO,EACjB,QAAS,CAAC,CACX,EAEA,MAAMC,EAAY,IAAI,IAWhBC,EAAkCC,GAAmB,CAC1D,GAAI,CAACA,EAAO,MAAM,kBAAkB,EACnC,MAAM,IAAI,MAAM,wEAAwE,EAGrFN,EAAkB,GAErB,QAAQ,KAAK,oMAAoM,EAGlNE,EAAMI,CACP,EAQMC,EAAiC,IAC/BL,EAYFM,EAAiCC,GAAiB,CACvD,GAAI,CAACA,GAAS,CAACA,EAAM,QACpB,MAAM,IAAI,MAAM,+DAA+D,EAGhF,GAAI,CAAC,MAAM,QAAQA,EAAM,OAAO,GAAKA,EAAM,QAAQ,KAAKC,GAAQ,EAAEA,aAAgB,OAAO,EACxF,MAAM,IAAI,MAAM,yDAAyD,EAG1E,GAAID,EAAM,UAAY,CAAC,MAAM,QAAQA,EAAM,OAAO,GAAKA,EAAM,QAAQ,KAAKC,GAAQ,EAAEA,aAAgB,OAAO,GAC1G,MAAM,IAAI,MAAM,yDAAyD,EAG1ED,EAAM,QAAUA,EAAM,SAAW,CAAC,EAClCN,EAAWM,EACXL,EAAU,MAAM,CACjB,EASMO,EAAgC,IAC9BR,EAWFS,EAA4BC,GAAgB,CACjD,GAAI,CAACT,EAAU,IAAIS,CAAG,EAAG,CACxB,MAAMC,EAASX,EAAS,QAAQ,KAAKO,GAAQG,EAAI,MAAMH,CAAI,CAAC,GAAK,CAACP,EAAS,QAAQ,KAAKO,GAAQG,EAAI,MAAMH,CAAI,CAAC,EAC/GN,EAAU,IAAIS,EAAKC,CAAM,CAC1B,CAEA,OAAOV,EAAU,IAAIS,CAAG,CACzB,EASME,EAAmCF,GAAgB,CACxD,GAAID,EAAyBC,CAAG,EAC/B,OAAON,EAA+B,CAExC,EAeMS,EAAmB,CAACC,EAAcC,EAAuB,KAAU,CACxE,GAAI,CAACA,EACJ,OAAOD,EAGR,MAAME,EAAa,IAAIlB,EAAY,QAAQ,WAAW,IAAK,GAAG,CAAC,GACzDmB,EAAO,wBACb,OAAOH,EAAK,WAAWG,EAAM,MAAMD,CAAU,IAAI,CAClD,EAEA,OACCd,KAAA,+BACAE,KAAA,+BACAC,KAAA,8BACAG,KAAA,8BACAC,KAAA,yBACAG,KAAA,gCACAC,KAAA",
|
|
6
|
+
"names": ["hasRegisteredTags", "VersionInfo", "suf", "rulesObj", "tagsCache", "setCustomElementsScopingSuffix", "suffix", "getCustomElementsScopingSuffix", "setCustomElementsScopingRules", "rules", "rule", "getCustomElementsScopingRules", "shouldScopeCustomElement", "tag", "result", "getEffectiveScopingSuffixForTag", "getScopedVarName", "name", "withVersion", "versionStr", "expr"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";const e={version:"2.20.0-rc.
|
|
1
|
+
"use strict";const e={version:"2.20.0-rc.2",major:2,minor:20,patch:0,suffix:"-rc.2",isNext:!1,buildTime:1772093629};export default e;
|
|
2
2
|
//# sourceMappingURL=VersionInfo.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/generated/VersionInfo.ts"],
|
|
4
|
-
"sourcesContent": ["const VersionInfo = {\n\tversion: \"2.20.0-rc.
|
|
4
|
+
"sourcesContent": ["const VersionInfo = {\n\tversion: \"2.20.0-rc.2\",\n\tmajor: 2,\n\tminor: 20,\n\tpatch: 0,\n\tsuffix: \"-rc.2\",\n\tisNext: false,\n\tbuildTime: 1772093629,\n};\nexport default VersionInfo;"],
|
|
5
5
|
"mappings": "aAAA,MAAMA,EAAc,CACnB,QAAS,cACT,MAAO,EACP,MAAO,GACP,MAAO,EACP,OAAQ,QACR,OAAQ,GACR,UAAW,UACZ,EACA,eAAeA",
|
|
6
6
|
"names": ["VersionInfo"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";import
|
|
1
|
+
"use strict";import m from"../../generated/css/MultipleDragGhost.css.js";import{getI18nBundle as i}from"../../i18nBundle.js";import{DRAG_DROP_MULTIPLE_TEXT as c}from"../../generated/i18n/i18n-defaults.js";const l=2;let a=null;const g=(e,t)=>{a=e,t?.dataTransfer?.setData("text/plain",e?e.id:"")},d=()=>{a=null},p=()=>a,u=async e=>{const t=document.createElement("div"),n=await i("@ui5/webcomponents-base"),r=t.attachShadow({mode:"open"}),o=new CSSStyleSheet;return o.replaceSync(m),r.adoptedStyleSheets=[o],r.textContent=n.getText(c,e),t},s=async(e,t)=>{if(e<l){console.warn(`Cannot start multiple drag with count ${e}. Minimum is ${l}.`);return}if(!t.dataTransfer)return;const n=await u(e);document.body.appendChild(n),t.dataTransfer.setDragImage(n,0,0),requestAnimationFrame(()=>{n.remove()})},D={setDraggedElement:g,clearDraggedElement:d,getDraggedElement:p,startMultipleDrag:s};export default D;export{s as startMultipleDrag};
|
|
2
2
|
//# sourceMappingURL=DragRegistry.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/util/dragAndDrop/DragRegistry.ts"],
|
|
4
|
-
"sourcesContent": ["import type MovePlacement from \"../../types/MovePlacement.js\";\nimport MultipleDragGhostCss from \"../../generated/css/MultipleDragGhost.css.js\";\n\nimport { getI18nBundle } from \"../../i18nBundle.js\";\n\nimport {\n\tDRAG_DROP_MULTIPLE_TEXT,\n} from \"../../generated/i18n/i18n-defaults.js\";\n\nconst MIN_MULTI_DRAG_COUNT = 2;\n\nlet draggedElement: HTMLElement | null = null;\n\nconst setDraggedElement = (element: HTMLElement | null) => {\n\tdraggedElement = element;\n};\n\nconst clearDraggedElement = () => {\n\tdraggedElement = null;\n};\n\nconst getDraggedElement = () => {\n\treturn draggedElement;\n};\n\nconst createDefaultMultiDragElement = async (count: number): Promise<HTMLElement> => {\n\tconst dragElement = document.createElement(\"div\");\n\tconst i18nBundle = await getI18nBundle(\"@ui5/webcomponents-base\");\n\n\tconst dragElementShadow = dragElement.attachShadow({ mode: \"open\" });\n\n\tconst styles = new CSSStyleSheet();\n\tstyles.replaceSync(MultipleDragGhostCss);\n\n\tdragElementShadow.adoptedStyleSheets = [styles];\n\tdragElementShadow.textContent = i18nBundle.getText(DRAG_DROP_MULTIPLE_TEXT, count);\n\n\treturn dragElement;\n};\n\n/**\n * Starts a multiple drag operation by creating a drag ghost element.\n * The drag ghost will be displayed when dragging multiple items.\n *\n * @param {number} count - The number of items being dragged.\n * @param {DragEvent} e - The drag event that triggered the operation.\n * @public\n */\nconst startMultipleDrag = async (count: number, e: DragEvent) => {\n\tif (count < MIN_MULTI_DRAG_COUNT) {\n\t\tconsole.warn(`Cannot start multiple drag with count ${count}. Minimum is ${MIN_MULTI_DRAG_COUNT}.`); // eslint-disable-line\n\t\treturn;\n\t}\n\n\tif (!e.dataTransfer) {\n\t\treturn;\n\t}\n\n\tconst customDragElement = await createDefaultMultiDragElement(count);\n\n\t// Add to document body temporarily\n\tdocument.body.appendChild(customDragElement);\n\n\te.dataTransfer.setDragImage(customDragElement, 0, 0);\n\n\t// Clean up the temporary element after the drag operation starts\n\trequestAnimationFrame(() => {\n\t\tcustomDragElement.remove();\n\t});\n};\n\ntype DragAndDropSettings = {\n\t/**\n\t * Allow cross-browser and file drag and drop.\n\t */\n\tcrossDnD?: boolean;\n\t/**\n\t * Pass the original event in the event parameters.\n\t */\n\toriginalEvent?: boolean;\n};\n\ntype MoveEventDetail = {\n\toriginalEvent: Event,\n\tsource: {\n\t\telement: HTMLElement,\n\t},\n\tdestination: {\n\t\telement: HTMLElement,\n\t\tplacement: `${MovePlacement}`,\n\t}\n};\n\nconst DragRegistry = {\n\tsetDraggedElement,\n\tclearDraggedElement,\n\tgetDraggedElement,\n\tstartMultipleDrag,\n};\n\nexport default DragRegistry;\nexport {\n\tstartMultipleDrag,\n};\n\nexport type {\n\tDragAndDropSettings,\n\tMoveEventDetail,\n};\n"],
|
|
5
|
-
"mappings": "aACA,OAAOA,MAA0B,+CAEjC,OAAS,iBAAAC,MAAqB,sBAE9B,OACC,2BAAAC,MACM,wCAEP,MAAMC,EAAuB,EAE7B,IAAIC,EAAqC,KAEzC,MAAMC,
|
|
6
|
-
"names": ["MultipleDragGhostCss", "getI18nBundle", "DRAG_DROP_MULTIPLE_TEXT", "MIN_MULTI_DRAG_COUNT", "draggedElement", "setDraggedElement", "element", "clearDraggedElement", "getDraggedElement", "createDefaultMultiDragElement", "count", "dragElement", "i18nBundle", "dragElementShadow", "styles", "startMultipleDrag", "
|
|
4
|
+
"sourcesContent": ["import type MovePlacement from \"../../types/MovePlacement.js\";\nimport MultipleDragGhostCss from \"../../generated/css/MultipleDragGhost.css.js\";\n\nimport { getI18nBundle } from \"../../i18nBundle.js\";\n\nimport {\n\tDRAG_DROP_MULTIPLE_TEXT,\n} from \"../../generated/i18n/i18n-defaults.js\";\n\nconst MIN_MULTI_DRAG_COUNT = 2;\n\nlet draggedElement: HTMLElement | null = null;\n\nconst setDraggedElement = (element: HTMLElement | null, e?: DragEvent) => {\n\tdraggedElement = element;\n\n\t// Store the dragged element's ID in the dataTransfer object to ensure\n\t// the drag operation is recognized across different browsers and contexts.\n\t// Without this, Safari browser in iOS may not recognize the drag operation.\n\te?.dataTransfer?.setData(\"text/plain\", element ? element.id : \"\");\n};\n\nconst clearDraggedElement = () => {\n\tdraggedElement = null;\n};\n\nconst getDraggedElement = () => {\n\treturn draggedElement;\n};\n\nconst createDefaultMultiDragElement = async (count: number): Promise<HTMLElement> => {\n\tconst dragElement = document.createElement(\"div\");\n\tconst i18nBundle = await getI18nBundle(\"@ui5/webcomponents-base\");\n\n\tconst dragElementShadow = dragElement.attachShadow({ mode: \"open\" });\n\n\tconst styles = new CSSStyleSheet();\n\tstyles.replaceSync(MultipleDragGhostCss);\n\n\tdragElementShadow.adoptedStyleSheets = [styles];\n\tdragElementShadow.textContent = i18nBundle.getText(DRAG_DROP_MULTIPLE_TEXT, count);\n\n\treturn dragElement;\n};\n\n/**\n * Starts a multiple drag operation by creating a drag ghost element.\n * The drag ghost will be displayed when dragging multiple items.\n *\n * @param {number} count - The number of items being dragged.\n * @param {DragEvent} e - The drag event that triggered the operation.\n * @public\n */\nconst startMultipleDrag = async (count: number, e: DragEvent) => {\n\tif (count < MIN_MULTI_DRAG_COUNT) {\n\t\tconsole.warn(`Cannot start multiple drag with count ${count}. Minimum is ${MIN_MULTI_DRAG_COUNT}.`); // eslint-disable-line\n\t\treturn;\n\t}\n\n\tif (!e.dataTransfer) {\n\t\treturn;\n\t}\n\n\tconst customDragElement = await createDefaultMultiDragElement(count);\n\n\t// Add to document body temporarily\n\tdocument.body.appendChild(customDragElement);\n\n\te.dataTransfer.setDragImage(customDragElement, 0, 0);\n\n\t// Clean up the temporary element after the drag operation starts\n\trequestAnimationFrame(() => {\n\t\tcustomDragElement.remove();\n\t});\n};\n\ntype DragAndDropSettings = {\n\t/**\n\t * Allow cross-browser and file drag and drop.\n\t */\n\tcrossDnD?: boolean;\n\t/**\n\t * Pass the original event in the event parameters.\n\t */\n\toriginalEvent?: boolean;\n};\n\ntype MoveEventDetail = {\n\toriginalEvent: Event,\n\tsource: {\n\t\telement: HTMLElement,\n\t},\n\tdestination: {\n\t\telement: HTMLElement,\n\t\tplacement: `${MovePlacement}`,\n\t}\n};\n\nconst DragRegistry = {\n\tsetDraggedElement,\n\tclearDraggedElement,\n\tgetDraggedElement,\n\tstartMultipleDrag,\n};\n\nexport default DragRegistry;\nexport {\n\tstartMultipleDrag,\n};\n\nexport type {\n\tDragAndDropSettings,\n\tMoveEventDetail,\n};\n"],
|
|
5
|
+
"mappings": "aACA,OAAOA,MAA0B,+CAEjC,OAAS,iBAAAC,MAAqB,sBAE9B,OACC,2BAAAC,MACM,wCAEP,MAAMC,EAAuB,EAE7B,IAAIC,EAAqC,KAEzC,MAAMC,EAAoB,CAACC,EAA6BC,IAAkB,CACzEH,EAAiBE,EAKjBC,GAAG,cAAc,QAAQ,aAAcD,EAAUA,EAAQ,GAAK,EAAE,CACjE,EAEME,EAAsB,IAAM,CACjCJ,EAAiB,IAClB,EAEMK,EAAoB,IAClBL,EAGFM,EAAgC,MAAOC,GAAwC,CACpF,MAAMC,EAAc,SAAS,cAAc,KAAK,EAC1CC,EAAa,MAAMZ,EAAc,yBAAyB,EAE1Da,EAAoBF,EAAY,aAAa,CAAE,KAAM,MAAO,CAAC,EAE7DG,EAAS,IAAI,cACnB,OAAAA,EAAO,YAAYf,CAAoB,EAEvCc,EAAkB,mBAAqB,CAACC,CAAM,EAC9CD,EAAkB,YAAcD,EAAW,QAAQX,EAAyBS,CAAK,EAE1EC,CACR,EAUMI,EAAoB,MAAOL,EAAeJ,IAAiB,CAChE,GAAII,EAAQR,EAAsB,CACjC,QAAQ,KAAK,yCAAyCQ,CAAK,gBAAgBR,CAAoB,GAAG,EAClG,MACD,CAEA,GAAI,CAACI,EAAE,aACN,OAGD,MAAMU,EAAoB,MAAMP,EAA8BC,CAAK,EAGnE,SAAS,KAAK,YAAYM,CAAiB,EAE3CV,EAAE,aAAa,aAAaU,EAAmB,EAAG,CAAC,EAGnD,sBAAsB,IAAM,CAC3BA,EAAkB,OAAO,CAC1B,CAAC,CACF,EAwBMC,EAAe,CACpB,kBAAAb,EACA,oBAAAG,EACA,kBAAAC,EACA,kBAAAO,CACD,EAEA,eAAeE,EACf,OACCF,KAAA",
|
|
6
|
+
"names": ["MultipleDragGhostCss", "getI18nBundle", "DRAG_DROP_MULTIPLE_TEXT", "MIN_MULTI_DRAG_COUNT", "draggedElement", "setDraggedElement", "element", "e", "clearDraggedElement", "getDraggedElement", "createDefaultMultiDragElement", "count", "dragElement", "i18nBundle", "dragElementShadow", "styles", "startMultipleDrag", "customDragElement", "DragRegistry"]
|
|
7
7
|
}
|
|
@@ -29,7 +29,7 @@ type MoveEventDetail = {
|
|
|
29
29
|
};
|
|
30
30
|
};
|
|
31
31
|
declare const DragRegistry: {
|
|
32
|
-
setDraggedElement: (element: HTMLElement | null) => void;
|
|
32
|
+
setDraggedElement: (element: HTMLElement | null, e?: DragEvent) => void;
|
|
33
33
|
clearDraggedElement: () => void;
|
|
34
34
|
getDraggedElement: () => HTMLElement | null;
|
|
35
35
|
startMultipleDrag: (count: number, e: DragEvent) => Promise<void>;
|
|
@@ -3,8 +3,12 @@ import { getI18nBundle } from "../../i18nBundle.js";
|
|
|
3
3
|
import { DRAG_DROP_MULTIPLE_TEXT, } from "../../generated/i18n/i18n-defaults.js";
|
|
4
4
|
const MIN_MULTI_DRAG_COUNT = 2;
|
|
5
5
|
let draggedElement = null;
|
|
6
|
-
const setDraggedElement = (element) => {
|
|
6
|
+
const setDraggedElement = (element, e) => {
|
|
7
7
|
draggedElement = element;
|
|
8
|
+
// Store the dragged element's ID in the dataTransfer object to ensure
|
|
9
|
+
// the drag operation is recognized across different browsers and contexts.
|
|
10
|
+
// Without this, Safari browser in iOS may not recognize the drag operation.
|
|
11
|
+
e?.dataTransfer?.setData("text/plain", element ? element.id : "");
|
|
8
12
|
};
|
|
9
13
|
const clearDraggedElement = () => {
|
|
10
14
|
draggedElement = null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DragRegistry.js","sourceRoot":"","sources":["../../../src/util/dragAndDrop/DragRegistry.ts"],"names":[],"mappings":"AACA,OAAO,oBAAoB,MAAM,8CAA8C,CAAC;AAEhF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EACN,uBAAuB,GACvB,MAAM,uCAAuC,CAAC;AAE/C,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAE/B,IAAI,cAAc,GAAuB,IAAI,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,CAAC,kBAAkB,GAAG,CAAC,MAAM,CAAC,CAAC;IAChD,iBAAiB,CAAC,WAAW,GAAG,UAAU,CAAC,OAAO,CAAC,uBAAuB,EAAE,KAAK,CAAC,CAAC;IAEnF,OAAO,WAAW,CAAC;AACpB,CAAC,CAAC;AAEF;;;;;;;GAOG;AACH,MAAM,iBAAiB,GAAG,KAAK,EAAE,KAAa,EAAE,CAAY,EAAE,EAAE;IAC/D,IAAI,KAAK,GAAG,oBAAoB,EAAE,CAAC;QAClC,OAAO,CAAC,IAAI,CAAC,yCAAyC,KAAK,gBAAgB,oBAAoB,GAAG,CAAC,CAAC,CAAC,sBAAsB;QAC3H,OAAO;IACR,CAAC;IAED,IAAI,CAAC,CAAC,CAAC,YAAY,EAAE,CAAC;QACrB,OAAO;IACR,CAAC;IAED,MAAM,iBAAiB,GAAG,MAAM,6BAA6B,CAAC,KAAK,CAAC,CAAC;IAErE,mCAAmC;IACnC,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,iBAAiB,CAAC,CAAC;IAE7C,CAAC,CAAC,YAAY,CAAC,YAAY,CAAC,iBAAiB,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IAErD,iEAAiE;IACjE,qBAAqB,CAAC,GAAG,EAAE;QAC1B,iBAAiB,CAAC,MAAM,EAAE,CAAC;IAC5B,CAAC,CAAC,CAAC;AACJ,CAAC,CAAC;AAwBF,MAAM,YAAY,GAAG;IACpB,iBAAiB;IACjB,mBAAmB;IACnB,iBAAiB;IACjB,iBAAiB;CACjB,CAAC;AAEF,eAAe,YAAY,CAAC;AAC5B,OAAO,EACN,iBAAiB,GACjB,CAAC","sourcesContent":["import type MovePlacement from \"../../types/MovePlacement.js\";\nimport MultipleDragGhostCss from \"../../generated/css/MultipleDragGhost.css.js\";\n\nimport { getI18nBundle } from \"../../i18nBundle.js\";\n\nimport {\n\tDRAG_DROP_MULTIPLE_TEXT,\n} from \"../../generated/i18n/i18n-defaults.js\";\n\nconst MIN_MULTI_DRAG_COUNT = 2;\n\nlet draggedElement: HTMLElement | null = null;\n\nconst setDraggedElement = (element: HTMLElement | null, e?: DragEvent) => {\n\tdraggedElement = element;\n\n\t// Store the dragged element's ID in the dataTransfer object to ensure\n\t// the drag operation is recognized across different browsers and contexts.\n\t// Without this, Safari browser in iOS may not recognize the drag operation.\n\te?.dataTransfer?.setData(\"text/plain\", element ? element.id : \"\");\n};\n\nconst clearDraggedElement = () => {\n\tdraggedElement = null;\n};\n\nconst getDraggedElement = () => {\n\treturn draggedElement;\n};\n\nconst createDefaultMultiDragElement = async (count: number): Promise<HTMLElement> => {\n\tconst dragElement = document.createElement(\"div\");\n\tconst i18nBundle = await getI18nBundle(\"@ui5/webcomponents-base\");\n\n\tconst dragElementShadow = dragElement.attachShadow({ mode: \"open\" });\n\n\tconst styles = new CSSStyleSheet();\n\tstyles.replaceSync(MultipleDragGhostCss);\n\n\tdragElementShadow.adoptedStyleSheets = [styles];\n\tdragElementShadow.textContent = i18nBundle.getText(DRAG_DROP_MULTIPLE_TEXT, count);\n\n\treturn dragElement;\n};\n\n/**\n * Starts a multiple drag operation by creating a drag ghost element.\n * The drag ghost will be displayed when dragging multiple items.\n *\n * @param {number} count - The number of items being dragged.\n * @param {DragEvent} e - The drag event that triggered the operation.\n * @public\n */\nconst startMultipleDrag = async (count: number, e: DragEvent) => {\n\tif (count < MIN_MULTI_DRAG_COUNT) {\n\t\tconsole.warn(`Cannot start multiple drag with count ${count}. Minimum is ${MIN_MULTI_DRAG_COUNT}.`); // eslint-disable-line\n\t\treturn;\n\t}\n\n\tif (!e.dataTransfer) {\n\t\treturn;\n\t}\n\n\tconst customDragElement = await createDefaultMultiDragElement(count);\n\n\t// Add to document body temporarily\n\tdocument.body.appendChild(customDragElement);\n\n\te.dataTransfer.setDragImage(customDragElement, 0, 0);\n\n\t// Clean up the temporary element after the drag operation starts\n\trequestAnimationFrame(() => {\n\t\tcustomDragElement.remove();\n\t});\n};\n\ntype DragAndDropSettings = {\n\t/**\n\t * Allow cross-browser and file drag and drop.\n\t */\n\tcrossDnD?: boolean;\n\t/**\n\t * Pass the original event in the event parameters.\n\t */\n\toriginalEvent?: boolean;\n};\n\ntype MoveEventDetail = {\n\toriginalEvent: Event,\n\tsource: {\n\t\telement: HTMLElement,\n\t},\n\tdestination: {\n\t\telement: HTMLElement,\n\t\tplacement: `${MovePlacement}`,\n\t}\n};\n\nconst DragRegistry = {\n\tsetDraggedElement,\n\tclearDraggedElement,\n\tgetDraggedElement,\n\tstartMultipleDrag,\n};\n\nexport default DragRegistry;\nexport {\n\tstartMultipleDrag,\n};\n\nexport type {\n\tDragAndDropSettings,\n\tMoveEventDetail,\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ui5/webcomponents-base",
|
|
3
|
-
"version": "2.20.0-rc.
|
|
3
|
+
"version": "2.20.0-rc.2",
|
|
4
4
|
"description": "UI5 Web Components: webcomponents.base",
|
|
5
5
|
"author": "SAP SE (https://www.sap.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"@openui5/sap.ui.core": "1.120.17",
|
|
65
65
|
"@sap-theming/theming-base-content": "11.33.0",
|
|
66
66
|
"@ui5/cypress-internal": "0.1.0",
|
|
67
|
-
"@ui5/webcomponents-tools": "2.20.0-rc.
|
|
67
|
+
"@ui5/webcomponents-tools": "2.20.0-rc.2",
|
|
68
68
|
"clean-css": "^5.2.2",
|
|
69
69
|
"cypress": "15.9.0",
|
|
70
70
|
"mocha": "^11.7.2",
|
|
@@ -75,5 +75,5 @@
|
|
|
75
75
|
"vite": "5.4.21"
|
|
76
76
|
},
|
|
77
77
|
"customElements": "dist/custom-elements.json",
|
|
78
|
-
"gitHead": "
|
|
78
|
+
"gitHead": "98b851b62424d1b81b69d58768924dc4a7a17096"
|
|
79
79
|
}
|