@@ -23,7 +23,6 @@ import type {
2323 CodeBlockResult ,
2424 ComponentDefinition ,
2525 ComponentElement ,
26- ComponentHandling ,
2726 ComponentFailure ,
2827 ComponentInvocationMetadata ,
2928 ComponentRegistry ,
@@ -35,20 +34,6 @@ import type {
3534 Segment ,
3635} from "./types.ts" ;
3736
38- /**
39- * The engine's segment expansion, already bound to one expansion's
40- * interpolation inputs, cycle-detection hide set, and block counter. The
41- * expansion loop sets it around each element it offers to extensions and
42- * restores the enclosing one afterwards, so a claiming handler recurses with
43- * that expansion's state and nothing else in the run sees one at all.
44- * Internal: extensions reach it through `Component.expandSegments`.
45- */
46- export const ExpansionFrame : Context < ( ( segments : Segment [ ] ) => Operation < Segment [ ] > ) | undefined > =
47- createContext < ( ( segments : Segment [ ] ) => Operation < Segment [ ] > ) | undefined > (
48- "component.expansionFrame" ,
49- undefined ,
50- ) ;
51-
5237export interface ComponentApi {
5338 /** `"__root__"` imports the root document. */
5439 importComponent ( name : string ) : Operation < ComponentDefinition | FunctionComponentDefinition > ;
@@ -61,46 +46,13 @@ export interface ComponentApi {
6146 * `AmbientErrorPolicy`: collected for rendering, or thrown inside
6247 * suppressed documentation.
6348 *
64- * Whoever creates an ErrorSegment calls this, including an `expand` handler.
65- * A segment that reaches the document without it never passes the chain, so
49+ * Whoever creates an ErrorSegment calls this. A segment that reaches the
50+ * document without it never passes the chain, so
6651 * middleware that counts, logs, or forwards failures never sees it.
6752 */
6853 raise ( error : ErrorSegment ) : Operation < ErrorSegment > ;
6954 env : EvalEnv | undefined ;
7055 evalScope : EvalScope | undefined ;
71- /**
72- * Offer a component element to extensions before built-in expansion.
73- * Extensions install middleware that returns `{ segments }` for the names
74- * they claim and delegates to `next` for everything else. The default
75- * answers `undefined` — unhandled — so expansion proceeds normally.
76- *
77- * A handler owns the observation of every ErrorSegment it creates: it calls
78- * `raise` for its own diagnostics — an invalid prop, a structural violation —
79- * and returns errors that came back from `expandSegments` untouched, because
80- * those were already reported where they were produced. The engine settles
81- * whatever is returned under the caller's ambient policy, so a collecting
82- * caller keeps the error and a throwing one aborts, either way without a
83- * second observation. Returning a diagnostic the handler created but never
84- * raised bypasses the observation chain and breaks this contract.
85- */
86- expand ( element : ComponentElement ) : Operation < ComponentHandling | undefined > ;
87- /**
88- * Expand segments within the expansion that offered the current element:
89- * the engine's own recursion, already bound to that expansion's
90- * interpolation inputs, cycle-detection state, and block-ID counter. A
91- * handler uses it for an element's children or for segments it generates.
92- *
93- * Live for exactly one `expand` offer, so it answers only inside the handler
94- * that received the element. Ordinary expansion work — a code block, a
95- * modifier chain, a task that outlives the offer — finds no active expansion
96- * and gets an error.
97- *
98- * Every ErrorSegment among the returned segments has already been reported
99- * through `raise`, at the point inside the expansion that produced it. A
100- * handler passes them on as they are; raising one again would report the same
101- * failure twice.
102- */
103- expandSegments ( segments : Segment [ ] ) : Operation < Segment [ ] > ;
10456 /** Whether the invocation wrote this capture prop at all. */
10557 hasCapture ( name : string ) : Operation < boolean > ;
10658 /**
@@ -220,10 +172,6 @@ export const Component: Api<ComponentApi> = createApi<ComponentApi>("Component",
220172 env : undefined ,
221173 evalScope : undefined ,
222174 // deno-lint-ignore require-yield
223- * expand ( ) : Operation < ComponentHandling | undefined > {
224- return undefined ;
225- } ,
226- // deno-lint-ignore require-yield
227175 * hasCapture ( _name : string ) : Operation < boolean > {
228176 return false ;
229177 } ,
@@ -233,16 +181,6 @@ export const Component: Api<ComponentApi> = createApi<ComponentApi>("Component",
233181 `Component.capture("${ name } ") has no provider: not inside a function component invocation.` ,
234182 ) ;
235183 } ,
236- * expandSegments ( segments : Segment [ ] ) : Operation < Segment [ ] > {
237- const frame = yield * ExpansionFrame . get ( ) ;
238- if ( ! frame ) {
239- throw new Error (
240- "Component.expandSegments() has no active expansion in this scope. It is available " +
241- "to a Component.around({ expand }) handler, for the element it was offered." ,
242- ) ;
243- }
244- return yield * frame ( segments ) ;
245- } ,
246184 // deno-lint-ignore require-yield
247185 * codeBlock ( ) : Operation < CodeBlockContext > {
248186 throw new Error (
@@ -297,9 +235,6 @@ export const applyModifiers: Operations<ComponentApi>["applyModifiers"] =
297235export const raise : Operations < ComponentApi > [ "raise" ] = Component . operations . raise ;
298236export const env : Operations < ComponentApi > [ "env" ] = Component . operations . env ;
299237export const evalScope : Operations < ComponentApi > [ "evalScope" ] = Component . operations . evalScope ;
300- export const expand : Operations < ComponentApi > [ "expand" ] = Component . operations . expand ;
301- export const expandSegments : Operations < ComponentApi > [ "expandSegments" ] =
302- Component . operations . expandSegments ;
303238export const codeBlock : Operations < ComponentApi > [ "codeBlock" ] = Component . operations . codeBlock ;
304239export const persistent : Operations < ComponentApi > [ "persistent" ] = Component . operations . persistent ;
305240export const content : Operations < ComponentApi > [ "content" ] = Component . operations . content ;
0 commit comments