@jxsuite/parser 1.7.0 → 1.8.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jxsuite/parser",
3
- "version": "1.7.0",
3
+ "version": "1.8.1",
4
4
  "description": "Jx markdown parser and external class integration",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -48,8 +48,8 @@
48
48
  "upgrade": "bun update --latest && bun install"
49
49
  },
50
50
  "dependencies": {
51
- "@jxsuite/markup": "^0.4.9",
52
- "@jxsuite/schema": "^2.1.0",
51
+ "@jxsuite/markup": "^0.4.10",
52
+ "@jxsuite/schema": "^2.2.0",
53
53
  "@shikijs/langs": "^4.4.3",
54
54
  "@shikijs/themes": "^4.4.3",
55
55
  "glob": "^13.0.6",
@@ -63,11 +63,11 @@
63
63
  "shiki": "^4.4.3",
64
64
  "unified": "^11.0.5",
65
65
  "unist-util-visit": "^5.1.0",
66
- "yaml": "^2.9.0"
66
+ "yaml": "^2.9.1"
67
67
  },
68
68
  "devDependencies": {
69
- "@happy-dom/global-registrator": "^20.12.0",
70
- "@jxsuite/runtime": "^3.1.0",
69
+ "@happy-dom/global-registrator": "^20.14.5",
70
+ "@jxsuite/runtime": "^4.0.1",
71
71
  "@types/mdast": "^4.0.4",
72
72
  "ajv": "^8.20.0"
73
73
  },
@@ -16,7 +16,7 @@
16
16
 
17
17
  "$studio": {
18
18
  "settings": {
19
- "icon": "sp-icon-view-grid",
19
+ "icon": "grid-four",
20
20
  "label": "Content Types",
21
21
  "order": 50,
22
22
  "layout": "map",
package/src/transpile.ts CHANGED
@@ -136,7 +136,14 @@ export function collapseDotPaths(obj: Record<string, unknown>) {
136
136
  return result;
137
137
  }
138
138
 
139
- /** CSS pseudo-class / pseudo-element names (keys that become `:` prefixed in style objects). */
139
+ /**
140
+ * CSS pseudo-CLASS names — keys that become `:` prefixed in style objects.
141
+ *
142
+ * `before` and `after` are pseudo-_elements_ and belong in the set below on the modern spelling,
143
+ * but they have been written with one colon since this file existed and CSS still accepts that
144
+ * form. Moving them would rewrite every `.md` component in the repo for no behaviour change, so
145
+ * they stay here; {@link CSS_PSEUDO_ELEMENTS} is for names that have never had a one-colon form.
146
+ */
140
147
  const CSS_PSEUDO_NAMES = new Set([
141
148
  "hover",
142
149
  "focus",
@@ -156,8 +163,24 @@ const CSS_PSEUDO_NAMES = new Set([
156
163
  "selection",
157
164
  "before",
158
165
  "after",
166
+ // The overlay states. Without these an author could declare a popover in a `.md` component and
167
+ // Have no way to style it open — `style.popover-open.opacity` fell through unmapped, and
168
+ // `collectStyles` then read the bare key as a DESCENDANT TYPE SELECTOR, emitting
169
+ // `#panel popover-open { … }`: a rule that matches nothing, with nothing to say it does not.
170
+ "popover-open",
171
+ "open",
172
+ "modal",
159
173
  ]);
160
174
 
175
+ /**
176
+ * CSS pseudo-ELEMENT names — keys that become `::` prefixed.
177
+ *
178
+ * A separate set because the prefix is different, not because the concept is. `backdrop` is the
179
+ * only member today and it is the one a popover needs: there is no one-colon form of it, so the
180
+ * single-colon set above could not have carried it.
181
+ */
182
+ const CSS_PSEUDO_ELEMENTS = new Set(["backdrop"]);
183
+
161
184
  /**
162
185
  * Apply CSS pseudo-class and media query key mapping to a style object's top-level keys.
163
186
  *
@@ -171,7 +194,9 @@ const CSS_PSEUDO_NAMES = new Set([
171
194
  export function applyStyleKeyMapping(styleObj: Record<string, unknown>) {
172
195
  const result: Record<string, unknown> = {};
173
196
  for (const [key, value] of Object.entries(styleObj)) {
174
- if (CSS_PSEUDO_NAMES.has(key)) {
197
+ if (CSS_PSEUDO_ELEMENTS.has(key)) {
198
+ result[`::${key}`] = value;
199
+ } else if (CSS_PSEUDO_NAMES.has(key)) {
175
200
  result[`:${key}`] = value;
176
201
  } else if (key.startsWith("--")) {
177
202
  result[`@${key}`] = value;
@@ -208,7 +233,11 @@ export function collapseStylePaths(styleObj: Record<string, unknown>) {
208
233
  const normalized: Record<string, unknown> = {};
209
234
 
210
235
  for (const [key, value] of Object.entries(styleObj)) {
211
- if (key.startsWith(":") && CSS_PSEUDO_NAMES.has(key.slice(1))) {
236
+ /* `::` before `:`, or a pseudo-element would match the pseudo-class arm on its second colon
237
+ and be re-emitted with one colon. */
238
+ if (key.startsWith("::") && CSS_PSEUDO_ELEMENTS.has(key.slice(2))) {
239
+ normalized[key.slice(2)] = value;
240
+ } else if (key.startsWith(":") && CSS_PSEUDO_NAMES.has(key.slice(1))) {
212
241
  normalized[key.slice(1)] = value;
213
242
  } else if (key.startsWith("@--")) {
214
243
  normalized[key.slice(1)] = value;
@@ -730,10 +759,11 @@ export function transpileJxMarkdown(source: string) {
730
759
  * search deep links (specs/parser.md).
731
760
  *
732
761
  * **NFC first, and that is the whole point of the change** (UAX #15). "Café" typed on macOS is `e`
733
- * + U+0301; the same word typed on Windows, or pasted from a web page, is U+00E9. They look
734
- * identical, they compare unequal, and they produced two different anchors — so a link written
735
- * against one heading silently stopped working when someone re-typed the heading. Normalizing puts
736
- * both spellings in one form before anything else looks at them.
762
+ *
763
+ * - U+0301; the same word typed on Windows, or pasted from a web page, is U+00E9. They look
764
+ * identical, they compare unequal, and they produced two different anchors — so a link written
765
+ * against one heading silently stopped working when someone re-typed the heading. Normalizing
766
+ * puts both spellings in one form before anything else looks at them.
737
767
  *
738
768
  * **`toLowerCase`, never `toLocaleLowerCase`.** Locale-sensitive casing would make the same heading
739
769
  * produce different anchors in different projects — Turkish maps `I` to `ı`, not `i` — and an