view-contracts 0.5.15 → 0.5.17

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.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Contract-first UI design toolchain. Compiles restricted view-contract TSX to language-neutral View IR and renders platform targets (React, SwiftUI, Compose).
4
4
 
5
- **Version:** 0.5.15
5
+ **Version:** 0.5.17
6
6
 
7
7
  ## Table of Contents
8
8
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "view-contracts",
3
- "version": "0.5.15",
3
+ "version": "0.5.17",
4
4
  "description": "Contract-first UI design toolchain — restricted TSX to View IR to platform renderers",
5
5
  "type": "module",
6
6
  "bin": {
@@ -101,7 +101,7 @@
101
101
  "peerDependencies": {
102
102
  "react": "^18.0.0 || ^19.0.0",
103
103
  "react-dom": "^18.0.0 || ^19.0.0",
104
- "vite": "^6.4.5"
104
+ "vite": "^6.4.5 || ^7.3.7 || ^8.1.6"
105
105
  },
106
106
  "peerDependenciesMeta": {
107
107
  "vite": {
@@ -115,25 +115,23 @@
115
115
  }
116
116
  },
117
117
  "dependencies": {
118
- "commander": "^14.0.3",
119
118
  "esbuild": "^0.28.1",
120
- "handlebars": "^4.7.10",
121
- "js-yaml": "^4.3.2",
122
- "micro-contracts": "^0.17.10",
119
+ "micro-contracts": "^0.20.4",
123
120
  "react": "^18.0.0 || ^19.0.0",
124
121
  "react-dom": "^18.0.0 || ^19.0.0",
125
122
  "typescript": "^5.9.3"
126
123
  },
127
124
  "devDependencies": {
128
- "@types/handlebars": "^4.1.0",
129
125
  "@types/js-yaml": "^4.0.9",
130
126
  "@types/node": "^22.19.21",
131
127
  "@types/react": "^19.2.17",
132
128
  "@types/react-dom": "^19.2.3",
133
- "@vitejs/plugin-react": "^4.7.0",
129
+ "@vitejs/plugin-react": "^5.2.0",
134
130
  "ajv": "^8.18.0",
135
131
  "cli-contracts": "^0.35.0",
136
- "esbuild": "^0.28.0",
132
+ "commander": "^14.0.3",
133
+ "handlebars": "^4.7.10",
134
+ "js-yaml": "^4.3.2",
137
135
  "pixelmatch": "^8.0.0",
138
136
  "playwright": "^1.61.0",
139
137
  "pngjs": "^7.0.0",
@@ -14,8 +14,12 @@ export async function dispatchAction(action: DispatchableAction): Promise<void>
14
14
  return;
15
15
  }
16
16
  if (action.name === 'navigate' && typeof action.params?.to === 'string') {
17
- window.location.href = action.params.to;
18
- return;
17
+ // Only web destinations: a javascript: (or data:) URL from ViewModel data would run as script.
18
+ const target = new URL(action.params.to, window.location.href);
19
+ if (target.protocol === 'http:' || target.protocol === 'https:') {
20
+ window.location.href = target.href;
21
+ return;
22
+ }
19
23
  }
20
24
  window.dispatchEvent(new CustomEvent('view-contracts:action', { detail: action }));
21
25
  }
@@ -15,8 +15,12 @@ export async function dispatchAction(action: DispatchableAction): Promise<void>
15
15
  return;
16
16
  }
17
17
  if (action.name === 'navigate' && typeof action.params?.to === 'string') {
18
- window.location.href = action.params.to;
19
- return;
18
+ // Only web destinations: a javascript: (or data:) URL from ViewModel data would run as script.
19
+ const target = new URL(action.params.to, window.location.href);
20
+ if (target.protocol === 'http:' || target.protocol === 'https:') {
21
+ window.location.href = target.href;
22
+ return;
23
+ }
20
24
  }
21
25
  window.dispatchEvent(new CustomEvent('view-contracts:action', { detail: action }));
22
26
  }