@molecule/app-ui-angular 1.4.0 → 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-11-22T17:17:46.154Z
6
+ Generated: 2026-11-22T22:19:52.023Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-ui-angular
@@ -15944,7 +15944,9 @@ function kebab(key: string): string
15944
15944
  Serializes a React-style style object the way React writes it to the DOM:
15945
15945
  camelCase keys become kebab-case, numbers gain `px` unless the property is
15946
15946
  unitless, and declaration order follows object key order (the conformance
15947
- normalizer sorts declarations anyway).
15947
+ normalizer sorts declarations anyway). A shorthand and a longhand it covers
15948
+ that Angular's sorted style binding would apply out of order come back
15949
+ resolved, as the CSSOM applies them in object order.
15948
15950
 
15949
15951
  ```typescript
15950
15952
  function styleText(style: Record<string, unknown> | undefined | null): string | null
@@ -14,7 +14,9 @@ export declare const kebab: (key: string) => string;
14
14
  * Serializes a React-style style object the way React writes it to the DOM:
15
15
  * camelCase keys become kebab-case, numbers gain `px` unless the property is
16
16
  * unitless, and declaration order follows object key order (the conformance
17
- * normalizer sorts declarations anyway).
17
+ * normalizer sorts declarations anyway). A shorthand and a longhand it covers
18
+ * that Angular's sorted style binding would apply out of order come back
19
+ * resolved, as the CSSOM applies them in object order.
18
20
  *
19
21
  * @param style - The style object (or undefined).
20
22
  * @returns The `style` attribute text, or null when there is nothing to set.
@@ -1 +1 @@
1
- {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../src/utilities/style.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAuDH;;;;;GAKG;AACH,eAAO,MAAM,KAAK,GAAI,KAAK,MAAM,KAAG,MAC8C,CAAA;AAElF;;;;;;;;GAQG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAU1F"}
1
+ {"version":3,"file":"style.d.ts","sourceRoot":"","sources":["../../src/utilities/style.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAuDH;;;;;GAKG;AACH,eAAO,MAAM,KAAK,GAAI,KAAK,MAAM,KAAG,MAC8C,CAAA;AAiElF;;;;;;;;;;GAUG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAW1F"}
@@ -62,11 +62,75 @@ const UNITLESS = new Set([
62
62
  * @returns The kebab-case CSS property name.
63
63
  */
64
64
  export const kebab = (key) => key.startsWith('--') ? key : key.replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`);
65
+ /** The longhands each property name sets, read from the CSSOM once per name. */
66
+ const longhandCache = new Map();
67
+ /** One scratch declaration block per document, reused by every call. */
68
+ const probes = new WeakMap();
69
+ /**
70
+ * The longhand properties a declaration sets: itself for a longhand, every one it expands to for
71
+ * a shorthand (`gap` → `row-gap`, `column-gap`).
72
+ *
73
+ * @param probe - A scratch declaration block.
74
+ * @param name - The kebab-case property name.
75
+ * @param value - Its value (a name the CSSOM rejects with it is read again with the next value).
76
+ * @returns The longhand names.
77
+ */
78
+ const longhandsOf = (probe, name, value) => {
79
+ const known = longhandCache.get(name);
80
+ if (known)
81
+ return known;
82
+ probe.cssText = '';
83
+ probe.setProperty(name, value);
84
+ const names = Array.from({ length: probe.length }, (_, i) => probe.item(i));
85
+ if (names.length)
86
+ longhandCache.set(name, names);
87
+ return names.length ? names : [name];
88
+ };
89
+ /**
90
+ * The declarations as the DOM resolves them in this order, when a shorthand and a longhand it
91
+ * covers both appear and their names sort the other way round: Angular's `[style]` binding keeps
92
+ * its declarations sorted by property name, so `gap: 9px; column-gap: 3px` would reach the
93
+ * element as `column-gap` then `gap`, and `gap` would erase the column gap a browser (and React,
94
+ * which writes in object order) keeps. Resolved through the CSSOM, the text holds each longhand
95
+ * once and any order applies it the same way. Null when nothing overlaps, or with no DOM.
96
+ *
97
+ * @param parts - `[name, value]` pairs in object order.
98
+ * @returns The resolved declaration text, or null.
99
+ */
100
+ const resolvedOverlaps = (parts) => {
101
+ if (parts.length < 2 || typeof document === 'undefined')
102
+ return null;
103
+ let probe = probes.get(document);
104
+ if (!probe) {
105
+ probe = document.createElement('div').style;
106
+ probes.set(document, probe);
107
+ }
108
+ const seen = new Map();
109
+ let inverted = false;
110
+ for (const [name, value] of parts) {
111
+ if (name.startsWith('--'))
112
+ continue;
113
+ for (const longhand of longhandsOf(probe, name, value)) {
114
+ const earlier = seen.get(longhand);
115
+ if (earlier !== undefined && earlier !== name && earlier > name)
116
+ inverted = true;
117
+ seen.set(longhand, name);
118
+ }
119
+ }
120
+ if (!inverted)
121
+ return null;
122
+ probe.cssText = '';
123
+ for (const [name, value] of parts)
124
+ probe.setProperty(name, value);
125
+ return probe.cssText.replace(/;\s*$/, '') || null;
126
+ };
65
127
  /**
66
128
  * Serializes a React-style style object the way React writes it to the DOM:
67
129
  * camelCase keys become kebab-case, numbers gain `px` unless the property is
68
130
  * unitless, and declaration order follows object key order (the conformance
69
- * normalizer sorts declarations anyway).
131
+ * normalizer sorts declarations anyway). A shorthand and a longhand it covers
132
+ * that Angular's sorted style binding would apply out of order come back
133
+ * resolved, as the CSSOM applies them in object order.
70
134
  *
71
135
  * @param style - The style object (or undefined).
72
136
  * @returns The `style` attribute text, or null when there is nothing to set.
@@ -79,8 +143,10 @@ export function styleText(style) {
79
143
  if (value === null || value === undefined || value === false)
80
144
  continue;
81
145
  const text = typeof value === 'number' ? (UNITLESS.has(key) ? String(value) : `${value}px`) : String(value);
82
- parts.push(`${kebab(key)}: ${text}`);
146
+ parts.push([kebab(key), text]);
83
147
  }
84
- return parts.length ? parts.join('; ') : null;
148
+ if (!parts.length)
149
+ return null;
150
+ return resolvedOverlaps(parts) ?? parts.map(([name, text]) => `${name}: ${text}`).join('; ');
85
151
  }
86
152
  //# sourceMappingURL=style.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"style.js","sourceRoot":"","sources":["../../src/utilities/style.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;GAGG;AACH,MAAM,QAAQ,GAAG,IAAI,GAAG,CAAC;IACvB,yBAAyB;IACzB,aAAa;IACb,mBAAmB;IACnB,kBAAkB;IAClB,kBAAkB;IAClB,SAAS;IACT,cAAc;IACd,iBAAiB;IACjB,aAAa;IACb,SAAS;IACT,MAAM;IACN,UAAU;IACV,cAAc;IACd,YAAY;IACZ,cAAc;IACd,WAAW;IACX,UAAU;IACV,SAAS;IACT,YAAY;IACZ,aAAa;IACb,cAAc;IACd,YAAY;IACZ,eAAe;IACf,gBAAgB;IAChB,iBAAiB;IACjB,YAAY;IACZ,WAAW;IACX,YAAY;IACZ,SAAS;IACT,OAAO;IACP,SAAS;IACT,OAAO;IACP,SAAS;IACT,QAAQ;IACR,QAAQ;IACR,MAAM;IACN,4BAA4B;IAC5B,YAAY;IACZ,cAAc;IACd,WAAW;IACX,eAAe;IACf,cAAc;IACd,kBAAkB;IAClB,+BAA+B;IAC/B,eAAe;IACf,iBAAiB;CAClB,CAAC,CAAA;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,GAAW,EAAU,EAAE,CAC3C,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAElF;;;;;;;;GAQG;AACH,MAAM,UAAU,SAAS,CA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
+ "version": "1.4.1",
4
4
  "description": "Angular UI components for molecule.dev",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -58,7 +58,7 @@
58
58
  "@molecule/app-icons": "1.0.4",
59
59
  "@testing-library/dom": "10.4.2",
60
60
  "@types/node": "26.6.5",
61
- "jsdom": "30.1.3",
61
+ "jsdom": "31.0.1",
62
62
  "rxjs": "7.8.2",
63
63
  "typescript": "6.0.3",
64
64
  "vitest": "4.1.12",