@diagrammo/dgmo 0.2.24 → 0.2.26

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.24",
3
+ "version": "0.2.26",
4
4
  "description": "DGMO diagram markup language — parser, renderer, and color system",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/sharing.ts CHANGED
@@ -47,13 +47,16 @@ export function encodeDiagramUrl(
47
47
  hash += `&tag=${encodeURIComponent(options.viewState.activeTagGroup)}`;
48
48
  }
49
49
 
50
- return { url: `${baseUrl}#${hash}` };
50
+ // Encode in both query param AND hash fragment — some share mechanisms
51
+ // strip one or the other (iOS share sheet strips #, AirDrop strips ?)
52
+ return { url: `${baseUrl}?${hash}#${hash}` };
51
53
  }
52
54
 
53
55
  /**
54
- * Decode a DGMO DSL string and view state from a URL hash.
56
+ * Decode a DGMO DSL string and view state from a URL query string or hash.
55
57
  * Accepts any of:
56
- * - `#dgmo=<payload>&tag=<name>`
58
+ * - `?dgmo=<payload>&tag=<name>`
59
+ * - `#dgmo=<payload>&tag=<name>` (backwards compat)
57
60
  * - `dgmo=<payload>`
58
61
  * - `<bare payload>`
59
62
  *
@@ -65,8 +68,8 @@ export function decodeDiagramUrl(hash: string): DecodedDiagramUrl {
65
68
 
66
69
  let raw = hash;
67
70
 
68
- // Strip leading '#'
69
- if (raw.startsWith('#')) {
71
+ // Strip leading '#' or '?'
72
+ if (raw.startsWith('#') || raw.startsWith('?')) {
70
73
  raw = raw.slice(1);
71
74
  }
72
75