@delopay/sdk 0.361.0 → 0.362.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.
@@ -34285,10 +34285,13 @@ declare function enigmaNamesInside(settings: EnigmaCardFormSettings): boolean;
34285
34285
  * Only names, ids, classes,
34286
34286
  * spaces, `>` and a few states as selectors; only colours, borders, type,
34287
34287
  * spacing, sizes and simple layout as properties, at values that keep every
34288
- * card field and the "Save card" box visible and in place. The router decides.
34288
+ * card field and the "Save card" box visible and in place. No quotes. A
34289
+ * declaration sits in a rule, never directly in `@media` or outside any block;
34290
+ * no rule is nested in another, and no brace or `;` sits inside brackets.
34291
+ * The router decides.
34289
34292
  */
34290
34293
  declare function enigmaCustomCssProblem(css: string): EnigmaCustomCssProblem | null;
34291
- type EnigmaCustomCssProblem = 'too_long' | 'not_ascii' | 'markup' | 'escape' | 'comment' | 'loads_resource' | 'script' | 'at_rule' | 'selector' | 'property' | 'variable' | 'important_display' | 'hides_field' | 'unbalanced';
34294
+ type EnigmaCustomCssProblem = 'too_long' | 'not_ascii' | 'markup' | 'escape' | 'quote' | 'comment' | 'loads_resource' | 'script' | 'at_rule' | 'selector' | 'property' | 'variable' | 'important_display' | 'hides_field' | 'unbalanced' | 'misplaced';
34292
34295
  /** A corner's px, as the router draws it. */
34293
34296
  declare function enigmaCornerPx(corner: EnigmaCorner): number;
34294
34297
  /**
@@ -34285,10 +34285,13 @@ declare function enigmaNamesInside(settings: EnigmaCardFormSettings): boolean;
34285
34285
  * Only names, ids, classes,
34286
34286
  * spaces, `>` and a few states as selectors; only colours, borders, type,
34287
34287
  * spacing, sizes and simple layout as properties, at values that keep every
34288
- * card field and the "Save card" box visible and in place. The router decides.
34288
+ * card field and the "Save card" box visible and in place. No quotes. A
34289
+ * declaration sits in a rule, never directly in `@media` or outside any block;
34290
+ * no rule is nested in another, and no brace or `;` sits inside brackets.
34291
+ * The router decides.
34289
34292
  */
34290
34293
  declare function enigmaCustomCssProblem(css: string): EnigmaCustomCssProblem | null;
34291
- type EnigmaCustomCssProblem = 'too_long' | 'not_ascii' | 'markup' | 'escape' | 'comment' | 'loads_resource' | 'script' | 'at_rule' | 'selector' | 'property' | 'variable' | 'important_display' | 'hides_field' | 'unbalanced';
34294
+ type EnigmaCustomCssProblem = 'too_long' | 'not_ascii' | 'markup' | 'escape' | 'quote' | 'comment' | 'loads_resource' | 'script' | 'at_rule' | 'selector' | 'property' | 'variable' | 'important_display' | 'hides_field' | 'unbalanced' | 'misplaced';
34292
34295
  /** A corner's px, as the router draws it. */
34293
34296
  declare function enigmaCornerPx(corner: EnigmaCorner): number;
34294
34297
  /**
package/dist/index.cjs CHANGED
@@ -12664,6 +12664,7 @@ function enigmaCustomCssProblem(css) {
12664
12664
  if (/[^\x20-\x7e\n\r\t]/.test(css)) return "not_ascii";
12665
12665
  if (css.includes("<")) return "markup";
12666
12666
  if (css.includes("\\")) return "escape";
12667
+ if (/["']/.test(css)) return "quote";
12667
12668
  const lower = css.toLowerCase();
12668
12669
  if (lower.includes("/*")) return "comment";
12669
12670
  if (["url(", "image-set(", "image(", "element(", "cross-fade(", "src(", "data:"].some(
@@ -12679,9 +12680,19 @@ function enigmaCustomCssProblem(css) {
12679
12680
  if (/@(?!media)/.test(lower)) return "at_rule";
12680
12681
  const compact = lower.split(/\s+/).filter(Boolean).join(" ");
12681
12682
  const blocks = [];
12683
+ const brackets = [];
12682
12684
  let text = "";
12683
12685
  for (const ch of compact) {
12684
- if (ch === "{") {
12686
+ if ((ch === "{" || ch === "}" || ch === ";") && brackets.length > 0) return "misplaced";
12687
+ if (ch === "(" || ch === "[") {
12688
+ brackets.push(ch);
12689
+ text += ch;
12690
+ } else if (ch === ")" || ch === "]") {
12691
+ if (brackets.pop() !== (ch === ")" ? "(" : "[")) return "unbalanced";
12692
+ text += ch;
12693
+ } else if (ch === "{") {
12694
+ const outer = blocks[blocks.length - 1];
12695
+ if (outer && !outer.media) return "misplaced";
12685
12696
  const prelude = text.trim();
12686
12697
  text = "";
12687
12698
  const media = prelude.startsWith("@media");
@@ -12696,9 +12707,11 @@ function enigmaCustomCssProblem(css) {
12696
12707
  const top = blocks[blocks.length - 1];
12697
12708
  if (!top) {
12698
12709
  if (ch === "}") return "unbalanced";
12710
+ if (declaration.trim()) return "misplaced";
12699
12711
  continue;
12700
12712
  }
12701
- if (!top.media && declaration.trim()) {
12713
+ if (declaration.trim()) {
12714
+ if (top.media) return "misplaced";
12702
12715
  const problem = declarationProblem(top.selector.replace(/, /g, ","), declaration);
12703
12716
  if (problem) return problem;
12704
12717
  }
@@ -12707,7 +12720,8 @@ function enigmaCustomCssProblem(css) {
12707
12720
  text += ch;
12708
12721
  }
12709
12722
  }
12710
- return blocks.length > 0 ? "unbalanced" : null;
12723
+ if (blocks.length > 0 || brackets.length > 0) return "unbalanced";
12724
+ return text.trim() ? "misplaced" : null;
12711
12725
  }
12712
12726
  function enigmaCornerPx(corner) {
12713
12727
  return { square: 0, small: 6, medium: 8, large: 12, pill: 22 }[corner];