@mgdis/core-ui-helpers 1.3.2 → 1.4.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.
@@ -375,8 +375,19 @@ const normalizeBooleanAttributes = (target) => {
375
375
  }
376
376
  };
377
377
 
378
+ /**
379
+ * A consumer unsets a Stencil `@Prop` as `null` (attribute removal), `undefined` (property
380
+ * binding) or `""` (framework reactivity). A `@Prop` initializer covers none of the three,
381
+ * so resolve the value before a `@Watch` validator rejects it.
382
+ * @param value - value received by the validator
383
+ * @param fallback - value to use when the prop is unset
384
+ * @returns the value, or the fallback when the prop is unset
385
+ */
386
+ const resolvePropValue = (value, fallback) => value === null || value === undefined || value === '' ? fallback : value;
387
+
378
388
  exports.cemGenerator = cemGenerator;
379
389
  exports.normalizeBooleanAttributes = normalizeBooleanAttributes;
390
+ exports.resolvePropValue = resolvePropValue;
380
391
  exports.vsCodeCssGenerator = vsCodeCssGenerator;
381
392
  exports.vsCodeGenerator = vsCodeGenerator;
382
393
  exports.webTypesGenerator = webTypesGenerator;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","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":";;AAAA;AACA;AACA;;AAWO,MAAM,aAAa,GAAG;AAC7B,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI;AAC5C,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;AAChC,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE;AAC9B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;ACNyB,IAAI,GAAG,CAAC,aAAa;;AC0I9C;;;;;AAKG;AACI,MAAM,eAAe,GAAG,CAAC,gBAAwB,EAAE,QAA4B,KAAwB;IAC5G,IAAI,CAAC,QAAQ,EAAE;QACb;IACF;IACA,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC;IACjC,OAAO,CAAA,EAAG,gBAAgB,CAAA,EAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA,MAAA,CAAQ;AACjF,CAAC;;ACtKD;;;;;AAKG;AACH,MAAM,aAAa,GAAG,CAAC,cAAsB,EAAE,QAA4B,KAAwB;IACjG,IAAI,CAAC,QAAQ,EAAE;QACb;IACF;AACA,IAAA,OAAO,CAAA,EAAG,cAAc,CAAA,EAAG,QAAQ,EAAE;AACvC,CAAC;AAED;;;;;;;;;;AA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AAC,GAAG,CAAC,CAAC,IAAI,MAAM;oBACvC,IAAI,EAAE,IAAI,CAAC,IAAI;oBACf,WAAW,EAAE,IAAI,CAAC,IAAI;AACvB,iBAAA,CAAC,CAAC;AACJ,aAAA;AACF,SAAA;AACD,QAAA,OAAO,EAAE;AACP,YAAA;AACE,gBAAA,IAAI,EAAE,2BAAoC;gBAC1C,IAAI,EAAE,SAAS,CAAC,GAAG;AACnB,gBAAA,WAAW,EAAE;AACX,oBAAA,IAAI,EAAE,SAAS;AACf,oBAAA,MAAM,EAAE,SAAS,CAAC,QAAQ,IAAI,EAAE;AACjC,iBAAA;AACF,aAAA;AACF,SAAA;KACF;AACH,CAAC;AAED;;;;;;;;AAQG;MACU,YAAY,GAAG,CAAC,QAAkB,MAAM;AACnD,IAAA,aAAa,EAAE,OAAO;AACtB,IAAA,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,iBAAiB,CAAC;AACpD,CAAA;;AC/FD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BG;AACI,MAAM,0BAA0B,GAAG,CAAC,MAAgC,KAAU;AACnF,IAAA,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QACxD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,CAAS,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;QAClF,IAAI,OAAQ,MAAkC,CAAC,QAAQ,CAAC,KAAK,SAAS,EAAE;YACtE,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;QAC5C;IACF;AACF;;;;;;","x_google_ignoreList":[0,1]}
1
+ {"version":3,"file":"index.cjs","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":";;AAAA;AACA;AACA;;AAWO,MAAM,aAAa,GAAG;AAC7B,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI;AAC5C,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;AAChC,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE;AAC9B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;ACNyB,IAAI,GAAG,CAAC,aAAa;;AC0I9C;;;;;AAKG;AACI,MAAM,eAAe,GAAG,CAAC,gBAAwB,EAAE,QAA4B,K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IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QACxD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,CAAS,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;QAClF,IAAI,OAAQ,MAAkC,CAAC,QAAQ,CAAC,KAAK,SAAS,EAAE;YACtE,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;QAC5C;IACF;AACF;;ACvCA;;;;;;;AAOG;AACI,MAAM,gBAAgB,GAAG,CAAI,KAAgC,EAAE,QAAW,KAC/E,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,GAAG,QAAQ,GAAG;;;;;;;","x_google_ignoreList":[0,1]}
@@ -219,4 +219,14 @@ declare const normalizeBooleanAttributes: (target: {
219
219
  element: HTMLElement;
220
220
  }) => void;
221
221
 
222
- export { cemGenerator, normalizeBooleanAttributes, vsCodeCssGenerator, vsCodeGenerator, webTypesGenerator };
222
+ /**
223
+ * A consumer unsets a Stencil `@Prop` as `null` (attribute removal), `undefined` (property
224
+ * binding) or `""` (framework reactivity). A `@Prop` initializer covers none of the three,
225
+ * so resolve the value before a `@Watch` validator rejects it.
226
+ * @param value - value received by the validator
227
+ * @param fallback - value to use when the prop is unset
228
+ * @returns the value, or the fallback when the prop is unset
229
+ */
230
+ declare const resolvePropValue: <T>(value: T | null | undefined | "", fallback: T) => T;
231
+
232
+ export { cemGenerator, normalizeBooleanAttributes, resolvePropValue, vsCodeCssGenerator, vsCodeGenerator, webTypesGenerator };
@@ -373,5 +373,15 @@ const normalizeBooleanAttributes = (target) => {
373
373
  }
374
374
  };
375
375
 
376
- export { cemGenerator, normalizeBooleanAttributes, vsCodeCssGenerator, vsCodeGenerator, webTypesGenerator };
376
+ /**
377
+ * A consumer unsets a Stencil `@Prop` as `null` (attribute removal), `undefined` (property
378
+ * binding) or `""` (framework reactivity). A `@Prop` initializer covers none of the three,
379
+ * so resolve the value before a `@Watch` validator rejects it.
380
+ * @param value - value received by the validator
381
+ * @param fallback - value to use when the prop is unset
382
+ * @returns the value, or the fallback when the prop is unset
383
+ */
384
+ const resolvePropValue = (value, fallback) => value === null || value === undefined || value === '' ? fallback : value;
385
+
386
+ export { cemGenerator, normalizeBooleanAttributes, resolvePropValue, vsCodeCssGenerator, vsCodeGenerator, webTypesGenerator };
377
387
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.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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AACf,oBAAA,MAAM,EAAE,SAAS,CAAC,QAAQ,IAAI,EAAE;AACjC,iBAAA;AACF,aAAA;AACF,SAAA;KACF;AACH,CAAC;AAED;;;;;;;;AAQG;MACU,YAAY,GAAG,CAAC,QAAkB,MAAM;AACnD,IAAA,aAAa,EAAE,OAAO;AACtB,IAAA,MAAM,EAAE,EAAE;IACV,OAAO,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,CAAC,iBAAiB,CAAC;AACpD,CAAA;;AC/FD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BG;AACI,MAAM,0BAA0B,GAAG,CAAC,MAAgC,KAAU;AACnF,IAAA,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QACxD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAC,EAAE,CAAS,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;QAClF,IAAI,OAAQ,MAAkC,CAAC,QAAQ,CAAC,KAAK,SAAS,EAAE;YACtE,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,CAAC;QAC5C;IACF;AACF;;","x_google_ignoreList":[0,1]}
1
+ {"version":3,"file":"index.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":"AAAA;AACA;AACA;;AAWO,MAAM,aAAa,GAAG;AAC7B,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE,IAAI;AAC5C,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM;AAChC,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE;AAC9B;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;;ACNyB,IAAI,GAAG,CAAC,aAAa;;AC0I9C;;;;;AAKG;AACI,MAAM,eAAe,GAAG,CAAC,gBAAwB,EAAE,QAA4B,KAAwB;IAC5G,IAAI,CAAC,QAAQ,EAAE;QACb;IACF;IACA,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC;IACjC,OAAO,CAAA,EAAG,gBAAgB,CAAA,EAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA,MAAA,CAAQ;AACjF,CAAC;;ACtKD;;;;;AAKG;AACH,MAAM,aAAa,GA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AAC,IAAI,EAAE,EAAE,CAAC;QAC5C;IACF;AACF;;ACvCA;;;;;;;AAOG;AACI,MAAM,gBAAgB,GAAG,CAAI,KAAgC,EAAE,QAAW,KAC/E,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,GAAG,QAAQ,GAAG;;","x_google_ignoreList":[0,1]}
@@ -379,8 +379,19 @@
379
379
  }
380
380
  };
381
381
 
382
+ /**
383
+ * A consumer unsets a Stencil `@Prop` as `null` (attribute removal), `undefined` (property
384
+ * binding) or `""` (framework reactivity). A `@Prop` initializer covers none of the three,
385
+ * so resolve the value before a `@Watch` validator rejects it.
386
+ * @param value - value received by the validator
387
+ * @param fallback - value to use when the prop is unset
388
+ * @returns the value, or the fallback when the prop is unset
389
+ */
390
+ const resolvePropValue = (value, fallback) => value === null || value === undefined || value === '' ? fallback : value;
391
+
382
392
  exports.cemGenerator = cemGenerator;
383
393
  exports.normalizeBooleanAttributes = normalizeBooleanAttributes;
394
+ exports.resolvePropValue = resolvePropValue;
384
395
  exports.vsCodeCssGenerator = vsCodeCssGenerator;
385
396
  exports.vsCodeGenerator = vsCodeGenerator;
386
397
  exports.webTypesGenerator = webTypesGenerator;
@@ -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,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAA,MAAA,CAAQ;EACjF,CAAC;;ECtKD;;;;;EAKG;EACH,MAAM,aAAa,GAAG,CAAC,cAAsB,EAAE,QAA4B,KAAwB;MACjG,IAAI,CAAC,QAAQ,EAAE;UAC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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;;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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;;;;;;;;;;;;;;;;;;;;;;;;;EA+BG;AACI,QAAM,0BAA0B,GAAG,CAAC,MAAgC,KAAU;EACnF,IAAA,KAAK,MAAM,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;UACxD,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,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;;ECvCA;;;;;;;EAOG;AACI,QAAM,gBAAgB,GAAG,CAAI,KAAgC,EAAE,QAAW,KAC/E,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,GAAG,QAAQ,GAAG;;;;;;;;;","x_google_ignoreList":[0,1]}
@@ -6,7 +6,7 @@ var BUILD = {
6
6
  slotRelocation: true};
7
7
 
8
8
  /*
9
- Stencil Client Platform v4.43.5 | MIT Licensed | https://stenciljs.com
9
+ Stencil Client Platform v4.45.1 | MIT 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.childNodes, hostName, slotName)];
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;
@@ -338,7 +344,7 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
338
344
  }
339
345
  }
340
346
  if (newValue == null || newValue === false) {
341
- if (newValue !== false || elm.getAttribute(memberName) === "") {
347
+ if (newValue !== false || elm.getAttribute(memberName) === "" || flags & 4 /* isHost */ && !isEnumeratedAttribute(memberName)) {
342
348
  if (xlink) {
343
349
  elm.removeAttributeNS(XLINK_NS, memberName);
344
350
  } else {
@@ -355,6 +361,8 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags, initialRen
355
361
  }
356
362
  }
357
363
  };
364
+ var ENUMERATED_ATTRIBUTES = /* @__PURE__ */ new Set(["draggable", "contenteditable", "spellcheck"]);
365
+ var isEnumeratedAttribute = (attrName) => ENUMERATED_ATTRIBUTES.has(attrName) || attrName.startsWith("aria-");
358
366
  var parseClassListRegex = /\s/;
359
367
  var parseClassList = (value) => {
360
368
  if (typeof value === "object" && value && "baseVal" in value) {
@@ -646,7 +654,7 @@ var updateChildren = (parentElm, oldCh, newVNode2, newCh, isInitialRender = fals
646
654
  if (idxInOld >= 0) {
647
655
  elmToMove = oldCh[idxInOld];
648
656
  if (elmToMove.$tag$ !== newStartVnode.$tag$) {
649
- node = createElm(oldCh && oldCh[newStartIdx], newVNode2, idxInOld);
657
+ node = createElm(oldCh && oldCh[newStartIdx], newVNode2, newStartIdx);
650
658
  } else {
651
659
  patch(elmToMove, newStartVnode, isInitialRender);
652
660
  oldCh[idxInOld] = void 0;
@@ -751,7 +759,10 @@ var markSlotContentForRelocation = (elm) => {
751
759
  const slotName = childNode["s-sn"];
752
760
  for (j = hostContentNodes.length - 1; j >= 0; j--) {
753
761
  node = hostContentNodes[j];
754
- if (!node["s-cn"] && !node["s-nr"] && node["s-hn"] !== childNode["s-hn"] && (!node["s-sh"] || node["s-sh"] !== childNode["s-hn"])) {
762
+ 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
763
+ // `slotName === ''` itself - a matched default node's cached `s-sn` is `''` too, which
764
+ // would trivially "match" on every re-render and force pointless re-insertion.
765
+ (!node["s-sh"] || node["s-sh"] !== childNode["s-hn"] || slotName !== "" && getSlotName(node) === slotName)) {
755
766
  if (isNodeLocatedInSlot(node, slotName)) {
756
767
  let relocateNodeData = relocateNodes.find((r) => r.$nodeToRelocate$ === node);
757
768
  checkSlotFallbackVisibility = true;
@@ -821,7 +832,7 @@ var insertBefore = (parent, newNode, reference, isInitialLoad) => {
821
832
  return newNode;
822
833
  }
823
834
  }
824
- if (parent.__insertBefore) {
835
+ if ((parent == null ? void 0 : parent.__insertBefore)) {
825
836
  return parent.__insertBefore(newNode, reference);
826
837
  } else {
827
838
  return parent == null ? void 0 : parent.insertBefore(newNode, reference);