@mgdis/core-ui-helpers 1.0.1 → 1.0.3
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/.turbo/turbo-build.log +16 -16
- package/CHANGELOG.md +15 -0
- package/dist/angular/index.cjs.map +1 -1
- package/dist/angular/index.js.map +1 -1
- package/dist/angular/index.umd.js.map +1 -1
- package/dist/locale/index.cjs +1 -1
- package/dist/locale/index.cjs.map +1 -1
- package/dist/locale/index.js +1 -1
- package/dist/locale/index.js.map +1 -1
- package/dist/locale/index.umd.js +1 -1
- package/dist/locale/index.umd.js.map +1 -1
- package/dist/playwright/index.cjs.map +1 -1
- package/dist/playwright/index.js.map +1 -1
- package/dist/playwright/index.umd.js.map +1 -1
- package/dist/stencil/index.cjs +18 -1
- package/dist/stencil/index.cjs.map +1 -1
- package/dist/stencil/index.js +18 -1
- package/dist/stencil/index.js.map +1 -1
- package/dist/stencil/index.umd.js +18 -1
- package/dist/stencil/index.umd.js.map +1 -1
- package/dist/storybook/index.cjs +118 -46
- package/dist/storybook/index.cjs.map +1 -1
- package/dist/storybook/index.js +118 -46
- package/dist/storybook/index.js.map +1 -1
- package/dist/storybook/index.umd.js +118 -46
- package/dist/storybook/index.umd.js.map +1 -1
- package/dist/tests/index.cjs.map +1 -1
- package/dist/tests/index.js.map +1 -1
- package/dist/tests/index.umd.js.map +1 -1
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.umd.js.map +1 -1
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.js.map +1 -1
- package/dist/vue/index.umd.js.map +1 -1
- package/package.json +14 -14
- package/src/locale/locale.ts +1 -1
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
};
|
|
14
14
|
|
|
15
15
|
/*
|
|
16
|
-
Stencil Client Platform v4.
|
|
16
|
+
Stencil Client Platform v4.36.0 | MIT Licensed | https://stenciljs.com
|
|
17
17
|
*/
|
|
18
18
|
var __defProp = Object.defineProperty;
|
|
19
19
|
var __export = (target, all) => {
|
|
@@ -44,6 +44,11 @@
|
|
|
44
44
|
return o === "object" || o === "function";
|
|
45
45
|
};
|
|
46
46
|
|
|
47
|
+
// src/utils/regular-expression.ts
|
|
48
|
+
var escapeRegExpSpecialCharacters = (text) => {
|
|
49
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
50
|
+
};
|
|
51
|
+
|
|
47
52
|
// src/utils/result.ts
|
|
48
53
|
var result_exports = {};
|
|
49
54
|
__export(result_exports, {
|
|
@@ -168,7 +173,7 @@
|
|
|
168
173
|
const slotName = this["s-sn"];
|
|
169
174
|
if (opts == null ? void 0 : opts.flatten) {
|
|
170
175
|
console.error(`
|
|
171
|
-
Flattening is not supported for Stencil non-shadow slots.
|
|
176
|
+
Flattening is not supported for Stencil non-shadow slots.
|
|
172
177
|
You can use \`.childNodes\` to nested slot fallback content.
|
|
173
178
|
If you have a particular use case, please open an issue on the Stencil repo.
|
|
174
179
|
`);
|
|
@@ -258,6 +263,18 @@
|
|
|
258
263
|
};
|
|
259
264
|
var Host = {};
|
|
260
265
|
var isHost = (node) => node && node.$tag$ === Host;
|
|
266
|
+
var createSupportsRuleRe = (selector) => {
|
|
267
|
+
const safeSelector2 = escapeRegExpSpecialCharacters(selector);
|
|
268
|
+
return new RegExp(
|
|
269
|
+
// First capture group: match any context before the selector that's not inside @supports selector()
|
|
270
|
+
// Using negative lookahead to avoid matching inside @supports selector(...) condition
|
|
271
|
+
`(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${safeSelector2}))(${safeSelector2}\\b)`,
|
|
272
|
+
"g"
|
|
273
|
+
);
|
|
274
|
+
};
|
|
275
|
+
createSupportsRuleRe("::slotted");
|
|
276
|
+
createSupportsRuleRe(":host");
|
|
277
|
+
createSupportsRuleRe(":host-context");
|
|
261
278
|
var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
|
|
262
279
|
if (oldValue === newValue) {
|
|
263
280
|
return;
|
|
@@ -699,7 +716,7 @@
|
|
|
699
716
|
!isInitialRender && BUILD.updatable && oldChildren !== null
|
|
700
717
|
) {
|
|
701
718
|
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
702
|
-
}
|
|
719
|
+
} else ;
|
|
703
720
|
if (isSvgMode && tag === "svg") {
|
|
704
721
|
isSvgMode = false;
|
|
705
722
|
}
|
|
@@ -799,7 +816,8 @@
|
|
|
799
816
|
const hostElm = hostRef.$hostElement$;
|
|
800
817
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
801
818
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
802
|
-
const
|
|
819
|
+
const isHostElement = isHost(renderFnResults);
|
|
820
|
+
const rootVnode = isHostElement ? renderFnResults : h(null, null, renderFnResults);
|
|
803
821
|
hostTagName = hostElm.tagName;
|
|
804
822
|
if (cmpMeta.$attrsToReflect$) {
|
|
805
823
|
rootVnode.$attrs$ = rootVnode.$attrs$ || {};
|
|
@@ -929,6 +947,34 @@
|
|
|
929
947
|
'param', 'source', 'track', 'wbr'
|
|
930
948
|
];
|
|
931
949
|
|
|
950
|
+
/**
|
|
951
|
+
* @typedef {object} State
|
|
952
|
+
* @property {boolean} checked_html - If passed in HTML has been checked for HTML within it.
|
|
953
|
+
* @property {import("htmlfy").Config} config - Validated configuration.
|
|
954
|
+
* @property {boolean} ignored
|
|
955
|
+
*/
|
|
956
|
+
|
|
957
|
+
/**
|
|
958
|
+
* @type State
|
|
959
|
+
*/
|
|
960
|
+
const state = {
|
|
961
|
+
checked_html: false,
|
|
962
|
+
config: { ...CONFIG },
|
|
963
|
+
ignored: false
|
|
964
|
+
};
|
|
965
|
+
|
|
966
|
+
/**
|
|
967
|
+
*
|
|
968
|
+
* @returns {State}
|
|
969
|
+
*/
|
|
970
|
+
const getState = () => state;
|
|
971
|
+
|
|
972
|
+
/**
|
|
973
|
+
*
|
|
974
|
+
* @param {Partial<State>} new_state
|
|
975
|
+
*/
|
|
976
|
+
const setState = (new_state) => Object.assign(state, new_state);
|
|
977
|
+
|
|
932
978
|
/**
|
|
933
979
|
* Checks if content contains at least one HTML element or custom HTML element.
|
|
934
980
|
*
|
|
@@ -951,10 +997,13 @@
|
|
|
951
997
|
* @param {string} content Content to evaluate.
|
|
952
998
|
* @returns {boolean} A boolean.
|
|
953
999
|
*/
|
|
954
|
-
const isHtml = (content) =>
|
|
955
|
-
|
|
1000
|
+
const isHtml = (content) => {
|
|
1001
|
+
setState({ checked_html: true });
|
|
1002
|
+
|
|
1003
|
+
return /<(?:[A-Za-z]+[A-Za-z0-9]*)(?:\s+.*?)*?\/{0,1}>/.test(content) ||
|
|
956
1004
|
/<(?<Element>(?:[A-Za-z]+[A-Za-z0-9]*:)?(?:[A-Za-z]+[A-Za-z0-9]*))(?:\s+.*?)*?>(?:.|\n)*?<\/{1}\k<Element>>/.test(content) ||
|
|
957
|
-
/<(?<Element>(?:[a-z][a-z0-9._]*:)?[a-z][a-z0-9._]*-[a-z0-9._-]+)(?:\s+.*?)*?>(?:.|\n)*?<\/{1}\k<Element>>/.test(content)
|
|
1005
|
+
/<(?<Element>(?:[a-z][a-z0-9._]*:)?[a-z][a-z0-9._]*-[a-z0-9._-]+)(?:\s+.*?)*?>(?:.|\n)*?<\/{1}\k<Element>>/.test(content)
|
|
1006
|
+
};
|
|
958
1007
|
|
|
959
1008
|
/**
|
|
960
1009
|
* Generic utility which merges two objects.
|
|
@@ -992,16 +1041,14 @@
|
|
|
992
1041
|
/**
|
|
993
1042
|
* Merge a user config with the default config.
|
|
994
1043
|
*
|
|
995
|
-
* @param {import('htmlfy').Config}
|
|
1044
|
+
* @param {import('htmlfy').Config} default_config The default config.
|
|
996
1045
|
* @param {import('htmlfy').UserConfig} config The user config.
|
|
997
1046
|
* @returns {import('htmlfy').Config}
|
|
998
1047
|
*/
|
|
999
|
-
const mergeConfig = (
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
*/
|
|
1004
|
-
return mergeObjects(structuredClone(dconfig), config)
|
|
1048
|
+
const mergeConfig = (default_config, config) => {
|
|
1049
|
+
const validated_config = mergeObjects(default_config, config);
|
|
1050
|
+
setState({ config: validated_config });
|
|
1051
|
+
return validated_config
|
|
1005
1052
|
};
|
|
1006
1053
|
|
|
1007
1054
|
/**
|
|
@@ -1171,6 +1218,8 @@
|
|
|
1171
1218
|
*/
|
|
1172
1219
|
const validateConfig = (config) => {
|
|
1173
1220
|
if (typeof config !== 'object') throw new Error('Config must be an object.')
|
|
1221
|
+
|
|
1222
|
+
const default_config = { ...CONFIG };
|
|
1174
1223
|
|
|
1175
1224
|
const config_empty = !(
|
|
1176
1225
|
Object.hasOwn(config, 'content_wrap') ||
|
|
@@ -1183,7 +1232,10 @@
|
|
|
1183
1232
|
Object.hasOwn(config, 'trim')
|
|
1184
1233
|
);
|
|
1185
1234
|
|
|
1186
|
-
if (config_empty)
|
|
1235
|
+
if (config_empty) {
|
|
1236
|
+
setState({ config: default_config });
|
|
1237
|
+
return default_config
|
|
1238
|
+
}
|
|
1187
1239
|
|
|
1188
1240
|
let tab_size = config.tab_size;
|
|
1189
1241
|
|
|
@@ -1221,7 +1273,7 @@
|
|
|
1221
1273
|
if (config.tag_wrap_width)
|
|
1222
1274
|
config.tag_wrap = config.tag_wrap_width;
|
|
1223
1275
|
else
|
|
1224
|
-
config.tag_wrap =
|
|
1276
|
+
config.tag_wrap = default_config.tag_wrap_width;
|
|
1225
1277
|
}
|
|
1226
1278
|
|
|
1227
1279
|
if (Object.hasOwn(config, 'tag_wrap') && typeof config.tag_wrap !== 'number')
|
|
@@ -1238,7 +1290,7 @@
|
|
|
1238
1290
|
if (Object.hasOwn(config, 'trim') && (!Array.isArray(config.trim) || !config.trim?.every((e) => typeof e === 'string')))
|
|
1239
1291
|
throw new Error('Trim config must be an array of strings.')
|
|
1240
1292
|
|
|
1241
|
-
return mergeConfig(
|
|
1293
|
+
return mergeConfig(default_config, config)
|
|
1242
1294
|
|
|
1243
1295
|
};
|
|
1244
1296
|
|
|
@@ -1307,6 +1359,7 @@
|
|
|
1307
1359
|
* @returns {{ html_with_markers: string, extracted_map: Map<any,any> }}
|
|
1308
1360
|
*/
|
|
1309
1361
|
function extractIgnoredBlocks(html, config) {
|
|
1362
|
+
setState({ ignored: true });
|
|
1310
1363
|
let current_html = html;
|
|
1311
1364
|
const extracted_blocks = new Map();
|
|
1312
1365
|
let marker_id = 0;
|
|
@@ -1354,6 +1407,7 @@
|
|
|
1354
1407
|
* @returns
|
|
1355
1408
|
*/
|
|
1356
1409
|
function reinsertIgnoredBlocks(html_with_markers, extracted_map) {
|
|
1410
|
+
setState({ ignored: false });
|
|
1357
1411
|
let final_html = html_with_markers;
|
|
1358
1412
|
|
|
1359
1413
|
for (const [marker, original_block] of extracted_map) {
|
|
@@ -1366,12 +1420,13 @@
|
|
|
1366
1420
|
* Ensure void elements are "self-closing".
|
|
1367
1421
|
*
|
|
1368
1422
|
* @param {string} html The HTML string to evaluate.
|
|
1369
|
-
* @param {boolean} check_html Check to see if the content contains any HTML, before processing.
|
|
1370
1423
|
* @returns {string}
|
|
1371
1424
|
* @example <br> => <br />
|
|
1372
1425
|
*/
|
|
1373
|
-
const closify = (html
|
|
1374
|
-
|
|
1426
|
+
const closify = (html) => {
|
|
1427
|
+
const { checked_html } = getState();
|
|
1428
|
+
|
|
1429
|
+
if (!checked_html && !isHtml(html)) return html
|
|
1375
1430
|
|
|
1376
1431
|
return html.replace(/<([a-zA-Z\-0-9:]+)[^>]*>/g, (match, name) => {
|
|
1377
1432
|
if (VOID_ELEMENTS.indexOf(name) > -1)
|
|
@@ -1436,16 +1491,35 @@
|
|
|
1436
1491
|
return html
|
|
1437
1492
|
};
|
|
1438
1493
|
|
|
1494
|
+
/**
|
|
1495
|
+
* @type {Map<any,any>}
|
|
1496
|
+
*/
|
|
1497
|
+
let ignore_map$1;
|
|
1498
|
+
|
|
1439
1499
|
/**
|
|
1440
1500
|
* Creates a single-line HTML string
|
|
1441
1501
|
* by removing line returns, tabs, and relevant spaces.
|
|
1442
1502
|
*
|
|
1443
1503
|
* @param {string} html The HTML string to minify.
|
|
1444
|
-
* @param {
|
|
1504
|
+
* @param {import('htmlfy').UserConfig} [config] A user configuration object.
|
|
1445
1505
|
* @returns {string} A minified HTML string.
|
|
1446
1506
|
*/
|
|
1447
|
-
const minify = (html,
|
|
1448
|
-
|
|
1507
|
+
const minify = (html, config) => {
|
|
1508
|
+
let reinsert_ignored = false;
|
|
1509
|
+
const { checked_html, ignored } = getState();
|
|
1510
|
+
|
|
1511
|
+
if (!checked_html && !isHtml(html)) return html
|
|
1512
|
+
|
|
1513
|
+
const validated_config = (getState()).config;
|
|
1514
|
+
const ignore = validated_config.ignore.length > 0;
|
|
1515
|
+
|
|
1516
|
+
/* Extract ignored elements. Skipped if prettify has already ignored blocks. */
|
|
1517
|
+
if (!ignored && ignore) {
|
|
1518
|
+
const { html_with_markers, extracted_map } = extractIgnoredBlocks(html, validated_config);
|
|
1519
|
+
html = html_with_markers;
|
|
1520
|
+
ignore_map$1 = extracted_map;
|
|
1521
|
+
reinsert_ignored = true;
|
|
1522
|
+
}
|
|
1449
1523
|
|
|
1450
1524
|
/**
|
|
1451
1525
|
* Ensure textarea content is specially minified and protected
|
|
@@ -1488,19 +1562,14 @@
|
|
|
1488
1562
|
// Final trim for the whole string
|
|
1489
1563
|
html = html.trim();
|
|
1490
1564
|
|
|
1565
|
+
/* Re-insert ignored elements. Skipped unless minify did the ignore. */
|
|
1566
|
+
if (reinsert_ignored) {
|
|
1567
|
+
html = reinsertIgnoredBlocks(html, ignore_map$1);
|
|
1568
|
+
}
|
|
1569
|
+
|
|
1491
1570
|
return html
|
|
1492
1571
|
};
|
|
1493
1572
|
|
|
1494
|
-
/**
|
|
1495
|
-
* @type {boolean}
|
|
1496
|
-
*/
|
|
1497
|
-
let strict;
|
|
1498
|
-
|
|
1499
|
-
/**
|
|
1500
|
-
* @type {string[]}
|
|
1501
|
-
*/
|
|
1502
|
-
let trim;
|
|
1503
|
-
|
|
1504
1573
|
/**
|
|
1505
1574
|
* @type {{ line: Record<string,string>[] }}
|
|
1506
1575
|
*/
|
|
@@ -1551,11 +1620,13 @@
|
|
|
1551
1620
|
* @returns {string}
|
|
1552
1621
|
*/
|
|
1553
1622
|
const preprocess = (html) => {
|
|
1554
|
-
html = closify(html
|
|
1623
|
+
html = closify(html);
|
|
1555
1624
|
|
|
1556
|
-
|
|
1625
|
+
const { config } = getState();
|
|
1557
1626
|
|
|
1558
|
-
html =
|
|
1627
|
+
if (config.trim.length > 0) html = trimify(html, config.trim);
|
|
1628
|
+
|
|
1629
|
+
html = minify(html);
|
|
1559
1630
|
html = enqueue(html);
|
|
1560
1631
|
|
|
1561
1632
|
return html
|
|
@@ -1563,16 +1634,16 @@
|
|
|
1563
1634
|
|
|
1564
1635
|
/**
|
|
1565
1636
|
*
|
|
1566
|
-
* @param {string} html The HTML string to process.
|
|
1567
1637
|
* @param {import('htmlfy').Config} config
|
|
1568
1638
|
* @returns {string}
|
|
1569
1639
|
*/
|
|
1570
|
-
const process = (
|
|
1640
|
+
const process = (config) => {
|
|
1571
1641
|
const step = " ".repeat(config.tab_size);
|
|
1572
1642
|
const tag_wrap = config.tag_wrap;
|
|
1573
1643
|
const content_wrap = config.content_wrap;
|
|
1574
1644
|
const ignore_with = config.ignore_with;
|
|
1575
1645
|
const placeholder_template = `-${ignore_with}`;
|
|
1646
|
+
const strict = config.strict;
|
|
1576
1647
|
|
|
1577
1648
|
/* Track current number of indentations needed. */
|
|
1578
1649
|
let indents = '';
|
|
@@ -1744,33 +1815,34 @@
|
|
|
1744
1815
|
* @returns {string} A well-formed HTML string.
|
|
1745
1816
|
*/
|
|
1746
1817
|
const prettify = (html, config) => {
|
|
1747
|
-
|
|
1748
|
-
|
|
1818
|
+
let reinsert_ignored = false;
|
|
1819
|
+
const { checked_html, ignored } = getState();
|
|
1749
1820
|
|
|
1750
|
-
|
|
1751
|
-
|
|
1821
|
+
/* Return content as-is if it does not contain any HTML elements. */
|
|
1822
|
+
if (!checked_html && !isHtml(html)) return html
|
|
1752
1823
|
|
|
1824
|
+
const validated_config = config ? validateConfig(config) : { ...CONFIG };
|
|
1753
1825
|
const ignore = validated_config.ignore.length > 0;
|
|
1754
|
-
trim = validated_config.trim;
|
|
1755
1826
|
|
|
1756
1827
|
/* Extract ignored elements. */
|
|
1757
|
-
if (ignore) {
|
|
1828
|
+
if (!ignored && ignore) {
|
|
1758
1829
|
const { html_with_markers, extracted_map } = extractIgnoredBlocks(html, validated_config);
|
|
1759
1830
|
html = html_with_markers;
|
|
1760
1831
|
ignore_map = extracted_map;
|
|
1832
|
+
reinsert_ignored = true;
|
|
1761
1833
|
}
|
|
1762
1834
|
|
|
1763
1835
|
/* Preserve html text within attribute values. */
|
|
1764
1836
|
html = setIgnoreAttribute(html);
|
|
1765
1837
|
|
|
1766
1838
|
html = preprocess(html);
|
|
1767
|
-
html = process(
|
|
1839
|
+
html = process(validated_config);
|
|
1768
1840
|
|
|
1769
1841
|
/* Revert html text within attribute values. */
|
|
1770
1842
|
html = unsetIgnoreAttribute(html);
|
|
1771
1843
|
|
|
1772
1844
|
/* Re-insert ignored elements. */
|
|
1773
|
-
if (
|
|
1845
|
+
if (reinsert_ignored) {
|
|
1774
1846
|
html = reinsertIgnoredBlocks(html, ignore_map);
|
|
1775
1847
|
}
|
|
1776
1848
|
|