@jay-framework/fullstack-component 0.15.5 → 0.15.6

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
@@ -88,6 +88,19 @@ interface Redirect3xx {
88
88
  location: string;
89
89
  message?: string;
90
90
  }
91
+ /**
92
+ * A tag to inject into the HTML <head> during SSR (Design Log #127).
93
+ * Components return these from phaseOutput() to control page metadata (title, meta, link, etc.).
94
+ * Head tags are SSR-only — not hydrated on the client.
95
+ */
96
+ interface HeadTag {
97
+ /** Element name, e.g. 'title', 'meta', 'link' */
98
+ tag: string;
99
+ /** HTML attributes, e.g. { name: 'description', content: '...' } */
100
+ attrs?: Record<string, string>;
101
+ /** Text content, e.g. 'My Page Title' for <title> */
102
+ children?: string;
103
+ }
91
104
  /**
92
105
  * Successful output of a rendering phase.
93
106
  * Contains the rendered ViewState and data to carry forward to the next phase.
@@ -96,6 +109,8 @@ interface PhaseOutput<ViewState extends object, CarryForward = {}> {
96
109
  kind: 'PhaseOutput';
97
110
  rendered: ViewState;
98
111
  carryForward: CarryForward;
112
+ /** Tags to inject into <head> during SSR (Design Log #127). */
113
+ headTags?: HeadTag[];
99
114
  }
100
115
  /**
101
116
  * @deprecated Use PhaseOutput instead. PartialRender is kept for backwards compatibility.
@@ -181,8 +196,11 @@ declare function forbidden(message?: string, details?: Record<string, unknown>):
181
196
  declare function redirect3xx(status: number, location: string, message?: string): Redirect3xx;
182
197
  /**
183
198
  * Create a successful phase output with rendered ViewState and carry-forward data.
199
+ * Optionally include head tags to inject into <head> during SSR (Design Log #127).
184
200
  */
185
- declare function phaseOutput<ViewState extends object, CarryForward = {}>(rendered: ViewState, carryForward: CarryForward): PhaseOutput<ViewState, CarryForward>;
201
+ declare function phaseOutput<ViewState extends object, CarryForward = {}>(rendered: ViewState, carryForward: CarryForward, options?: {
202
+ headTags?: HeadTag[];
203
+ }): PhaseOutput<ViewState, CarryForward>;
186
204
  /**
187
205
  * @deprecated Use phaseOutput instead. Kept for backwards compatibility.
188
206
  */
@@ -410,6 +428,7 @@ declare class RenderPipeline<T, TargetVS extends object = object, TargetCF exten
410
428
  toPhaseOutput(fn: (value: T) => {
411
429
  viewState: TargetVS;
412
430
  carryForward: TargetCF;
431
+ headTags?: HeadTag[];
413
432
  }): Promise<RenderOutcome<TargetVS, TargetCF>>;
414
433
  /** Check if this pipeline is in a success state */
415
434
  isOk(): boolean;
@@ -654,4 +673,4 @@ declare function makeJayInit(key?: string): JayInitBuilder<void>;
654
673
  */
655
674
  declare function isJayInit(obj: unknown): obj is JayInit<any>;
656
675
 
657
- export { ActionError, type ActionInput, type ActionOutput, type AnyFastRenderResult, type AnyJayStackComponentDefinition, type AnySlowlyRenderResult, type Builder, type CacheOptions, type ClientError4xx, type ContractGeneratorFunction, type DynamicContractGenerator, type DynamicContractProps, type FastRenderResult, type GeneratedContractYaml, type HttpMethod, type JayAction, type JayActionBuilder, type JayActionDefinition, type JayInit, type JayInitBuilder, type JayInitBuilderWithServer, type JayStackComponentDefinition, type LoadParams, type PageProps, type PartialRender, type PhaseOutput, type PipelineFactory, type Redirect3xx, type RenderFast, type RenderOutcome, RenderPipeline, type RenderSlowly, type RequestQuery, type ServerError5xx, type ServiceInstances, type ServiceMarker, type ServiceMarkers, type Signals, type SlowlyRenderResult, type UrlParams, badRequest, clientError4xx, createJayService, forbidden, isJayAction, isJayInit, makeContractGenerator, makeJayAction, makeJayInit, makeJayQuery, makeJayStackComponent, notFound, partialRender, phaseOutput, redirect3xx, serverError5xx, unauthorized };
676
+ export { ActionError, type ActionInput, type ActionOutput, type AnyFastRenderResult, type AnyJayStackComponentDefinition, type AnySlowlyRenderResult, type Builder, type CacheOptions, type ClientError4xx, type ContractGeneratorFunction, type DynamicContractGenerator, type DynamicContractProps, type FastRenderResult, type GeneratedContractYaml, type HeadTag, type HttpMethod, type JayAction, type JayActionBuilder, type JayActionDefinition, type JayInit, type JayInitBuilder, type JayInitBuilderWithServer, type JayStackComponentDefinition, type LoadParams, type PageProps, type PartialRender, type PhaseOutput, type PipelineFactory, type Redirect3xx, type RenderFast, type RenderOutcome, RenderPipeline, type RenderSlowly, type RequestQuery, type ServerError5xx, type ServiceInstances, type ServiceMarker, type ServiceMarkers, type Signals, type SlowlyRenderResult, type UrlParams, badRequest, clientError4xx, createJayService, forbidden, isJayAction, isJayInit, makeContractGenerator, makeJayAction, makeJayInit, makeJayQuery, makeJayStackComponent, notFound, partialRender, phaseOutput, redirect3xx, serverError5xx, unauthorized };
package/dist/index.js CHANGED
@@ -40,8 +40,13 @@ function redirect3xx(status, location, message) {
40
40
  message
41
41
  };
42
42
  }
43
- function phaseOutput(rendered, carryForward) {
44
- return { kind: "PhaseOutput", rendered, carryForward };
43
+ function phaseOutput(rendered, carryForward, options) {
44
+ return {
45
+ kind: "PhaseOutput",
46
+ rendered,
47
+ carryForward,
48
+ ...options?.headTags && { headTags: options.headTags }
49
+ };
45
50
  }
46
51
  function partialRender(rendered, carryForward) {
47
52
  return phaseOutput(rendered, carryForward);
@@ -61,6 +66,7 @@ class BuilderImplementation {
61
66
  __publicField(this, "fastRender");
62
67
  __publicField(this, "comp");
63
68
  __publicField(this, "clientDefaults");
69
+ this.comp = () => ({ render: () => ({}) });
64
70
  }
65
71
  withProps() {
66
72
  return this;
@@ -331,8 +337,8 @@ class RenderPipeline {
331
337
  if (isErrorOutcome(resolvedValue)) {
332
338
  return resolvedValue;
333
339
  }
334
- const { viewState, carryForward } = fn(resolvedValue);
335
- return phaseOutput(viewState, carryForward);
340
+ const { viewState, carryForward, headTags } = fn(resolvedValue);
341
+ return phaseOutput(viewState, carryForward, headTags ? { headTags } : void 0);
336
342
  }
337
343
  // =========================================================================
338
344
  // Utility Methods
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jay-framework/fullstack-component",
3
- "version": "0.15.5",
3
+ "version": "0.15.6",
4
4
  "type": "module",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/index.js",
@@ -26,12 +26,12 @@
26
26
  "test:watch": "vitest"
27
27
  },
28
28
  "dependencies": {
29
- "@jay-framework/component": "^0.15.5",
30
- "@jay-framework/runtime": "^0.15.5"
29
+ "@jay-framework/component": "^0.15.6",
30
+ "@jay-framework/runtime": "^0.15.6"
31
31
  },
32
32
  "devDependencies": {
33
- "@jay-framework/dev-environment": "^0.15.5",
34
- "@jay-framework/jay-cli": "^0.15.5",
33
+ "@jay-framework/dev-environment": "^0.15.6",
34
+ "@jay-framework/jay-cli": "^0.15.6",
35
35
  "@types/express": "^5.0.2",
36
36
  "@types/node": "^22.15.21",
37
37
  "nodemon": "^3.0.3",