@constela/compiler 0.8.0 → 0.9.0

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/dist/index.d.ts CHANGED
@@ -89,7 +89,7 @@ interface CompiledAction {
89
89
  name: string;
90
90
  steps: CompiledActionStep[];
91
91
  }
92
- type CompiledActionStep = CompiledSetStep | CompiledUpdateStep | CompiledFetchStep | CompiledStorageStep | CompiledClipboardStep | CompiledNavigateStep | CompiledImportStep | CompiledCallStep | CompiledSubscribeStep | CompiledDisposeStep | CompiledDomStep | CompiledIfStep;
92
+ type CompiledActionStep = CompiledSetStep | CompiledUpdateStep | CompiledSetPathStep | CompiledFetchStep | CompiledStorageStep | CompiledClipboardStep | CompiledNavigateStep | CompiledImportStep | CompiledCallStep | CompiledSubscribeStep | CompiledDisposeStep | CompiledDomStep | CompiledIfStep | CompiledSendStep | CompiledCloseStep;
93
93
  interface CompiledSetStep {
94
94
  do: 'set';
95
95
  target: string;
@@ -103,6 +103,12 @@ interface CompiledUpdateStep {
103
103
  index?: CompiledExpression;
104
104
  deleteCount?: CompiledExpression;
105
105
  }
106
+ interface CompiledSetPathStep {
107
+ do: 'setPath';
108
+ target: string;
109
+ path: CompiledExpression;
110
+ value: CompiledExpression;
111
+ }
106
112
  interface CompiledFetchStep {
107
113
  do: 'fetch';
108
114
  url: CompiledExpression;
@@ -196,6 +202,21 @@ interface CompiledIfStep {
196
202
  then: CompiledActionStep[];
197
203
  else?: CompiledActionStep[];
198
204
  }
205
+ /**
206
+ * Compiled send step - sends data through a named WebSocket connection
207
+ */
208
+ interface CompiledSendStep {
209
+ do: 'send';
210
+ connection: string;
211
+ data: CompiledExpression;
212
+ }
213
+ /**
214
+ * Compiled close step - closes a named WebSocket connection
215
+ */
216
+ interface CompiledCloseStep {
217
+ do: 'close';
218
+ connection: string;
219
+ }
199
220
  type CompiledNode = CompiledElementNode | CompiledTextNode | CompiledIfNode | CompiledEachNode | CompiledMarkdownNode | CompiledCodeNode | CompiledSlotNode;
200
221
  interface CompiledElementNode {
201
222
  kind: 'element';
@@ -434,4 +455,4 @@ declare function transformLayoutPass(layout: LayoutProgram, _context: LayoutAnal
434
455
  */
435
456
  declare function composeLayoutWithPage(layout: CompiledProgram, page: CompiledProgram, layoutParams?: Record<string, Expression>, slots?: Record<string, ViewNode>): CompiledProgram;
436
457
 
437
- export { type AnalysisContext, type AnalyzePassFailure, type AnalyzePassResult, type AnalyzePassSuccess, type CompileFailure, type CompileResult, type CompileSuccess, type CompiledAction, type CompiledActionStep, type CompiledBinExpr, type CompiledCallStep, type CompiledClipboardStep, type CompiledCodeNode, type CompiledCondExpr, type CompiledDataExpr, type CompiledDisposeStep, type CompiledDomStep, type CompiledEachNode, type CompiledElementNode, type CompiledEventHandler, type CompiledExpression, type CompiledFetchStep, type CompiledGetExpr, type CompiledIfNode, type CompiledIfStep, type CompiledImportExpr, type CompiledImportStep, type CompiledIndexExpr, type CompiledLayoutProgram, type CompiledLifecycleHooks, type CompiledLitExpr, type CompiledMarkdownNode, type CompiledNavigateStep, type CompiledNode, type CompiledNotExpr, type CompiledProgram, type CompiledRefExpr, type CompiledRouteDefinition, type CompiledRouteExpr, type CompiledSetStep, type CompiledSlotNode, type CompiledStateExpr, type CompiledStorageStep, type CompiledSubscribeStep, type CompiledTextNode, type CompiledUpdateStep, type CompiledVarExpr, type LayoutAnalysisContext, type LayoutAnalysisFailure, type LayoutAnalysisResult, type LayoutAnalysisSuccess, type ValidatePassFailure, type ValidatePassResult, type ValidatePassSuccess, analyzeLayoutPass, analyzePass, compile, composeLayoutWithPage, transformLayoutPass, transformPass, validatePass };
458
+ export { type AnalysisContext, type AnalyzePassFailure, type AnalyzePassResult, type AnalyzePassSuccess, type CompileFailure, type CompileResult, type CompileSuccess, type CompiledAction, type CompiledActionStep, type CompiledBinExpr, type CompiledCallStep, type CompiledClipboardStep, type CompiledCloseStep, type CompiledCodeNode, type CompiledCondExpr, type CompiledDataExpr, type CompiledDisposeStep, type CompiledDomStep, type CompiledEachNode, type CompiledElementNode, type CompiledEventHandler, type CompiledExpression, type CompiledFetchStep, type CompiledGetExpr, type CompiledIfNode, type CompiledIfStep, type CompiledImportExpr, type CompiledImportStep, type CompiledIndexExpr, type CompiledLayoutProgram, type CompiledLifecycleHooks, type CompiledLitExpr, type CompiledMarkdownNode, type CompiledNavigateStep, type CompiledNode, type CompiledNotExpr, type CompiledProgram, type CompiledRefExpr, type CompiledRouteDefinition, type CompiledRouteExpr, type CompiledSendStep, type CompiledSetPathStep, type CompiledSetStep, type CompiledSlotNode, type CompiledStateExpr, type CompiledStorageStep, type CompiledSubscribeStep, type CompiledTextNode, type CompiledUpdateStep, type CompiledVarExpr, type LayoutAnalysisContext, type LayoutAnalysisFailure, type LayoutAnalysisResult, type LayoutAnalysisSuccess, type ValidatePassFailure, type ValidatePassResult, type ValidatePassSuccess, analyzeLayoutPass, analyzePass, compile, composeLayoutWithPage, transformLayoutPass, transformPass, validatePass };
package/dist/index.js CHANGED
@@ -1216,6 +1216,15 @@ function transformActionStep(step) {
1216
1216
  }
1217
1217
  return updateStep;
1218
1218
  }
1219
+ case "setPath": {
1220
+ const setPathStep = step;
1221
+ return {
1222
+ do: "setPath",
1223
+ target: setPathStep.target,
1224
+ path: transformExpression(setPathStep.path, emptyContext),
1225
+ value: transformExpression(setPathStep.value, emptyContext)
1226
+ };
1227
+ }
1219
1228
  case "fetch": {
1220
1229
  const fetchStep = {
1221
1230
  do: "fetch",
@@ -1355,6 +1364,21 @@ function transformActionStep(step) {
1355
1364
  ...domStep.attribute && { attribute: domStep.attribute }
1356
1365
  };
1357
1366
  }
1367
+ case "send": {
1368
+ const sendStep = step;
1369
+ return {
1370
+ do: "send",
1371
+ connection: sendStep.connection,
1372
+ data: transformExpression(sendStep.data, emptyContext)
1373
+ };
1374
+ }
1375
+ case "close": {
1376
+ const closeStep = step;
1377
+ return {
1378
+ do: "close",
1379
+ connection: closeStep.connection
1380
+ };
1381
+ }
1358
1382
  }
1359
1383
  }
1360
1384
  function flattenSlotChildren(children, ctx) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@constela/compiler",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Compiler for Constela UI framework - AST to Program transformation",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -15,7 +15,7 @@
15
15
  "dist"
16
16
  ],
17
17
  "dependencies": {
18
- "@constela/core": "0.8.0"
18
+ "@constela/core": "0.9.0"
19
19
  },
20
20
  "devDependencies": {
21
21
  "@types/node": "^20.10.0",