@pairdraw/dom-css 0.16.1 → 0.17.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.
@@ -476,8 +476,15 @@ function modeValue(variable, value, modeId, names, variables) {
476
476
  function block(selector, declarations, indent = "") {
477
477
  return `${indent}${selector} {\n${declarations.map(({ name, value }) => `${indent} --${name}: ${value};`).join("\n")}\n${indent}}`;
478
478
  }
479
+ /**
480
+ * A comment naming `text`. Collection and mode names are the person's own text, so a `*` before
481
+ * a `/` in them is spaced apart, which keeps a name from ending the comment and writing rules.
482
+ */
483
+ function cssComment(text) {
484
+ return `/* ${text.replaceAll("*/", "* /")} */`;
485
+ }
479
486
  function modeBlock(scope) {
480
- const comment = `/* ${scope.collection.name}: ${scope.mode.name} */`;
487
+ const comment = cssComment(`${scope.collection.name}: ${scope.mode.name}`);
481
488
  if (!isAtRuleCondition(scope.condition)) return `${comment}\n${block(scope.condition, scope.declarations)}`;
482
489
  return `${comment}\n${scope.condition} {\n${block(":root", scope.declarations, " ")}\n}`;
483
490
  }