@letsrunit/playwright 0.17.0 → 0.18.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/dist/index.d.ts CHANGED
@@ -67,7 +67,7 @@ declare const createFieldEngine: () => {
67
67
  };
68
68
 
69
69
  type SnapshotOptions = {
70
- /** Strip utility-framework classes (Tailwind, Bootstrap, UnoCSS, Windi) from the captured HTML. */
70
+ /** Strip utility-framework classes (Tailwind, Bootstrap, UnoCSS, Windi) from the captured HTML. Default: true. */
71
71
  dropUtilityClasses?: boolean;
72
72
  };
73
73
  declare function snapshot(page: Page, opts?: SnapshotOptions): Promise<Snapshot>;
@@ -131,7 +131,7 @@ type ScrubHtmlOptions = {
131
131
  /** Limit lists to max items: -1 mean no limit. Default: -1 */
132
132
  limitLists?: number;
133
133
  /** Strip utility-framework classes (Tailwind, Bootstrap, UnoCSS, Windi) from class
134
- * attributes. Removes the attribute entirely when all classes are stripped. Default: false */
134
+ * attributes. Removes the attribute entirely when all classes are stripped. Default: true */
135
135
  dropUtilityClasses?: boolean;
136
136
  };
137
137
  declare function scrubHtml(page: {
package/dist/index.js CHANGED
@@ -68703,7 +68703,7 @@ function getDefaults(contentLength) {
68703
68703
  dropComments: true,
68704
68704
  replaceBrInHeadings: true,
68705
68705
  limitLists: contentLength >= HTML_LIMIT_LISTS_THRESHOLD ? 20 : -1,
68706
- dropUtilityClasses: false
68706
+ dropUtilityClasses: true
68707
68707
  };
68708
68708
  }
68709
68709
  var ALLOWED_ATTRS = {
@@ -68978,10 +68978,21 @@ var UTILITY_STANDALONE = /* @__PURE__ */ new Set([
68978
68978
  "row",
68979
68979
  "col"
68980
68980
  ]);
68981
+ var SPACING_ALPHA_VALUES = /* @__PURE__ */ new Set(["auto", "px"]);
68982
+ function isSpacingUtility(token) {
68983
+ const match = token.match(/^-?([mp][xytblrse]?)-(.*)$/i);
68984
+ if (!match) return false;
68985
+ const value = match[2];
68986
+ if (!value) return false;
68987
+ if (/^[0-9./[\]-]+$/.test(value)) return true;
68988
+ if (SPACING_ALPHA_VALUES.has(value.toLowerCase())) return true;
68989
+ return false;
68990
+ }
68981
68991
  function isUtilityClass(token) {
68982
68992
  if (UTILITY_VARIANT_RE.test(token)) return true;
68983
68993
  const base = token.startsWith("-") ? token.slice(1) : token;
68984
68994
  if (UTILITY_STANDALONE.has(base)) return true;
68995
+ if (/^-?[mp][xytblrse]?-/i.test(token)) return isSpacingUtility(token);
68985
68996
  return UTILITY_PREFIX_RE.test(token);
68986
68997
  }
68987
68998
  function stripUtilityClasses(doc) {
@@ -69008,7 +69019,8 @@ async function snapshot(page, opts = {}) {
69008
69019
  await sleep(500);
69009
69020
  await waitForDomIdle(page);
69010
69021
  const [url, html, file] = await Promise.all([page.url(), getContentWithMarkedHidden(page), screenshot(page)]);
69011
- const finalHtml = opts.dropUtilityClasses ? await realScrubHtml({ html, url }, {
69022
+ const dropUtilityClasses = opts.dropUtilityClasses ?? true;
69023
+ const finalHtml = dropUtilityClasses ? await realScrubHtml({ html, url }, {
69012
69024
  dropHidden: false,
69013
69025
  dropHead: false,
69014
69026
  dropSvg: false,