@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
package/dist/storybook/index.cjs
CHANGED
|
@@ -9,7 +9,7 @@ var BUILD = {
|
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
/*
|
|
12
|
-
Stencil Client Platform v4.
|
|
12
|
+
Stencil Client Platform v4.36.0 | MIT Licensed | https://stenciljs.com
|
|
13
13
|
*/
|
|
14
14
|
var __defProp = Object.defineProperty;
|
|
15
15
|
var __export = (target, all) => {
|
|
@@ -40,6 +40,11 @@ var isComplexType = (o) => {
|
|
|
40
40
|
return o === "object" || o === "function";
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
+
// src/utils/regular-expression.ts
|
|
44
|
+
var escapeRegExpSpecialCharacters = (text) => {
|
|
45
|
+
return text.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
46
|
+
};
|
|
47
|
+
|
|
43
48
|
// src/utils/result.ts
|
|
44
49
|
var result_exports = {};
|
|
45
50
|
__export(result_exports, {
|
|
@@ -164,7 +169,7 @@ function patchSlotNode(node) {
|
|
|
164
169
|
const slotName = this["s-sn"];
|
|
165
170
|
if (opts == null ? void 0 : opts.flatten) {
|
|
166
171
|
console.error(`
|
|
167
|
-
Flattening is not supported for Stencil non-shadow slots.
|
|
172
|
+
Flattening is not supported for Stencil non-shadow slots.
|
|
168
173
|
You can use \`.childNodes\` to nested slot fallback content.
|
|
169
174
|
If you have a particular use case, please open an issue on the Stencil repo.
|
|
170
175
|
`);
|
|
@@ -254,6 +259,18 @@ var newVNode = (tag, text) => {
|
|
|
254
259
|
};
|
|
255
260
|
var Host = {};
|
|
256
261
|
var isHost = (node) => node && node.$tag$ === Host;
|
|
262
|
+
var createSupportsRuleRe = (selector) => {
|
|
263
|
+
const safeSelector2 = escapeRegExpSpecialCharacters(selector);
|
|
264
|
+
return new RegExp(
|
|
265
|
+
// First capture group: match any context before the selector that's not inside @supports selector()
|
|
266
|
+
// Using negative lookahead to avoid matching inside @supports selector(...) condition
|
|
267
|
+
`(^|[^@]|@(?!supports\\s+selector\\s*\\([^{]*?${safeSelector2}))(${safeSelector2}\\b)`,
|
|
268
|
+
"g"
|
|
269
|
+
);
|
|
270
|
+
};
|
|
271
|
+
createSupportsRuleRe("::slotted");
|
|
272
|
+
createSupportsRuleRe(":host");
|
|
273
|
+
createSupportsRuleRe(":host-context");
|
|
257
274
|
var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRender) => {
|
|
258
275
|
if (oldValue === newValue) {
|
|
259
276
|
return;
|
|
@@ -695,7 +712,7 @@ var patch = (oldVNode, newVNode2, isInitialRender = false) => {
|
|
|
695
712
|
!isInitialRender && BUILD.updatable && oldChildren !== null
|
|
696
713
|
) {
|
|
697
714
|
removeVnodes(oldChildren, 0, oldChildren.length - 1);
|
|
698
|
-
}
|
|
715
|
+
} else ;
|
|
699
716
|
if (isSvgMode && tag === "svg") {
|
|
700
717
|
isSvgMode = false;
|
|
701
718
|
}
|
|
@@ -795,7 +812,8 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
|
795
812
|
const hostElm = hostRef.$hostElement$;
|
|
796
813
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
797
814
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
798
|
-
const
|
|
815
|
+
const isHostElement = isHost(renderFnResults);
|
|
816
|
+
const rootVnode = isHostElement ? renderFnResults : h(null, null, renderFnResults);
|
|
799
817
|
hostTagName = hostElm.tagName;
|
|
800
818
|
if (cmpMeta.$attrsToReflect$) {
|
|
801
819
|
rootVnode.$attrs$ = rootVnode.$attrs$ || {};
|
|
@@ -925,6 +943,34 @@ const VOID_ELEMENTS = [
|
|
|
925
943
|
'param', 'source', 'track', 'wbr'
|
|
926
944
|
];
|
|
927
945
|
|
|
946
|
+
/**
|
|
947
|
+
* @typedef {object} State
|
|
948
|
+
* @property {boolean} checked_html - If passed in HTML has been checked for HTML within it.
|
|
949
|
+
* @property {import("htmlfy").Config} config - Validated configuration.
|
|
950
|
+
* @property {boolean} ignored
|
|
951
|
+
*/
|
|
952
|
+
|
|
953
|
+
/**
|
|
954
|
+
* @type State
|
|
955
|
+
*/
|
|
956
|
+
const state = {
|
|
957
|
+
checked_html: false,
|
|
958
|
+
config: { ...CONFIG },
|
|
959
|
+
ignored: false
|
|
960
|
+
};
|
|
961
|
+
|
|
962
|
+
/**
|
|
963
|
+
*
|
|
964
|
+
* @returns {State}
|
|
965
|
+
*/
|
|
966
|
+
const getState = () => state;
|
|
967
|
+
|
|
968
|
+
/**
|
|
969
|
+
*
|
|
970
|
+
* @param {Partial<State>} new_state
|
|
971
|
+
*/
|
|
972
|
+
const setState = (new_state) => Object.assign(state, new_state);
|
|
973
|
+
|
|
928
974
|
/**
|
|
929
975
|
* Checks if content contains at least one HTML element or custom HTML element.
|
|
930
976
|
*
|
|
@@ -947,10 +993,13 @@ const VOID_ELEMENTS = [
|
|
|
947
993
|
* @param {string} content Content to evaluate.
|
|
948
994
|
* @returns {boolean} A boolean.
|
|
949
995
|
*/
|
|
950
|
-
const isHtml = (content) =>
|
|
951
|
-
|
|
996
|
+
const isHtml = (content) => {
|
|
997
|
+
setState({ checked_html: true });
|
|
998
|
+
|
|
999
|
+
return /<(?:[A-Za-z]+[A-Za-z0-9]*)(?:\s+.*?)*?\/{0,1}>/.test(content) ||
|
|
952
1000
|
/<(?<Element>(?:[A-Za-z]+[A-Za-z0-9]*:)?(?:[A-Za-z]+[A-Za-z0-9]*))(?:\s+.*?)*?>(?:.|\n)*?<\/{1}\k<Element>>/.test(content) ||
|
|
953
|
-
/<(?<Element>(?:[a-z][a-z0-9._]*:)?[a-z][a-z0-9._]*-[a-z0-9._-]+)(?:\s+.*?)*?>(?:.|\n)*?<\/{1}\k<Element>>/.test(content)
|
|
1001
|
+
/<(?<Element>(?:[a-z][a-z0-9._]*:)?[a-z][a-z0-9._]*-[a-z0-9._-]+)(?:\s+.*?)*?>(?:.|\n)*?<\/{1}\k<Element>>/.test(content)
|
|
1002
|
+
};
|
|
954
1003
|
|
|
955
1004
|
/**
|
|
956
1005
|
* Generic utility which merges two objects.
|
|
@@ -988,16 +1037,14 @@ const mergeObjects = (current, updates) => {
|
|
|
988
1037
|
/**
|
|
989
1038
|
* Merge a user config with the default config.
|
|
990
1039
|
*
|
|
991
|
-
* @param {import('htmlfy').Config}
|
|
1040
|
+
* @param {import('htmlfy').Config} default_config The default config.
|
|
992
1041
|
* @param {import('htmlfy').UserConfig} config The user config.
|
|
993
1042
|
* @returns {import('htmlfy').Config}
|
|
994
1043
|
*/
|
|
995
|
-
const mergeConfig = (
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
*/
|
|
1000
|
-
return mergeObjects(structuredClone(dconfig), config)
|
|
1044
|
+
const mergeConfig = (default_config, config) => {
|
|
1045
|
+
const validated_config = mergeObjects(default_config, config);
|
|
1046
|
+
setState({ config: validated_config });
|
|
1047
|
+
return validated_config
|
|
1001
1048
|
};
|
|
1002
1049
|
|
|
1003
1050
|
/**
|
|
@@ -1167,6 +1214,8 @@ const unsetIgnoreAttribute = (html) => {
|
|
|
1167
1214
|
*/
|
|
1168
1215
|
const validateConfig = (config) => {
|
|
1169
1216
|
if (typeof config !== 'object') throw new Error('Config must be an object.')
|
|
1217
|
+
|
|
1218
|
+
const default_config = { ...CONFIG };
|
|
1170
1219
|
|
|
1171
1220
|
const config_empty = !(
|
|
1172
1221
|
Object.hasOwn(config, 'content_wrap') ||
|
|
@@ -1179,7 +1228,10 @@ const validateConfig = (config) => {
|
|
|
1179
1228
|
Object.hasOwn(config, 'trim')
|
|
1180
1229
|
);
|
|
1181
1230
|
|
|
1182
|
-
if (config_empty)
|
|
1231
|
+
if (config_empty) {
|
|
1232
|
+
setState({ config: default_config });
|
|
1233
|
+
return default_config
|
|
1234
|
+
}
|
|
1183
1235
|
|
|
1184
1236
|
let tab_size = config.tab_size;
|
|
1185
1237
|
|
|
@@ -1217,7 +1269,7 @@ const validateConfig = (config) => {
|
|
|
1217
1269
|
if (config.tag_wrap_width)
|
|
1218
1270
|
config.tag_wrap = config.tag_wrap_width;
|
|
1219
1271
|
else
|
|
1220
|
-
config.tag_wrap =
|
|
1272
|
+
config.tag_wrap = default_config.tag_wrap_width;
|
|
1221
1273
|
}
|
|
1222
1274
|
|
|
1223
1275
|
if (Object.hasOwn(config, 'tag_wrap') && typeof config.tag_wrap !== 'number')
|
|
@@ -1234,7 +1286,7 @@ const validateConfig = (config) => {
|
|
|
1234
1286
|
if (Object.hasOwn(config, 'trim') && (!Array.isArray(config.trim) || !config.trim?.every((e) => typeof e === 'string')))
|
|
1235
1287
|
throw new Error('Trim config must be an array of strings.')
|
|
1236
1288
|
|
|
1237
|
-
return mergeConfig(
|
|
1289
|
+
return mergeConfig(default_config, config)
|
|
1238
1290
|
|
|
1239
1291
|
};
|
|
1240
1292
|
|
|
@@ -1303,6 +1355,7 @@ const wordWrap = (text, width, indent) => {
|
|
|
1303
1355
|
* @returns {{ html_with_markers: string, extracted_map: Map<any,any> }}
|
|
1304
1356
|
*/
|
|
1305
1357
|
function extractIgnoredBlocks(html, config) {
|
|
1358
|
+
setState({ ignored: true });
|
|
1306
1359
|
let current_html = html;
|
|
1307
1360
|
const extracted_blocks = new Map();
|
|
1308
1361
|
let marker_id = 0;
|
|
@@ -1350,6 +1403,7 @@ function extractIgnoredBlocks(html, config) {
|
|
|
1350
1403
|
* @returns
|
|
1351
1404
|
*/
|
|
1352
1405
|
function reinsertIgnoredBlocks(html_with_markers, extracted_map) {
|
|
1406
|
+
setState({ ignored: false });
|
|
1353
1407
|
let final_html = html_with_markers;
|
|
1354
1408
|
|
|
1355
1409
|
for (const [marker, original_block] of extracted_map) {
|
|
@@ -1362,12 +1416,13 @@ function reinsertIgnoredBlocks(html_with_markers, extracted_map) {
|
|
|
1362
1416
|
* Ensure void elements are "self-closing".
|
|
1363
1417
|
*
|
|
1364
1418
|
* @param {string} html The HTML string to evaluate.
|
|
1365
|
-
* @param {boolean} check_html Check to see if the content contains any HTML, before processing.
|
|
1366
1419
|
* @returns {string}
|
|
1367
1420
|
* @example <br> => <br />
|
|
1368
1421
|
*/
|
|
1369
|
-
const closify = (html
|
|
1370
|
-
|
|
1422
|
+
const closify = (html) => {
|
|
1423
|
+
const { checked_html } = getState();
|
|
1424
|
+
|
|
1425
|
+
if (!checked_html && !isHtml(html)) return html
|
|
1371
1426
|
|
|
1372
1427
|
return html.replace(/<([a-zA-Z\-0-9:]+)[^>]*>/g, (match, name) => {
|
|
1373
1428
|
if (VOID_ELEMENTS.indexOf(name) > -1)
|
|
@@ -1432,16 +1487,35 @@ const entify = (html, minify = false) => {
|
|
|
1432
1487
|
return html
|
|
1433
1488
|
};
|
|
1434
1489
|
|
|
1490
|
+
/**
|
|
1491
|
+
* @type {Map<any,any>}
|
|
1492
|
+
*/
|
|
1493
|
+
let ignore_map$1;
|
|
1494
|
+
|
|
1435
1495
|
/**
|
|
1436
1496
|
* Creates a single-line HTML string
|
|
1437
1497
|
* by removing line returns, tabs, and relevant spaces.
|
|
1438
1498
|
*
|
|
1439
1499
|
* @param {string} html The HTML string to minify.
|
|
1440
|
-
* @param {
|
|
1500
|
+
* @param {import('htmlfy').UserConfig} [config] A user configuration object.
|
|
1441
1501
|
* @returns {string} A minified HTML string.
|
|
1442
1502
|
*/
|
|
1443
|
-
const minify = (html,
|
|
1444
|
-
|
|
1503
|
+
const minify = (html, config) => {
|
|
1504
|
+
let reinsert_ignored = false;
|
|
1505
|
+
const { checked_html, ignored } = getState();
|
|
1506
|
+
|
|
1507
|
+
if (!checked_html && !isHtml(html)) return html
|
|
1508
|
+
|
|
1509
|
+
const validated_config = (getState()).config;
|
|
1510
|
+
const ignore = validated_config.ignore.length > 0;
|
|
1511
|
+
|
|
1512
|
+
/* Extract ignored elements. Skipped if prettify has already ignored blocks. */
|
|
1513
|
+
if (!ignored && ignore) {
|
|
1514
|
+
const { html_with_markers, extracted_map } = extractIgnoredBlocks(html, validated_config);
|
|
1515
|
+
html = html_with_markers;
|
|
1516
|
+
ignore_map$1 = extracted_map;
|
|
1517
|
+
reinsert_ignored = true;
|
|
1518
|
+
}
|
|
1445
1519
|
|
|
1446
1520
|
/**
|
|
1447
1521
|
* Ensure textarea content is specially minified and protected
|
|
@@ -1484,19 +1558,14 @@ const minify = (html, check_html = true) => {
|
|
|
1484
1558
|
// Final trim for the whole string
|
|
1485
1559
|
html = html.trim();
|
|
1486
1560
|
|
|
1561
|
+
/* Re-insert ignored elements. Skipped unless minify did the ignore. */
|
|
1562
|
+
if (reinsert_ignored) {
|
|
1563
|
+
html = reinsertIgnoredBlocks(html, ignore_map$1);
|
|
1564
|
+
}
|
|
1565
|
+
|
|
1487
1566
|
return html
|
|
1488
1567
|
};
|
|
1489
1568
|
|
|
1490
|
-
/**
|
|
1491
|
-
* @type {boolean}
|
|
1492
|
-
*/
|
|
1493
|
-
let strict;
|
|
1494
|
-
|
|
1495
|
-
/**
|
|
1496
|
-
* @type {string[]}
|
|
1497
|
-
*/
|
|
1498
|
-
let trim;
|
|
1499
|
-
|
|
1500
1569
|
/**
|
|
1501
1570
|
* @type {{ line: Record<string,string>[] }}
|
|
1502
1571
|
*/
|
|
@@ -1547,11 +1616,13 @@ const enqueue = (html) => {
|
|
|
1547
1616
|
* @returns {string}
|
|
1548
1617
|
*/
|
|
1549
1618
|
const preprocess = (html) => {
|
|
1550
|
-
html = closify(html
|
|
1619
|
+
html = closify(html);
|
|
1551
1620
|
|
|
1552
|
-
|
|
1621
|
+
const { config } = getState();
|
|
1553
1622
|
|
|
1554
|
-
html =
|
|
1623
|
+
if (config.trim.length > 0) html = trimify(html, config.trim);
|
|
1624
|
+
|
|
1625
|
+
html = minify(html);
|
|
1555
1626
|
html = enqueue(html);
|
|
1556
1627
|
|
|
1557
1628
|
return html
|
|
@@ -1559,16 +1630,16 @@ const preprocess = (html) => {
|
|
|
1559
1630
|
|
|
1560
1631
|
/**
|
|
1561
1632
|
*
|
|
1562
|
-
* @param {string} html The HTML string to process.
|
|
1563
1633
|
* @param {import('htmlfy').Config} config
|
|
1564
1634
|
* @returns {string}
|
|
1565
1635
|
*/
|
|
1566
|
-
const process = (
|
|
1636
|
+
const process = (config) => {
|
|
1567
1637
|
const step = " ".repeat(config.tab_size);
|
|
1568
1638
|
const tag_wrap = config.tag_wrap;
|
|
1569
1639
|
const content_wrap = config.content_wrap;
|
|
1570
1640
|
const ignore_with = config.ignore_with;
|
|
1571
1641
|
const placeholder_template = `-${ignore_with}`;
|
|
1642
|
+
const strict = config.strict;
|
|
1572
1643
|
|
|
1573
1644
|
/* Track current number of indentations needed. */
|
|
1574
1645
|
let indents = '';
|
|
@@ -1740,33 +1811,34 @@ const process = (html, config) => {
|
|
|
1740
1811
|
* @returns {string} A well-formed HTML string.
|
|
1741
1812
|
*/
|
|
1742
1813
|
const prettify = (html, config) => {
|
|
1743
|
-
|
|
1744
|
-
|
|
1814
|
+
let reinsert_ignored = false;
|
|
1815
|
+
const { checked_html, ignored } = getState();
|
|
1745
1816
|
|
|
1746
|
-
|
|
1747
|
-
|
|
1817
|
+
/* Return content as-is if it does not contain any HTML elements. */
|
|
1818
|
+
if (!checked_html && !isHtml(html)) return html
|
|
1748
1819
|
|
|
1820
|
+
const validated_config = config ? validateConfig(config) : { ...CONFIG };
|
|
1749
1821
|
const ignore = validated_config.ignore.length > 0;
|
|
1750
|
-
trim = validated_config.trim;
|
|
1751
1822
|
|
|
1752
1823
|
/* Extract ignored elements. */
|
|
1753
|
-
if (ignore) {
|
|
1824
|
+
if (!ignored && ignore) {
|
|
1754
1825
|
const { html_with_markers, extracted_map } = extractIgnoredBlocks(html, validated_config);
|
|
1755
1826
|
html = html_with_markers;
|
|
1756
1827
|
ignore_map = extracted_map;
|
|
1828
|
+
reinsert_ignored = true;
|
|
1757
1829
|
}
|
|
1758
1830
|
|
|
1759
1831
|
/* Preserve html text within attribute values. */
|
|
1760
1832
|
html = setIgnoreAttribute(html);
|
|
1761
1833
|
|
|
1762
1834
|
html = preprocess(html);
|
|
1763
|
-
html = process(
|
|
1835
|
+
html = process(validated_config);
|
|
1764
1836
|
|
|
1765
1837
|
/* Revert html text within attribute values. */
|
|
1766
1838
|
html = unsetIgnoreAttribute(html);
|
|
1767
1839
|
|
|
1768
1840
|
/* Re-insert ignored elements. */
|
|
1769
|
-
if (
|
|
1841
|
+
if (reinsert_ignored) {
|
|
1770
1842
|
html = reinsertIgnoredBlocks(html, ignore_map);
|
|
1771
1843
|
}
|
|
1772
1844
|
|