@veeqo/ui 12.3.0 → 12.3.1
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/dist/components/Anchor/utils/urlUtils.cjs +8 -1
- package/dist/components/Anchor/utils/urlUtils.cjs.map +1 -1
- package/dist/components/Anchor/utils/urlUtils.d.ts +6 -0
- package/dist/components/Anchor/utils/urlUtils.js +8 -2
- package/dist/components/Anchor/utils/urlUtils.js.map +1 -1
- package/package.json +1 -1
|
@@ -22,6 +22,12 @@ const isRelativeUrl = (url) => !url.match(/^(https?:\/\/|\/\/)/);
|
|
|
22
22
|
* @returns {boolean} Whether the URL is an anchor link
|
|
23
23
|
*/
|
|
24
24
|
const isAnchorUrl = (url) => url.startsWith('#');
|
|
25
|
+
/**
|
|
26
|
+
* Checks if a URL is a mailto link (starts with mailto)
|
|
27
|
+
* @param {string} url - The URL to check
|
|
28
|
+
* @returns {boolean} Whether the URL is an anchor link
|
|
29
|
+
*/
|
|
30
|
+
const isMailtoUrl = (url) => url.startsWith('mailto:');
|
|
25
31
|
/**
|
|
26
32
|
* Adds the appropriate prefix to a URL based on the current context
|
|
27
33
|
* @param {string} url - The URL to add a prefix to
|
|
@@ -36,7 +42,7 @@ const addPrefixToUrl = (url) => { var _a; return `${((_a = window.veeqoContext)
|
|
|
36
42
|
const createContextAwareUrl = (url) => {
|
|
37
43
|
if (!url)
|
|
38
44
|
return '';
|
|
39
|
-
if (isAnchorUrl(url) || !shouldAddPrefix() || !isRelativeUrl(url))
|
|
45
|
+
if (isMailtoUrl(url) || isAnchorUrl(url) || !shouldAddPrefix() || !isRelativeUrl(url))
|
|
40
46
|
return url;
|
|
41
47
|
return addPrefixToUrl(url);
|
|
42
48
|
};
|
|
@@ -44,6 +50,7 @@ const createContextAwareUrl = (url) => {
|
|
|
44
50
|
exports.addPrefixToUrl = addPrefixToUrl;
|
|
45
51
|
exports.createContextAwareUrl = createContextAwareUrl;
|
|
46
52
|
exports.isAnchorUrl = isAnchorUrl;
|
|
53
|
+
exports.isMailtoUrl = isMailtoUrl;
|
|
47
54
|
exports.isRelativeUrl = isRelativeUrl;
|
|
48
55
|
exports.shouldAddPrefix = shouldAddPrefix;
|
|
49
56
|
//# sourceMappingURL=urlUtils.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urlUtils.cjs","sources":["../../../../src/components/Anchor/utils/urlUtils.ts"],"sourcesContent":["/**\n * Utility functions for URL processing\n */\n\n/**\n * Checks if the URL should have a prefix added based on the current context\n * @returns {boolean} Whether a prefix should be added\n */\nexport const shouldAddPrefix = (): boolean =>\n !!(\n window.veeqoContext &&\n window.veeqoContext.vqHost !== 'standalone' &&\n window.veeqoContext.baseUrl\n );\n\n/**\n * Checks if a URL is relative (not starting with http://, https://, or //)\n * @param {string} url - The URL to check\n * @returns {boolean} Whether the URL is relative\n */\nexport const isRelativeUrl = (url: string): boolean => !url.match(/^(https?:\\/\\/|\\/\\/)/);\n\n/**\n * Checks if a URL is an anchor link (starts with #)\n * @param {string} url - The URL to check\n * @returns {boolean} Whether the URL is an anchor link\n */\nexport const isAnchorUrl = (url: string): boolean => url.startsWith('#');\n\n/**\n * Adds the appropriate prefix to a URL based on the current context\n * @param {string} url - The URL to add a prefix to\n * @returns {string} The URL with prefix added if needed\n */\nexport const addPrefixToUrl = (url: string): string =>\n `${window.veeqoContext?.baseUrl || ''}${url.startsWith('/') ? '' : '/'}${url}`;\n\n/**\n * Processes a URL by adding the appropriate prefix if needed\n * @param {string} url - The URL to process\n * @returns {string} The processed URL\n */\nexport const createContextAwareUrl = (url: string | undefined | null): string => {\n if (!url) return '';\n if (isAnchorUrl(url) || !shouldAddPrefix() || !isRelativeUrl(url)) return url;\n\n return addPrefixToUrl(url);\n};\n"],"names":[],"mappings":";;AAAA;;AAEG;AAEH;;;AAGG;AACI,MAAM,eAAe,GAAG,MAC7B,CAAC,EACC,MAAM,CAAC,YAAY;AACnB,IAAA,MAAM,CAAC,YAAY,CAAC,MAAM,KAAK,YAAY;AAC3C,IAAA,MAAM,CAAC,YAAY,CAAC,OAAO;AAG/B;;;;AAIG;AACU,MAAA,aAAa,GAAG,CAAC,GAAW,KAAc,CAAC,GAAG,CAAC,KAAK,CAAC,qBAAqB;AAEvF;;;;AAIG;AACI,MAAM,WAAW,GAAG,CAAC,GAAW,KAAc,GAAG,CAAC,UAAU,CAAC,GAAG;AAEvE;;;;AAIG;AACU,MAAA,cAAc,GAAG,CAAC,GAAW,KAAY,EAAA,IAAA,EAAA,CAAA,CACpD,OAAA,CAAA,EAAG,CAAA,CAAA,EAAA,GAAA,MAAM,CAAC,YAAY,MAAA,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAE,OAAO,KAAI,EAAE,CAAG,EAAA,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,CAAA,EAAG,GAAG,CAAE,CAAA,CAAA;AAEhF;;;;AAIG;AACU,MAAA,qBAAqB,GAAG,CAAC,GAA8B,KAAY;AAC9E,IAAA,IAAI,CAAC,GAAG;AAAE,QAAA,OAAO,EAAE;AACnB,IAAA,IAAI,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC;AAAE,QAAA,OAAO,GAAG;
|
|
1
|
+
{"version":3,"file":"urlUtils.cjs","sources":["../../../../src/components/Anchor/utils/urlUtils.ts"],"sourcesContent":["/**\n * Utility functions for URL processing\n */\n\n/**\n * Checks if the URL should have a prefix added based on the current context\n * @returns {boolean} Whether a prefix should be added\n */\nexport const shouldAddPrefix = (): boolean =>\n !!(\n window.veeqoContext &&\n window.veeqoContext.vqHost !== 'standalone' &&\n window.veeqoContext.baseUrl\n );\n\n/**\n * Checks if a URL is relative (not starting with http://, https://, or //)\n * @param {string} url - The URL to check\n * @returns {boolean} Whether the URL is relative\n */\nexport const isRelativeUrl = (url: string): boolean => !url.match(/^(https?:\\/\\/|\\/\\/)/);\n\n/**\n * Checks if a URL is an anchor link (starts with #)\n * @param {string} url - The URL to check\n * @returns {boolean} Whether the URL is an anchor link\n */\nexport const isAnchorUrl = (url: string): boolean => url.startsWith('#');\n\n/**\n * Checks if a URL is a mailto link (starts with mailto)\n * @param {string} url - The URL to check\n * @returns {boolean} Whether the URL is an anchor link\n */\nexport const isMailtoUrl = (url: string): boolean => url.startsWith('mailto:');\n\n/**\n * Adds the appropriate prefix to a URL based on the current context\n * @param {string} url - The URL to add a prefix to\n * @returns {string} The URL with prefix added if needed\n */\nexport const addPrefixToUrl = (url: string): string =>\n `${window.veeqoContext?.baseUrl || ''}${url.startsWith('/') ? '' : '/'}${url}`;\n\n/**\n * Processes a URL by adding the appropriate prefix if needed\n * @param {string} url - The URL to process\n * @returns {string} The processed URL\n */\nexport const createContextAwareUrl = (url: string | undefined | null): string => {\n if (!url) return '';\n if (isMailtoUrl(url) || isAnchorUrl(url) || !shouldAddPrefix() || !isRelativeUrl(url)) return url;\n\n return addPrefixToUrl(url);\n};\n"],"names":[],"mappings":";;AAAA;;AAEG;AAEH;;;AAGG;AACI,MAAM,eAAe,GAAG,MAC7B,CAAC,EACC,MAAM,CAAC,YAAY;AACnB,IAAA,MAAM,CAAC,YAAY,CAAC,MAAM,KAAK,YAAY;AAC3C,IAAA,MAAM,CAAC,YAAY,CAAC,OAAO;AAG/B;;;;AAIG;AACU,MAAA,aAAa,GAAG,CAAC,GAAW,KAAc,CAAC,GAAG,CAAC,KAAK,CAAC,qBAAqB;AAEvF;;;;AAIG;AACI,MAAM,WAAW,GAAG,CAAC,GAAW,KAAc,GAAG,CAAC,UAAU,CAAC,GAAG;AAEvE;;;;AAIG;AACI,MAAM,WAAW,GAAG,CAAC,GAAW,KAAc,GAAG,CAAC,UAAU,CAAC,SAAS;AAE7E;;;;AAIG;AACU,MAAA,cAAc,GAAG,CAAC,GAAW,KAAY,EAAA,IAAA,EAAA,CAAA,CACpD,OAAA,CAAA,EAAG,CAAA,CAAA,EAAA,GAAA,MAAM,CAAC,YAAY,MAAA,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAE,OAAO,KAAI,EAAE,CAAG,EAAA,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,CAAA,EAAG,GAAG,CAAE,CAAA,CAAA;AAEhF;;;;AAIG;AACU,MAAA,qBAAqB,GAAG,CAAC,GAA8B,KAAY;AAC9E,IAAA,IAAI,CAAC,GAAG;AAAE,QAAA,OAAO,EAAE;AACnB,IAAA,IAAI,WAAW,CAAC,GAAG,CAAC,IAAI,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC;AAAE,QAAA,OAAO,GAAG;AAEjG,IAAA,OAAO,cAAc,CAAC,GAAG,CAAC;AAC5B;;;;;;;;;"}
|
|
@@ -18,6 +18,12 @@ export declare const isRelativeUrl: (url: string) => boolean;
|
|
|
18
18
|
* @returns {boolean} Whether the URL is an anchor link
|
|
19
19
|
*/
|
|
20
20
|
export declare const isAnchorUrl: (url: string) => boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Checks if a URL is a mailto link (starts with mailto)
|
|
23
|
+
* @param {string} url - The URL to check
|
|
24
|
+
* @returns {boolean} Whether the URL is an anchor link
|
|
25
|
+
*/
|
|
26
|
+
export declare const isMailtoUrl: (url: string) => boolean;
|
|
21
27
|
/**
|
|
22
28
|
* Adds the appropriate prefix to a URL based on the current context
|
|
23
29
|
* @param {string} url - The URL to add a prefix to
|
|
@@ -20,6 +20,12 @@ const isRelativeUrl = (url) => !url.match(/^(https?:\/\/|\/\/)/);
|
|
|
20
20
|
* @returns {boolean} Whether the URL is an anchor link
|
|
21
21
|
*/
|
|
22
22
|
const isAnchorUrl = (url) => url.startsWith('#');
|
|
23
|
+
/**
|
|
24
|
+
* Checks if a URL is a mailto link (starts with mailto)
|
|
25
|
+
* @param {string} url - The URL to check
|
|
26
|
+
* @returns {boolean} Whether the URL is an anchor link
|
|
27
|
+
*/
|
|
28
|
+
const isMailtoUrl = (url) => url.startsWith('mailto:');
|
|
23
29
|
/**
|
|
24
30
|
* Adds the appropriate prefix to a URL based on the current context
|
|
25
31
|
* @param {string} url - The URL to add a prefix to
|
|
@@ -34,10 +40,10 @@ const addPrefixToUrl = (url) => { var _a; return `${((_a = window.veeqoContext)
|
|
|
34
40
|
const createContextAwareUrl = (url) => {
|
|
35
41
|
if (!url)
|
|
36
42
|
return '';
|
|
37
|
-
if (isAnchorUrl(url) || !shouldAddPrefix() || !isRelativeUrl(url))
|
|
43
|
+
if (isMailtoUrl(url) || isAnchorUrl(url) || !shouldAddPrefix() || !isRelativeUrl(url))
|
|
38
44
|
return url;
|
|
39
45
|
return addPrefixToUrl(url);
|
|
40
46
|
};
|
|
41
47
|
|
|
42
|
-
export { addPrefixToUrl, createContextAwareUrl, isAnchorUrl, isRelativeUrl, shouldAddPrefix };
|
|
48
|
+
export { addPrefixToUrl, createContextAwareUrl, isAnchorUrl, isMailtoUrl, isRelativeUrl, shouldAddPrefix };
|
|
43
49
|
//# sourceMappingURL=urlUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"urlUtils.js","sources":["../../../../src/components/Anchor/utils/urlUtils.ts"],"sourcesContent":["/**\n * Utility functions for URL processing\n */\n\n/**\n * Checks if the URL should have a prefix added based on the current context\n * @returns {boolean} Whether a prefix should be added\n */\nexport const shouldAddPrefix = (): boolean =>\n !!(\n window.veeqoContext &&\n window.veeqoContext.vqHost !== 'standalone' &&\n window.veeqoContext.baseUrl\n );\n\n/**\n * Checks if a URL is relative (not starting with http://, https://, or //)\n * @param {string} url - The URL to check\n * @returns {boolean} Whether the URL is relative\n */\nexport const isRelativeUrl = (url: string): boolean => !url.match(/^(https?:\\/\\/|\\/\\/)/);\n\n/**\n * Checks if a URL is an anchor link (starts with #)\n * @param {string} url - The URL to check\n * @returns {boolean} Whether the URL is an anchor link\n */\nexport const isAnchorUrl = (url: string): boolean => url.startsWith('#');\n\n/**\n * Adds the appropriate prefix to a URL based on the current context\n * @param {string} url - The URL to add a prefix to\n * @returns {string} The URL with prefix added if needed\n */\nexport const addPrefixToUrl = (url: string): string =>\n `${window.veeqoContext?.baseUrl || ''}${url.startsWith('/') ? '' : '/'}${url}`;\n\n/**\n * Processes a URL by adding the appropriate prefix if needed\n * @param {string} url - The URL to process\n * @returns {string} The processed URL\n */\nexport const createContextAwareUrl = (url: string | undefined | null): string => {\n if (!url) return '';\n if (isAnchorUrl(url) || !shouldAddPrefix() || !isRelativeUrl(url)) return url;\n\n return addPrefixToUrl(url);\n};\n"],"names":[],"mappings":"AAAA;;AAEG;AAEH;;;AAGG;AACI,MAAM,eAAe,GAAG,MAC7B,CAAC,EACC,MAAM,CAAC,YAAY;AACnB,IAAA,MAAM,CAAC,YAAY,CAAC,MAAM,KAAK,YAAY;AAC3C,IAAA,MAAM,CAAC,YAAY,CAAC,OAAO;AAG/B;;;;AAIG;AACU,MAAA,aAAa,GAAG,CAAC,GAAW,KAAc,CAAC,GAAG,CAAC,KAAK,CAAC,qBAAqB;AAEvF;;;;AAIG;AACI,MAAM,WAAW,GAAG,CAAC,GAAW,KAAc,GAAG,CAAC,UAAU,CAAC,GAAG;AAEvE;;;;AAIG;AACU,MAAA,cAAc,GAAG,CAAC,GAAW,KAAY,EAAA,IAAA,EAAA,CAAA,CACpD,OAAA,CAAA,EAAG,CAAA,CAAA,EAAA,GAAA,MAAM,CAAC,YAAY,MAAA,IAAA,IAAA,EAAA,KAAA,SAAA,GAAA,SAAA,GAAA,EAAA,CAAE,OAAO,KAAI,EAAE,CAAG,EAAA,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,GAAG,CAAA,EAAG,GAAG,CAAE,CAAA,CAAA;AAEhF;;;;AAIG;AACU,MAAA,qBAAqB,GAAG,CAAC,GAA8B,KAAY;AAC9E,IAAA,IAAI,CAAC,GAAG;AAAE,QAAA,OAAO,EAAE;AACnB,IAAA,IAAI,WAAW,CAAC,GAAG,CAAC,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC;AAAE,QAAA,OAAO,GAAG;
|
|
1
|
+
{"version":3,"file":"urlUtils.js","sources":["../../../../src/components/Anchor/utils/urlUtils.ts"],"sourcesContent":["/**\n * Utility functions for URL processing\n */\n\n/**\n * Checks if the URL should have a prefix added based on the current context\n * @returns {boolean} Whether a prefix should be added\n */\nexport const shouldAddPrefix = (): boolean =>\n !!(\n window.veeqoContext &&\n window.veeqoContext.vqHost !== 'standalone' &&\n window.veeqoContext.baseUrl\n );\n\n/**\n * Checks if a URL is relative (not starting with http://, https://, or //)\n * @param {string} url - The URL to check\n * @returns {boolean} Whether the URL is relative\n */\nexport const isRelativeUrl = (url: string): boolean => !url.match(/^(https?:\\/\\/|\\/\\/)/);\n\n/**\n * Checks if a URL is an anchor link (starts with #)\n * @param {string} url - The URL to check\n * @returns {boolean} Whether the URL is an anchor link\n */\nexport const isAnchorUrl = (url: string): boolean => url.startsWith('#');\n\n/**\n * Checks if a URL is a mailto link (starts with mailto)\n * @param {string} url - The URL to check\n * @returns {boolean} Whether the URL is an anchor link\n */\nexport const isMailtoUrl = (url: string): boolean => url.startsWith('mailto:');\n\n/**\n * Adds the appropriate prefix to a URL based on the current context\n * @param {string} url - The URL to add a prefix to\n * @returns {string} The URL with prefix added if needed\n */\nexport const addPrefixToUrl = (url: string): string =>\n `${window.veeqoContext?.baseUrl || ''}${url.startsWith('/') ? '' : '/'}${url}`;\n\n/**\n * Processes a URL by adding the appropriate prefix if needed\n * @param {string} url - The URL to process\n * @returns {string} The processed URL\n */\nexport const createContextAwareUrl = (url: string | undefined | null): string => {\n if (!url) return '';\n if (isMailtoUrl(url) || isAnchorUrl(url) || !shouldAddPrefix() || !isRelativeUrl(url)) return url;\n\n return addPrefixToUrl(url);\n};\n"],"names":[],"mappings":"AAAA;;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