@mgdis/core-ui-helpers 1.3.2 → 1.5.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/README.md +44 -0
- package/dist/locale/index.cjs +13 -1
- package/dist/locale/index.cjs.map +1 -1
- package/dist/locale/index.js +13 -1
- package/dist/locale/index.js.map +1 -1
- package/dist/locale/index.umd.js +13 -1
- package/dist/locale/index.umd.js.map +1 -1
- package/dist/stencil/index.cjs +16 -1
- package/dist/stencil/index.cjs.map +1 -1
- package/dist/stencil/index.d.ts +11 -1
- package/dist/stencil/index.js +16 -2
- package/dist/stencil/index.js.map +1 -1
- package/dist/stencil/index.umd.js +16 -1
- package/dist/stencil/index.umd.js.map +1 -1
- package/dist/storybook/index.cjs +19 -7
- package/dist/storybook/index.cjs.map +1 -1
- package/dist/storybook/index.js +19 -7
- package/dist/storybook/index.js.map +1 -1
- package/dist/storybook/index.umd.js +19 -7
- package/dist/storybook/index.umd.js.map +1 -1
- package/dist/utils/index.cjs +31 -0
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.ts +10 -1
- package/dist/utils/index.js +31 -1
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/index.umd.js +31 -0
- package/dist/utils/index.umd.js.map +1 -1
- package/dist/vue/index.cjs +44 -1882
- package/dist/vue/index.cjs.map +1 -1
- package/dist/vue/index.d.ts +0 -1
- package/dist/vue/index.js +44 -1882
- package/dist/vue/index.js.map +1 -1
- package/dist/vue/index.umd.js +97 -1935
- package/dist/vue/index.umd.js.map +1 -1
- package/package.json +10 -12
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.umd.js","sources":["../../../../node_modules/.pnpm/htmlfy@1.1.0/node_modules/htmlfy/src/constants.js","../../../../node_modules/.pnpm/htmlfy@1.1.0/node_modules/htmlfy/src/prettify.js","../../src/storybook/stencil/stencil.ts","../../src/stencil/ide/ide.ts","../../src/stencil/ide/cem.ts","../../src/stencil/normalize-boolean-attributes/normalize-boolean-attributes.ts"],"sourcesContent":["/**\n * @type {import('htmlfy').Config}\n */\nexport const CONFIG = {\n content_wrap: 0,\n ignore: [],\n ignore_with: '!i-£___£%_',\n strict: false,\n tab_size: 2,\n tag_wrap: 0,\n trim: []\n}\n\nexport const VOID_ELEMENTS = [\n 'area', 'base', 'br', 'col', 'embed', 'hr', \n 'img', 'input', 'link', 'meta',\n 'param', 'source', 'track', 'wbr'\n]\n\n/**\n * Defined per formatting operation from configuration.\n * \n * CONTENT_IGNORE_PLACEHOLDER\n * SELF_CLOSING_PLACEHOLDER\n * ATTRIBUTE_IGNORE_PLACEHOLDER\n */\n","import { minifyKnownHtml } from './minify.js'\nimport { \n createConstants,\n extractIgnoredBlocks,\n finalProtectContent,\n isHtml, \n protectAttributes, \n reinsertIgnoredBlocks, \n setIgnoreAttribute, \n setSelfClosing, \n trimify, \n unprotectAttributes, \n unprotectContent, \n unsetIgnoreAttribute, \n validateConfig, \n wordWrap\n} from './utils.js'\nimport { VOID_ELEMENTS } from './constants.js'\n\nconst VOID_ELEMENT_SET = new Set(VOID_ELEMENTS)\nconst TOKEN_CLOSING = 1\nconst TOKEN_COMMENT = 2\nconst TOKEN_DOCTYPE = 4\nconst TOKEN_IGNORED = 8\nconst TOKEN_SELF_CLOSING = 16\nconst TOKEN_SYNTHETIC_SELF_CLOSING = 32\nconst TOKEN_INLINE = 64\n\n/**\n * @typedef {object} Token\n * @property {'tag' | 'text'} type\n * @property {string} value\n * @property {number} flags\n */\n\n/**\n * Isolate tags, content, and comments.\n * \n * @param {string} html The HTML string to evaluate.\n * @param {import('./utils.js').HtmlfyConstants} constants\n * @returns {Token[]}\n */\nconst enqueue = (html, constants) => {\n /** @type {Token[]} */\n const lines = []\n /* Regex to find tags OR text content between tags. */\n const regex = /<[^>]+>|[^<]+/g\n\n /* Use replace for callback iteration, but avoid constructing the old marker output. */\n html.replace(regex, (value) => {\n const type = value.startsWith('<') ? 'tag' : 'text'\n\n if (type === 'text') {\n if (value.trim().length > 0) {\n lines.push({\n type,\n value,\n flags: value.startsWith('___HTMLFY_SPECIAL_IGNORE_MARKER_') ? TOKEN_IGNORED : 0,\n })\n }\n return ''\n }\n\n const trimmed = value.trim()\n const synthetic_self_closing = trimmed.endsWith(constants.SELF_CLOSING_PLACEHOLDER)\n let flags = 0\n if (trimmed.startsWith('</')) flags |= TOKEN_CLOSING\n if (trimmed.startsWith('<!--')) flags |= TOKEN_COMMENT\n if (trimmed.startsWith('<!doctype')) flags |= TOKEN_DOCTYPE\n if (trimmed.endsWith('/>') || synthetic_self_closing) flags |= TOKEN_SELF_CLOSING\n if (synthetic_self_closing) flags |= TOKEN_SYNTHETIC_SELF_CLOSING\n\n lines.push({\n type,\n value,\n flags,\n })\n return ''\n })\n\n return lines\n}\n\n/**\n * Collapse the same simple element pairs handled by the final output regex.\n *\n * @param {Token[]} lines\n * @returns {Token[]}\n */\nconst collapseInlineTokens = (lines) => {\n /** @type {Token[]} */\n const collapsed = []\n\n for (let index = 0; index < lines.length; index++) {\n const opening = lines[index]\n\n if (opening.type === 'tag' && !(opening.flags & (\n TOKEN_CLOSING |\n TOKEN_COMMENT |\n TOKEN_DOCTYPE |\n TOKEN_SELF_CLOSING\n ))) {\n const name_match = opening.value.match(/^<([^>\\s]+)[^>]*>$/)\n const name = name_match?.[1]\n const content = lines[index + 1]\n const possible_closing = content?.type === 'text' ? lines[index + 2] : content\n\n if (name && possible_closing?.value === `</${name}>`) {\n const empty_pair = content?.type === 'tag' && /^[\\w:._-]+$/.test(name)\n const text_pair = content?.type === 'text' && /[^><\\/\\s]/.test(content.value)\n\n if (empty_pair || text_pair) {\n collapsed.push({\n type: 'tag',\n value: opening.value + (text_pair ? content.value.trim() : '') + possible_closing.value,\n flags: TOKEN_INLINE,\n })\n index += text_pair ? 2 : 1\n continue\n }\n }\n }\n\n collapsed.push(opening)\n }\n\n return collapsed\n}\n\n/**\n * Process enqueued content.\n * \n * @param {Token[]} lines\n * @param {import('htmlfy').Config} config\n * @param {import('./utils.js').HtmlfyConstants} constants\n * @returns {string}\n */\nconst process = (lines, config, constants) => {\n const step = \" \".repeat(config.tab_size)\n const tag_wrap = config.tag_wrap\n const content_wrap = config.content_wrap\n const strict = config.strict\n\n /* Track current number of indentations needed. */\n let indent_level = 0\n\n /** @type string[] */\n const output_lines = []\n const tag_regex = /<[A-Za-z]+\\b[^>]*(?:.|\\n)*?\\/?>/ /* Is opening tag or void element. */\n const attribute_regex = /\\s{1}[A-Za-z:@#*?$()\\[\\].-]+(?:=\".*?\")?/g /* Matches all tag/element attributes. */\n\n /* Process lines and indent. */\n lines.forEach((source, index) => {\n let current_line_value = source.value\n\n let subtrahend = 0\n const prev_line_data = lines[index - 1]\n\n indent_level++\n\n if (index === 0) subtrahend++\n /* We're processing a closing tag. */\n if (source.flags & TOKEN_CLOSING) subtrahend++\n /* prevLine is a doctype declaration. */\n if (prev_line_data && (prev_line_data.flags & TOKEN_DOCTYPE)) subtrahend++\n /* prevLine is a comment. */\n if (prev_line_data && (prev_line_data.flags & TOKEN_COMMENT)) subtrahend++\n /* prevLine is a void element. */\n if (prev_line_data && (prev_line_data.flags & TOKEN_SELF_CLOSING)) subtrahend++\n /* prevLine is a closing tag. */\n if (prev_line_data && (prev_line_data.flags & TOKEN_CLOSING)) subtrahend++\n /* prevLine opens and closes on the same line. */\n if (prev_line_data && (prev_line_data.flags & TOKEN_INLINE)) subtrahend++\n /* prevLine is text. */\n if (prev_line_data?.type === \"text\") subtrahend++\n\n /* Determine offset for line indentation. */\n const offset = Math.max(0, indent_level - subtrahend)\n /* Correct indent level for *this* line's content */\n const current_indent_level = offset // Store the level for this line\n\n indent_level = current_indent_level\n\n /**\n * Starts with a single punctuation character.\n * Add punctuation to end of previous line.\n */\n if (source.type === 'text' && /^[!,;\\.]/.test(current_line_value)) {\n if (current_line_value.length === 1) {\n output_lines[output_lines.length - 1] = \n output_lines.at(-1) + current_line_value\n return\n } else {\n output_lines[output_lines.length - 1] = \n output_lines.at(-1) + current_line_value.charAt(0)\n current_line_value = current_line_value.slice(1).trim()\n\n /* If nothing left after extracting punctuation, skip this line. */\n if (current_line_value.length === 0) return\n }\n }\n\n const padding = step.repeat(current_indent_level)\n\n if (source.flags & TOKEN_IGNORED) {\n /* Stop processing this line, as it's set to be ignored. */\n output_lines.push(current_line_value)\n } else {\n /* Remove comment. */\n if (strict && (source.flags & TOKEN_COMMENT))\n return\n\n let result = current_line_value\n\n /* Remove self-closing placeholder, if needed. */\n if (source.flags & TOKEN_SYNTHETIC_SELF_CLOSING)\n result = result.replace(constants.SELF_CLOSING_PLACEHOLDER, '>')\n\n if (\n source.type === 'text' && \n content_wrap > 0 && \n result.length >= content_wrap\n ) {\n result = wordWrap(result, content_wrap, padding, constants)\n }\n /* Wrap the attributes of open tags and void elements. */\n else if (\n tag_wrap > 0 &&\n result.length > tag_wrap &&\n tag_regex.test(result)\n ) {\n attribute_regex.lastIndex = 0 // Reset stateful regex\n\n const attributes = []\n let first_attribute_start = -1\n let last_attribute_end = -1\n let attribute_match\n\n while ((attribute_match = attribute_regex.exec(result)) !== null) {\n if (first_attribute_start === -1) first_attribute_start = attribute_match.index\n last_attribute_end = attribute_regex.lastIndex\n attributes.push(attribute_match[0].trim())\n }\n\n if (attributes.length > 0) {\n const opening_part = result.slice(0, first_attribute_start)\n const closing_part = result.slice(last_attribute_end).trim()\n const inner_padding = padding + step\n const wrapped_tag = [padding + opening_part]\n\n for (const attribute of attributes) {\n wrapped_tag.push(inner_padding + attribute)\n }\n\n const tag_name_match = opening_part.match(/<([A-Za-z_:-]+)/)\n const tag_name = tag_name_match ? tag_name_match[1] : \"\"\n const is_self_closing = result.endsWith(\"/>\") && VOID_ELEMENT_SET.has(tag_name)\n const closing_padding = padding + (strict && is_self_closing ? \" \" : \"\")\n\n wrapped_tag.push(closing_padding + closing_part)\n result = wrapped_tag.join('\\n')\n } else {\n result = padding + result\n }\n } else {\n /* Apply simple indentation (if no wrapping occurred) */\n result = padding + result\n }\n\n /* Add the processed line (or lines if wordWrap creates them) to the output */\n output_lines.push(result)\n }\n })\n\n /* Join all processed lines into the final HTML string */\n let final_html = output_lines.join(\"\\n\")\n\n /* Preserve wrapped attributes. */\n if (tag_wrap > 0) final_html = protectAttributes(final_html, constants)\n\n /* Extra preserve wrapped content. */\n if (content_wrap > 0 && new RegExp(`/\\\\n[ ]*[^\\\\n]*${constants.CONTENT_IGNORE_PLACEHOLDER}[^\\\\n]*\\\\n/`).test(final_html))\n final_html = finalProtectContent(final_html, constants)\n\n /* Remove line returns, tabs, and consecutive spaces within html elements or their content. */\n if (tag_wrap > 0 || content_wrap > 0) {\n final_html = final_html.replace(\n /<(?<Element>[^>\\s]+)[^>]*>[^<]*?[^><\\/\\s][^<]*?<\\/\\k<Element>>|<script[^>]*>[\\s]*<\\/script>|<([\\w:\\._-]+)([^>]*)><\\/\\2>|<([\\w:\\._-]+)([^>]*)>[\\s]+<\\/\\4>/g,\n match => {\n // Check if this contains placeholder\n if (match.includes(constants.SELF_CLOSING_PLACEHOLDER) || match.includes(constants.CONTENT_IGNORE_PLACEHOLDER)) {\n return match // Don't modify if it contains the placeholder\n }\n\n return match.replace(/\\n|\\t|\\s{2,}/g, '')\n }\n )\n }\n\n /* Revert wrapped content. */\n if (content_wrap > 0) final_html = unprotectContent(final_html, constants)\n\n /* Revert wrapped attributes. */\n if (tag_wrap > 0) final_html = unprotectAttributes(final_html, constants)\n\n /* Remove self-closing nature of void elements. */\n if (strict) final_html = final_html.replace(/\\s\\/>|\\/>/g, '>')\n\n /* Trim leading and/or trailing line returns. */\n if (final_html.startsWith(\"\\n\")) final_html = final_html.substring(1)\n if (final_html.endsWith(\"\\n\")) final_html = final_html.substring(0, final_html.length - 1)\n\n return final_html\n}\n\n/**\n * Format HTML with line returns and indentations.\n * \n * @param {string} html The HTML string to prettify.\n * @param {import('htmlfy').UserConfig} [config] A user configuration object.\n * @returns {string} A well-formed HTML string.\n */\nexport const prettify = (html, config) => {\n /* Return content as-is if it does not contain any HTML elements. */\n if (!isHtml(html)) return html\n\n const validated_config = validateConfig(config || {})\n const constants = createConstants(validated_config.ignore_with)\n\n const ignore = validated_config.ignore.length > 0\n\n /** @type {Map<any,any> | undefined} */\n let ignore_map\n\n /* Allows you to trimify before ignoring. */\n if (validated_config.trim.length > 0) html = trimify(html, validated_config.trim)\n\n /* Extract ignored elements. */\n if (ignore) {\n const { html_with_markers, extracted_map } = extractIgnoredBlocks(html, validated_config.ignore)\n html = html_with_markers\n ignore_map = extracted_map\n }\n\n /* Preserve html text within attribute values. */\n html = setIgnoreAttribute(html, constants)\n\n /* Insert placeholder for void elements that aren't self-closing. */\n html = setSelfClosing(html, constants)\n\n html = minifyKnownHtml(html, validated_config)\n let lines = enqueue(html, constants)\n if (validated_config.tag_wrap === 0 && validated_config.content_wrap === 0)\n lines = collapseInlineTokens(lines)\n html = process(lines, validated_config, constants)\n\n /* Revert html text within attribute values. */\n html = unsetIgnoreAttribute(html, constants)\n\n /* Re-insert ignored elements. */\n if (ignore_map) {\n html = reinsertIgnoredBlocks(html, ignore_map)\n }\n\n return html\n}\n",null,null,null,null],"names":[],"mappings":";;;;;;EAAA;EACA;EACA;;EAWO,MAAM,aAAa,GAAG;EAC7B,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI;EAC5C,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;EAChC,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE;EAC9B;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;;ECNyB,IAAI,GAAG,CAAC,aAAa;;EC0I9C;;;;;EAKG;EACI,MAAM,eAAe,GAAG,CAAC,gBAAwB,EAAE,QAA4B,KAAwB;MAC5G,IAAI,CAAC,QAAQ,EAAE;UACb;MACF;MACA,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC;MACjC,OAAO,CAAA,EAAG,gBAAgB,CAAA,EAAG,K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AC,CAAC,EAAE,CAAS,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;UAClF,IAAI,OAAQ,MAAkC,CAAC,QAAQ,CAAC,KAAK,SAAS,EAAE;cACtE,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;UAC5C;MACF;EACF;;;;;;;;","x_google_ignoreList":[0,1]}
|
|
1
|
+
{"version":3,"file":"index.umd.js","sources":["../../../../node_modules/.pnpm/htmlfy@1.1.0/node_modules/htmlfy/src/constants.js","../../../../node_modules/.pnpm/htmlfy@1.1.0/node_modules/htmlfy/src/prettify.js","../../src/storybook/stencil/stencil.ts","../../src/stencil/ide/ide.ts","../../src/stencil/ide/cem.ts","../../src/stencil/normalize-boolean-attributes/normalize-boolean-attributes.ts","../../src/stencil/resolve-prop-value/resolve-prop-value.ts"],"sourcesContent":["/**\n * @type {import('htmlfy').Config}\n */\nexport const CONFIG = {\n content_wrap: 0,\n ignore: [],\n ignore_with: '!i-£___£%_',\n strict: false,\n tab_size: 2,\n tag_wrap: 0,\n trim: []\n}\n\nexport const VOID_ELEMENTS = [\n 'area', 'base', 'br', 'col', 'embed', 'hr', \n 'img', 'input', 'link', 'meta',\n 'param', 'source', 'track', 'wbr'\n]\n\n/**\n * Defined per formatting operation from configuration.\n * \n * CONTENT_IGNORE_PLACEHOLDER\n * SELF_CLOSING_PLACEHOLDER\n * ATTRIBUTE_IGNORE_PLACEHOLDER\n */\n","import { minifyKnownHtml } from './minify.js'\nimport { \n createConstants,\n extractIgnoredBlocks,\n finalProtectContent,\n isHtml, \n protectAttributes, \n reinsertIgnoredBlocks, \n setIgnoreAttribute, \n setSelfClosing, \n trimify, \n unprotectAttributes, \n unprotectContent, \n unsetIgnoreAttribute, \n validateConfig, \n wordWrap\n} from './utils.js'\nimport { VOID_ELEMENTS } from './constants.js'\n\nconst VOID_ELEMENT_SET = new Set(VOID_ELEMENTS)\nconst TOKEN_CLOSING = 1\nconst TOKEN_COMMENT = 2\nconst TOKEN_DOCTYPE = 4\nconst TOKEN_IGNORED = 8\nconst TOKEN_SELF_CLOSING = 16\nconst TOKEN_SYNTHETIC_SELF_CLOSING = 32\nconst TOKEN_INLINE = 64\n\n/**\n * @typedef {object} Token\n * @property {'tag' | 'text'} type\n * @property {string} value\n * @property {number} flags\n */\n\n/**\n * Isolate tags, content, and comments.\n * \n * @param {string} html The HTML string to evaluate.\n * @param {import('./utils.js').HtmlfyConstants} constants\n * @returns {Token[]}\n */\nconst enqueue = (html, constants) => {\n /** @type {Token[]} */\n const lines = []\n /* Regex to find tags OR text content between tags. */\n const regex = /<[^>]+>|[^<]+/g\n\n /* Use replace for callback iteration, but avoid constructing the old marker output. */\n html.replace(regex, (value) => {\n const type = value.startsWith('<') ? 'tag' : 'text'\n\n if (type === 'text') {\n if (value.trim().length > 0) {\n lines.push({\n type,\n value,\n flags: value.startsWith('___HTMLFY_SPECIAL_IGNORE_MARKER_') ? TOKEN_IGNORED : 0,\n })\n }\n return ''\n }\n\n const trimmed = value.trim()\n const synthetic_self_closing = trimmed.endsWith(constants.SELF_CLOSING_PLACEHOLDER)\n let flags = 0\n if (trimmed.startsWith('</')) flags |= TOKEN_CLOSING\n if (trimmed.startsWith('<!--')) flags |= TOKEN_COMMENT\n if (trimmed.startsWith('<!doctype')) flags |= TOKEN_DOCTYPE\n if (trimmed.endsWith('/>') || synthetic_self_closing) flags |= TOKEN_SELF_CLOSING\n if (synthetic_self_closing) flags |= TOKEN_SYNTHETIC_SELF_CLOSING\n\n lines.push({\n type,\n value,\n flags,\n })\n return ''\n })\n\n return lines\n}\n\n/**\n * Collapse the same simple element pairs handled by the final output regex.\n *\n * @param {Token[]} lines\n * @returns {Token[]}\n */\nconst collapseInlineTokens = (lines) => {\n /** @type {Token[]} */\n const collapsed = []\n\n for (let index = 0; index < lines.length; index++) {\n const opening = lines[index]\n\n if (opening.type === 'tag' && !(opening.flags & (\n TOKEN_CLOSING |\n TOKEN_COMMENT |\n TOKEN_DOCTYPE |\n TOKEN_SELF_CLOSING\n ))) {\n const name_match = opening.value.match(/^<([^>\\s]+)[^>]*>$/)\n const name = name_match?.[1]\n const content = lines[index + 1]\n const possible_closing = content?.type === 'text' ? lines[index + 2] : content\n\n if (name && possible_closing?.value === `</${name}>`) {\n const empty_pair = content?.type === 'tag' && /^[\\w:._-]+$/.test(name)\n const text_pair = content?.type === 'text' && /[^><\\/\\s]/.test(content.value)\n\n if (empty_pair || text_pair) {\n collapsed.push({\n type: 'tag',\n value: opening.value + (text_pair ? content.value.trim() : '') + possible_closing.value,\n flags: TOKEN_INLINE,\n })\n index += text_pair ? 2 : 1\n continue\n }\n }\n }\n\n collapsed.push(opening)\n }\n\n return collapsed\n}\n\n/**\n * Process enqueued content.\n * \n * @param {Token[]} lines\n * @param {import('htmlfy').Config} config\n * @param {import('./utils.js').HtmlfyConstants} constants\n * @returns {string}\n */\nconst process = (lines, config, constants) => {\n const step = \" \".repeat(config.tab_size)\n const tag_wrap = config.tag_wrap\n const content_wrap = config.content_wrap\n const strict = config.strict\n\n /* Track current number of indentations needed. */\n let indent_level = 0\n\n /** @type string[] */\n const output_lines = []\n const tag_regex = /<[A-Za-z]+\\b[^>]*(?:.|\\n)*?\\/?>/ /* Is opening tag or void element. */\n const attribute_regex = /\\s{1}[A-Za-z:@#*?$()\\[\\].-]+(?:=\".*?\")?/g /* Matches all tag/element attributes. */\n\n /* Process lines and indent. */\n lines.forEach((source, index) => {\n let current_line_value = source.value\n\n let subtrahend = 0\n const prev_line_data = lines[index - 1]\n\n indent_level++\n\n if (index === 0) subtrahend++\n /* We're processing a closing tag. */\n if (source.flags & TOKEN_CLOSING) subtrahend++\n /* prevLine is a doctype declaration. */\n if (prev_line_data && (prev_line_data.flags & TOKEN_DOCTYPE)) subtrahend++\n /* prevLine is a comment. */\n if (prev_line_data && (prev_line_data.flags & TOKEN_COMMENT)) subtrahend++\n /* prevLine is a void element. */\n if (prev_line_data && (prev_line_data.flags & TOKEN_SELF_CLOSING)) subtrahend++\n /* prevLine is a closing tag. */\n if (prev_line_data && (prev_line_data.flags & TOKEN_CLOSING)) subtrahend++\n /* prevLine opens and closes on the same line. */\n if (prev_line_data && (prev_line_data.flags & TOKEN_INLINE)) subtrahend++\n /* prevLine is text. */\n if (prev_line_data?.type === \"text\") subtrahend++\n\n /* Determine offset for line indentation. */\n const offset = Math.max(0, indent_level - subtrahend)\n /* Correct indent level for *this* line's content */\n const current_indent_level = offset // Store the level for this line\n\n indent_level = current_indent_level\n\n /**\n * Starts with a single punctuation character.\n * Add punctuation to end of previous line.\n */\n if (source.type === 'text' && /^[!,;\\.]/.test(current_line_value)) {\n if (current_line_value.length === 1) {\n output_lines[output_lines.length - 1] = \n output_lines.at(-1) + current_line_value\n return\n } else {\n output_lines[output_lines.length - 1] = \n output_lines.at(-1) + current_line_value.charAt(0)\n current_line_value = current_line_value.slice(1).trim()\n\n /* If nothing left after extracting punctuation, skip this line. */\n if (current_line_value.length === 0) return\n }\n }\n\n const padding = step.repeat(current_indent_level)\n\n if (source.flags & TOKEN_IGNORED) {\n /* Stop processing this line, as it's set to be ignored. */\n output_lines.push(current_line_value)\n } else {\n /* Remove comment. */\n if (strict && (source.flags & TOKEN_COMMENT))\n return\n\n let result = current_line_value\n\n /* Remove self-closing placeholder, if needed. */\n if (source.flags & TOKEN_SYNTHETIC_SELF_CLOSING)\n result = result.replace(constants.SELF_CLOSING_PLACEHOLDER, '>')\n\n if (\n source.type === 'text' && \n content_wrap > 0 && \n result.length >= content_wrap\n ) {\n result = wordWrap(result, content_wrap, padding, constants)\n }\n /* Wrap the attributes of open tags and void elements. */\n else if (\n tag_wrap > 0 &&\n result.length > tag_wrap &&\n tag_regex.test(result)\n ) {\n attribute_regex.lastIndex = 0 // Reset stateful regex\n\n const attributes = []\n let first_attribute_start = -1\n let last_attribute_end = -1\n let attribute_match\n\n while ((attribute_match = attribute_regex.exec(result)) !== null) {\n if (first_attribute_start === -1) first_attribute_start = attribute_match.index\n last_attribute_end = attribute_regex.lastIndex\n attributes.push(attribute_match[0].trim())\n }\n\n if (attributes.length > 0) {\n const opening_part = result.slice(0, first_attribute_start)\n const closing_part = result.slice(last_attribute_end).trim()\n const inner_padding = padding + step\n const wrapped_tag = [padding + opening_part]\n\n for (const attribute of attributes) {\n wrapped_tag.push(inner_padding + attribute)\n }\n\n const tag_name_match = opening_part.match(/<([A-Za-z_:-]+)/)\n const tag_name = tag_name_match ? tag_name_match[1] : \"\"\n const is_self_closing = result.endsWith(\"/>\") && VOID_ELEMENT_SET.has(tag_name)\n const closing_padding = padding + (strict && is_self_closing ? \" \" : \"\")\n\n wrapped_tag.push(closing_padding + closing_part)\n result = wrapped_tag.join('\\n')\n } else {\n result = padding + result\n }\n } else {\n /* Apply simple indentation (if no wrapping occurred) */\n result = padding + result\n }\n\n /* Add the processed line (or lines if wordWrap creates them) to the output */\n output_lines.push(result)\n }\n })\n\n /* Join all processed lines into the final HTML string */\n let final_html = output_lines.join(\"\\n\")\n\n /* Preserve wrapped attributes. */\n if (tag_wrap > 0) final_html = protectAttributes(final_html, constants)\n\n /* Extra preserve wrapped content. */\n if (content_wrap > 0 && new RegExp(`/\\\\n[ ]*[^\\\\n]*${constants.CONTENT_IGNORE_PLACEHOLDER}[^\\\\n]*\\\\n/`).test(final_html))\n final_html = finalProtectContent(final_html, constants)\n\n /* Remove line returns, tabs, and consecutive spaces within html elements or their content. */\n if (tag_wrap > 0 || content_wrap > 0) {\n final_html = final_html.replace(\n /<(?<Element>[^>\\s]+)[^>]*>[^<]*?[^><\\/\\s][^<]*?<\\/\\k<Element>>|<script[^>]*>[\\s]*<\\/script>|<([\\w:\\._-]+)([^>]*)><\\/\\2>|<([\\w:\\._-]+)([^>]*)>[\\s]+<\\/\\4>/g,\n match => {\n // Check if this contains placeholder\n if (match.includes(constants.SELF_CLOSING_PLACEHOLDER) || match.includes(constants.CONTENT_IGNORE_PLACEHOLDER)) {\n return match // Don't modify if it contains the placeholder\n }\n\n return match.replace(/\\n|\\t|\\s{2,}/g, '')\n }\n )\n }\n\n /* Revert wrapped content. */\n if (content_wrap > 0) final_html = unprotectContent(final_html, constants)\n\n /* Revert wrapped attributes. */\n if (tag_wrap > 0) final_html = unprotectAttributes(final_html, constants)\n\n /* Remove self-closing nature of void elements. */\n if (strict) final_html = final_html.replace(/\\s\\/>|\\/>/g, '>')\n\n /* Trim leading and/or trailing line returns. */\n if (final_html.startsWith(\"\\n\")) final_html = final_html.substring(1)\n if (final_html.endsWith(\"\\n\")) final_html = final_html.substring(0, final_html.length - 1)\n\n return final_html\n}\n\n/**\n * Format HTML with line returns and indentations.\n * \n * @param {string} html The HTML string to prettify.\n * @param {import('htmlfy').UserConfig} [config] A user configuration object.\n * @returns {string} A well-formed HTML string.\n */\nexport const prettify = (html, config) => {\n /* Return content as-is if it does not contain any HTML elements. */\n if (!isHtml(html)) return html\n\n const validated_config = validateConfig(config || {})\n const constants = createConstants(validated_config.ignore_with)\n\n const ignore = validated_config.ignore.length > 0\n\n /** @type {Map<any,any> | undefined} */\n let ignore_map\n\n /* Allows you to trimify before ignoring. */\n if (validated_config.trim.length > 0) html = trimify(html, validated_config.trim)\n\n /* Extract ignored elements. */\n if (ignore) {\n const { html_with_markers, extracted_map } = extractIgnoredBlocks(html, validated_config.ignore)\n html = html_with_markers\n ignore_map = extracted_map\n }\n\n /* Preserve html text within attribute values. */\n html = setIgnoreAttribute(html, constants)\n\n /* Insert placeholder for void elements that aren't self-closing. */\n html = setSelfClosing(html, constants)\n\n html = minifyKnownHtml(html, validated_config)\n let lines = enqueue(html, constants)\n if (validated_config.tag_wrap === 0 && validated_config.content_wrap === 0)\n lines = collapseInlineTokens(lines)\n html = process(lines, validated_config, constants)\n\n /* Revert html text within attribute values. */\n html = unsetIgnoreAttribute(html, constants)\n\n /* Re-insert ignored elements. */\n if (ignore_map) {\n html = reinsertIgnoredBlocks(html, ignore_map)\n }\n\n return html\n}\n",null,null,null,null,null],"names":[],"mappings":";;;;;;EAAA;EACA;EACA;;E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licensed | https://stenciljs.com
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
|
|
@@ -22,6 +22,7 @@ var getHostRef = (ref) => {
|
|
|
22
22
|
return void 0;
|
|
23
23
|
};
|
|
24
24
|
var isMemberInElement = (elm, memberName) => memberName in elm;
|
|
25
|
+
var consoleError = (e, el) => (0, console.error)(e, el);
|
|
25
26
|
var XLINK_NS = "http://www.w3.org/1999/xlink";
|
|
26
27
|
var win = typeof window !== "undefined" ? window : {};
|
|
27
28
|
var plt = {
|
|
@@ -74,7 +75,7 @@ function getHostSlotNodes(childNodes, hostName, slotName) {
|
|
|
74
75
|
slottedNodes.push(childNode);
|
|
75
76
|
if (typeof slotName !== "undefined") return slottedNodes;
|
|
76
77
|
}
|
|
77
|
-
slottedNodes = [...slottedNodes, ...getHostSlotNodes(childNode
|
|
78
|
+
slottedNodes = [...slottedNodes, ...getHostSlotNodes(internalCall(childNode, "childNodes"), hostName, slotName)];
|
|
78
79
|
}
|
|
79
80
|
return slottedNodes;
|
|
80
81
|
}
|
|
@@ -176,6 +177,11 @@ var h = (nodeName, vnodeData, ...children) => {
|
|
|
176
177
|
} else if (child != null && typeof child !== "boolean") {
|
|
177
178
|
if (simple = !isComplexType(child)) {
|
|
178
179
|
child = String(child);
|
|
180
|
+
} else if (child.$flags$ === void 0) {
|
|
181
|
+
{
|
|
182
|
+
consoleError("Invalid vNode child");
|
|
183
|
+
}
|
|
184
|
+
continue;
|
|
179
185
|
}
|
|
180
186
|
if (simple && lastSimple) {
|
|
181
187
|
vNodeChildren[vNodeChildren.length - 1].$text$ += child;
|
|
@@ -233,7 +239,8 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
|
|
|
233
239
|
const oldClasses = parseClassList(oldValue);
|
|
234
240
|
let newClasses = parseClassList(newValue);
|
|
235
241
|
{
|
|
236
|
-
|
|
242
|
+
let removedClasses = oldClasses.filter((c) => c && !newClasses.includes(c));
|
|
243
|
+
classList.remove(...removedClasses);
|
|
237
244
|
classList.add(...newClasses.filter((c) => c && !oldClasses.includes(c)));
|
|
238
245
|
}
|
|
239
246
|
} else if (memberName === "style") {
|
|
@@ -338,7 +345,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
|
|
|
338
345
|
}
|
|
339
346
|
}
|
|
340
347
|
if (newValue == null || newValue === false) {
|
|
341
|
-
if (newValue !== false || elm.getAttribute(memberName) === "") {
|
|
348
|
+
if (newValue !== false || elm.getAttribute(memberName) === "" || flags & 4 /* isHost */ && !isEnumeratedAttribute(memberName)) {
|
|
342
349
|
if (xlink) {
|
|
343
350
|
elm.removeAttributeNS(XLINK_NS, memberName);
|
|
344
351
|
} else {
|
|
@@ -355,6 +362,8 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
|
|
|
355
362
|
}
|
|
356
363
|
}
|
|
357
364
|
};
|
|
365
|
+
var ENUMERATED_ATTRIBUTES = /* @__PURE__ */ new Set(["draggable", "contenteditable", "spellcheck"]);
|
|
366
|
+
var isEnumeratedAttribute = (attrName) => ENUMERATED_ATTRIBUTES.has(attrName) || attrName.startsWith("aria-");
|
|
358
367
|
var parseClassListRegex = /\s/;
|
|
359
368
|
var parseClassList = (value) => {
|
|
360
369
|
if (typeof value === "object" && value && "baseVal" in value) {
|
|
@@ -646,7 +655,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
|
|
|
646
655
|
if (idxInOld >= 0) {
|
|
647
656
|
elmToMove = oldCh[idxInOld];
|
|
648
657
|
if (elmToMove.$tag$ !== newStartVnode.$tag$) {
|
|
649
|
-
node = createElm(oldCh && oldCh[newStartIdx], newVNode2,
|
|
658
|
+
node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
|
|
650
659
|
} else {
|
|
651
660
|
patch(elmToMove, newStartVnode, isInitialRender);
|
|
652
661
|
oldCh[idxInOld] = void 0;
|
|
@@ -751,7 +760,10 @@ var markSlotContentForRelocation = (elm) => {
|
|
|
751
760
|
const slotName = childNode["s-sn"];
|
|
752
761
|
for (j = hostContentNodes.length - 1; j >= 0; j--) {
|
|
753
762
|
node = hostContentNodes[j];
|
|
754
|
-
if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] &&
|
|
763
|
+
if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && // let an exact named-slot match override a stale default-slot claim. Skip this for
|
|
764
|
+
// `slotName === ''` itself - a matched default node's cached `s-sn` is `''` too, which
|
|
765
|
+
// would trivially "match" on every re-render and force pointless re-insertion.
|
|
766
|
+
(!node["s-sh"] || node["s-sh"] !== childNode["s-hn"] || slotName !== "" && getSlotName(node) === slotName)) {
|
|
755
767
|
if (isNodeLocatedInSlot(node, slotName)) {
|
|
756
768
|
let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
|
|
757
769
|
checkSlotFallbackVisibility = true;
|
|
@@ -821,7 +833,7 @@ var insertBefore = (parent, newNode, reference, isInitialLoad) => {
|
|
|
821
833
|
return newNode;
|
|
822
834
|
}
|
|
823
835
|
}
|
|
824
|
-
if (parent.__insertBefore) {
|
|
836
|
+
if ((parent == null ? void 0 : parent.__insertBefore)) {
|
|
825
837
|
return parent.__insertBefore(newNode, reference);
|
|
826
838
|
} else {
|
|
827
839
|
return parent == null ? void 0 : parent.insertBefore(newNode, reference);
|