@diagrammo/dgmo 0.2.23 → 0.2.25

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": "@diagrammo/dgmo",
3
- "version": "0.2.23",
3
+ "version": "0.2.25",
4
4
  "description": "DGMO diagram markup language — parser, renderer, and color system",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -186,7 +186,10 @@ function fitTextToNode(label: string, nodeWidth: number, nodeHeight: number): Fi
186
186
  return { lines: camelLines, fontSize };
187
187
  }
188
188
 
189
- // Lines don't fit try hard-breaking long words
189
+ // If not at minimum font size yet, try shrinking before hard-breaking
190
+ if (fontSize > MIN_NODE_FONT_SIZE) continue;
191
+
192
+ // At minimum font size — hard-break as last resort
190
193
  const hardLines: string[] = [];
191
194
  for (const line of camelLines) {
192
195
  if (line.length <= maxCharsPerLine) {
package/src/sharing.ts CHANGED
@@ -47,13 +47,14 @@ export function encodeDiagramUrl(
47
47
  hash += `&tag=${encodeURIComponent(options.viewState.activeTagGroup)}`;
48
48
  }
49
49
 
50
- return { url: `${baseUrl}#${hash}` };
50
+ return { url: `${baseUrl}?${hash}` };
51
51
  }
52
52
 
53
53
  /**
54
- * Decode a DGMO DSL string and view state from a URL hash.
54
+ * Decode a DGMO DSL string and view state from a URL query string or hash.
55
55
  * Accepts any of:
56
- * - `#dgmo=<payload>&tag=<name>`
56
+ * - `?dgmo=<payload>&tag=<name>`
57
+ * - `#dgmo=<payload>&tag=<name>` (backwards compat)
57
58
  * - `dgmo=<payload>`
58
59
  * - `<bare payload>`
59
60
  *
@@ -65,8 +66,8 @@ export function decodeDiagramUrl(hash: string): DecodedDiagramUrl {
65
66
 
66
67
  let raw = hash;
67
68
 
68
- // Strip leading '#'
69
- if (raw.startsWith('#')) {
69
+ // Strip leading '#' or '?'
70
+ if (raw.startsWith('#') || raw.startsWith('?')) {
70
71
  raw = raw.slice(1);
71
72
  }
72
73