@alloy-js/typescript 0.4.0 → 0.6.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/CHANGELOG.md +19 -0
- package/dist/src/components/ArrayExpression.d.ts +1 -1
- package/dist/src/components/ArrayExpression.d.ts.map +1 -1
- package/dist/src/components/ArrayExpression.js +18 -28
- package/dist/src/components/ArrayExpression.js.map +1 -1
- package/dist/src/components/BarrelFile.d.ts +1 -1
- package/dist/src/components/BarrelFile.d.ts.map +1 -1
- package/dist/src/components/BarrelFile.js +11 -9
- package/dist/src/components/BarrelFile.js.map +1 -1
- package/dist/src/components/ClassDeclaration.d.ts +4 -4
- package/dist/src/components/ClassDeclaration.d.ts.map +1 -1
- package/dist/src/components/ClassDeclaration.js +8 -9
- package/dist/src/components/ClassDeclaration.js.map +1 -1
- package/dist/src/components/CommaList.d.ts +12 -0
- package/dist/src/components/CommaList.d.ts.map +1 -0
- package/dist/src/components/CommaList.js +19 -0
- package/dist/src/components/CommaList.js.map +1 -0
- package/dist/src/components/Declaration.d.ts +1 -1
- package/dist/src/components/Declaration.d.ts.map +1 -1
- package/dist/src/components/Declaration.js.map +1 -1
- package/dist/src/components/EnumDeclaration.d.ts +1 -1
- package/dist/src/components/EnumDeclaration.d.ts.map +1 -1
- package/dist/src/components/EnumDeclaration.js +19 -17
- package/dist/src/components/EnumDeclaration.js.map +1 -1
- package/dist/src/components/EnumMember.d.ts +1 -1
- package/dist/src/components/EnumMember.d.ts.map +1 -1
- package/dist/src/components/EnumMember.js.map +1 -1
- package/dist/src/components/ExportStatement.d.ts +1 -1
- package/dist/src/components/ExportStatement.d.ts.map +1 -1
- package/dist/src/components/ExportStatement.js.map +1 -1
- package/dist/src/components/FunctionCallExpression.d.ts +3 -3
- package/dist/src/components/FunctionCallExpression.d.ts.map +1 -1
- package/dist/src/components/FunctionCallExpression.js +26 -9
- package/dist/src/components/FunctionCallExpression.js.map +1 -1
- package/dist/src/components/FunctionDeclaration.d.ts +9 -2
- package/dist/src/components/FunctionDeclaration.d.ts.map +1 -1
- package/dist/src/components/FunctionDeclaration.js +135 -33
- package/dist/src/components/FunctionDeclaration.js.map +1 -1
- package/dist/src/components/ImportStatement.d.ts +1 -1
- package/dist/src/components/ImportStatement.d.ts.map +1 -1
- package/dist/src/components/ImportStatement.js +25 -31
- package/dist/src/components/ImportStatement.js.map +1 -1
- package/dist/src/components/Interface.d.ts +3 -3
- package/dist/src/components/Interface.d.ts.map +1 -1
- package/dist/src/components/Interface.js +5 -5
- package/dist/src/components/Interface.js.map +1 -1
- package/dist/src/components/JSDoc.d.ts +10 -0
- package/dist/src/components/JSDoc.d.ts.map +1 -0
- package/dist/src/components/JSDoc.js +24 -0
- package/dist/src/components/JSDoc.js.map +1 -0
- package/dist/src/components/JSDocComment.d.ts +11 -0
- package/dist/src/components/JSDocComment.d.ts.map +1 -0
- package/dist/src/components/JSDocComment.js +16 -0
- package/dist/src/components/JSDocComment.js.map +1 -0
- package/dist/src/components/JSDocExample.d.ts +12 -0
- package/dist/src/components/JSDocExample.d.ts.map +1 -0
- package/dist/src/components/JSDocExample.js +26 -0
- package/dist/src/components/JSDocExample.js.map +1 -0
- package/dist/src/components/JSDocParagraph.d.ts +10 -0
- package/dist/src/components/JSDocParagraph.d.ts.map +1 -0
- package/dist/src/components/JSDocParagraph.js +23 -0
- package/dist/src/components/JSDocParagraph.js.map +1 -0
- package/dist/src/components/MemberChainExpression.d.ts +11 -0
- package/dist/src/components/MemberChainExpression.d.ts.map +1 -0
- package/dist/src/components/MemberChainExpression.js +64 -0
- package/dist/src/components/MemberChainExpression.js.map +1 -0
- package/dist/src/components/ObjectExpression.d.ts +2 -2
- package/dist/src/components/ObjectExpression.d.ts.map +1 -1
- package/dist/src/components/ObjectExpression.js +45 -42
- package/dist/src/components/ObjectExpression.js.map +1 -1
- package/dist/src/components/PackageDirectory.d.ts +1 -1
- package/dist/src/components/PackageDirectory.d.ts.map +1 -1
- package/dist/src/components/PackageDirectory.js +1 -1
- package/dist/src/components/PackageDirectory.js.map +1 -1
- package/dist/src/components/PackageJson.d.ts +1 -1
- package/dist/src/components/PackageJson.d.ts.map +1 -1
- package/dist/src/components/PackageJson.js.map +1 -1
- package/dist/src/components/Reference.d.ts +1 -1
- package/dist/src/components/Reference.d.ts.map +1 -1
- package/dist/src/components/Reference.js +1 -1
- package/dist/src/components/Reference.js.map +1 -1
- package/dist/src/components/SourceFile.d.ts +1 -1
- package/dist/src/components/SourceFile.d.ts.map +1 -1
- package/dist/src/components/SourceFile.js +13 -6
- package/dist/src/components/SourceFile.js.map +1 -1
- package/dist/src/components/TsConfigJson.d.ts +1 -1
- package/dist/src/components/TsConfigJson.d.ts.map +1 -1
- package/dist/src/components/TsConfigJson.js.map +1 -1
- package/dist/src/components/TypeDeclaration.d.ts +1 -1
- package/dist/src/components/TypeDeclaration.d.ts.map +1 -1
- package/dist/src/components/TypeDeclaration.js.map +1 -1
- package/dist/src/components/ValueExpression.d.ts +2 -1
- package/dist/src/components/ValueExpression.d.ts.map +1 -1
- package/dist/src/components/ValueExpression.js.map +1 -1
- package/dist/src/components/VarDeclaration.d.ts +1 -1
- package/dist/src/components/VarDeclaration.d.ts.map +1 -1
- package/dist/src/components/VarDeclaration.js +2 -2
- package/dist/src/components/VarDeclaration.js.map +1 -1
- package/dist/src/components/index.d.ts +2 -1
- package/dist/src/components/index.d.ts.map +1 -1
- package/dist/src/components/index.js +2 -1
- package/dist/src/components/index.js.map +1 -1
- package/dist/src/components/stc/index.d.ts +21 -21
- package/dist/src/components/stc/index.d.ts.map +1 -1
- package/dist/src/components/stc/index.js +1 -1
- package/dist/src/components/stc/index.js.map +1 -1
- package/dist/test/imports.test.d.ts.map +1 -1
- package/dist/test/jsdoc.test.d.ts +2 -0
- package/dist/test/jsdoc.test.d.ts.map +1 -0
- package/dist/test/member-chain.test.d.ts +2 -0
- package/dist/test/member-chain.test.d.ts.map +1 -0
- package/dist/test/utils.d.ts +2 -2
- package/dist/test/utils.d.ts.map +1 -1
- package/dist/test/values.test.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +4 -6
- package/src/components/ArrayExpression.tsx +18 -32
- package/src/components/BarrelFile.tsx +7 -13
- package/src/components/ClassDeclaration.tsx +33 -28
- package/src/components/CommaList.tsx +23 -0
- package/src/components/Declaration.tsx +7 -3
- package/src/components/EnumDeclaration.tsx +21 -14
- package/src/components/EnumMember.tsx +7 -4
- package/src/components/ExportStatement.tsx +6 -1
- package/src/components/FunctionCallExpression.tsx +18 -9
- package/src/components/FunctionDeclaration.tsx +170 -55
- package/src/components/ImportStatement.tsx +6 -9
- package/src/components/Interface.tsx +20 -13
- package/src/components/JSDoc.tsx +28 -0
- package/src/components/JSDocComment.tsx +23 -0
- package/src/components/JSDocExample.tsx +30 -0
- package/src/components/JSDocParagraph.tsx +35 -0
- package/src/components/MemberChainExpression.tsx +59 -0
- package/src/components/ObjectExpression.tsx +53 -48
- package/src/components/PackageDirectory.tsx +11 -9
- package/src/components/PackageJson.tsx +9 -6
- package/src/components/SourceFile.tsx +15 -8
- package/src/components/TsConfigJson.tsx +5 -3
- package/src/components/TypeDeclaration.tsx +5 -3
- package/src/components/ValueExpression.tsx +7 -5
- package/src/components/VarDeclaration.tsx +11 -5
- package/src/components/index.ts +2 -1
- package/src/components/stc/index.ts +1 -1
- package/temp/api.json +618 -208
- package/test/array.test.tsx +28 -7
- package/test/basic.test.tsx +26 -21
- package/test/class.test.tsx +65 -53
- package/test/enum.test.tsx +18 -13
- package/test/externals.test.tsx +6 -7
- package/test/function-call-expression.test.tsx +39 -17
- package/test/function-declaration.test.tsx +96 -78
- package/test/imports.test.tsx +90 -65
- package/test/interface.test.tsx +29 -19
- package/test/jsdoc.test.tsx +154 -0
- package/test/member-chain.test.tsx +47 -0
- package/test/name-policy.test.tsx +33 -26
- package/test/package-external.test.tsx +8 -4
- package/test/package.test.tsx +1 -2
- package/test/reference.test.tsx +2 -6
- package/test/utils.tsx +3 -1
- package/test/value-expression.test.tsx +2 -6
- package/test/values.test.tsx +67 -73
- package/test/var-declaration.test.tsx +11 -5
- package/test/vitest.d.ts +6 -1
- package/tsconfig.json +8 -1
- package/dist/src/components/Block.d.ts +0 -6
- package/dist/src/components/Block.d.ts.map +0 -1
- package/dist/src/components/Block.js +0 -11
- package/dist/src/components/Block.js.map +0 -1
- package/src/components/Block.tsx +0 -12
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
2
3
|
import { mergeProps as _$mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
3
|
-
import { Indent as _$Indent } from "@alloy-js/core";
|
|
4
4
|
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
5
|
-
import { childrenArray, code, findKeyedChild, findUnkeyedChildren,
|
|
5
|
+
import { Block, childrenArray, code, findKeyedChild, findUnkeyedChildren, For, Indent, Name, refkey, Scope, Show, taggedComponent } from "@alloy-js/core";
|
|
6
|
+
import { onCleanup } from "@alloy-js/core/jsx-runtime";
|
|
6
7
|
import { useTSNamePolicy } from "../name-policy.js";
|
|
7
|
-
import { createTSSymbol, TSSymbolFlags
|
|
8
|
+
import { createTSSymbol, TSSymbolFlags } from "../symbols/index.js";
|
|
8
9
|
import { Declaration } from "./Declaration.js";
|
|
9
10
|
function isParameterDescriptor(value) {
|
|
10
11
|
return typeof value === "object" && value !== null && Object.hasOwn(value, "type");
|
|
11
12
|
}
|
|
12
13
|
export const functionParametersTag = Symbol();
|
|
14
|
+
export const functionTypeParametersTag = Symbol();
|
|
13
15
|
export const functionBodyTag = Symbol();
|
|
14
16
|
export function FunctionDeclaration(props) {
|
|
15
17
|
const children = childrenArray(() => props.children);
|
|
18
|
+
const typeParametersChild = findKeyedChild(children, functionTypeParametersTag);
|
|
16
19
|
const parametersChild = findKeyedChild(children, functionParametersTag);
|
|
17
20
|
const bodyChild = findKeyedChild(children, functionBodyTag);
|
|
18
21
|
const filteredChildren = findUnkeyedChildren(children);
|
|
@@ -20,6 +23,11 @@ export function FunctionDeclaration(props) {
|
|
|
20
23
|
async: props.async
|
|
21
24
|
});
|
|
22
25
|
const sReturnType = returnType ? [": ", returnType] : undefined;
|
|
26
|
+
const sTypeParameters = typeParametersChild ? ["<", typeParametersChild, ">"] : _$createComponent(FunctionDeclaration.TypeParameters, {
|
|
27
|
+
get parameters() {
|
|
28
|
+
return props.typeParameters;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
23
31
|
const sParams = parametersChild ?? _$createComponent(FunctionDeclaration.Parameters, {
|
|
24
32
|
get parameters() {
|
|
25
33
|
return props.parameters;
|
|
@@ -38,11 +46,7 @@ export function FunctionDeclaration(props) {
|
|
|
38
46
|
},
|
|
39
47
|
kind: "function",
|
|
40
48
|
get children() {
|
|
41
|
-
return ["(", sParams, ")", sReturnType, " ",
|
|
42
|
-
get children() {
|
|
43
|
-
return ["\n", sBody];
|
|
44
|
-
}
|
|
45
|
-
}), "\n", "}"];
|
|
49
|
+
return [sTypeParameters, "(", sParams, ")", sReturnType, " ", sBody];
|
|
46
50
|
}
|
|
47
51
|
})];
|
|
48
52
|
}
|
|
@@ -55,37 +59,135 @@ function getReturnType(returnType, options = {
|
|
|
55
59
|
return options.async ? code`Promise<${returnType}>` : returnType;
|
|
56
60
|
}
|
|
57
61
|
}
|
|
58
|
-
|
|
62
|
+
function normalizeAndDeclareParameters(parameters, flags = TSSymbolFlags.ParameterSymbol) {
|
|
59
63
|
const namePolicy = useTSNamePolicy();
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
const scope = useTSScope();
|
|
65
|
-
if (scope.kind !== "function") {
|
|
66
|
-
throw new Error("Can't declare function parameter in non-function scope");
|
|
67
|
-
}
|
|
68
|
-
value = mapJoin(new Map(Object.entries(props.parameters)), (key, value) => {
|
|
69
|
-
const descriptor = isParameterDescriptor(value) ? value : {
|
|
64
|
+
if (Array.isArray(parameters)) {
|
|
65
|
+
return parameters.map(paramName => {
|
|
66
|
+
const symbol = createTSSymbol({
|
|
67
|
+
name: namePolicy.getName(paramName, flags & TSSymbolFlags.TypeSymbol ? "type" : "parameter"),
|
|
70
68
|
refkey: refkey(),
|
|
71
|
-
|
|
72
|
-
};
|
|
73
|
-
const optionality = descriptor.optional ? "?" : "";
|
|
74
|
-
const sym = createTSSymbol({
|
|
75
|
-
name: key,
|
|
76
|
-
refkey: descriptor.refkey,
|
|
77
|
-
tsFlags: TSSymbolFlags.ParameterSymbol
|
|
69
|
+
tsFlags: flags
|
|
78
70
|
});
|
|
79
|
-
return
|
|
80
|
-
|
|
81
|
-
|
|
71
|
+
return {
|
|
72
|
+
refkey: symbol.refkey,
|
|
73
|
+
symbol
|
|
74
|
+
};
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
return Object.entries(parameters).map(([paramName, value]) => {
|
|
78
|
+
const descriptor = isParameterDescriptor(value) ? value : {
|
|
79
|
+
refkey: refkey(),
|
|
80
|
+
type: value
|
|
81
|
+
};
|
|
82
|
+
const symbol = createTSSymbol({
|
|
83
|
+
name: namePolicy.getName(paramName, flags & TSSymbolFlags.TypeSymbol ? "type" : "parameter"),
|
|
84
|
+
refkey: descriptor.refkey,
|
|
85
|
+
tsFlags: flags
|
|
82
86
|
});
|
|
83
|
-
|
|
84
|
-
|
|
87
|
+
descriptor.symbol = symbol;
|
|
88
|
+
return descriptor;
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
FunctionDeclaration.TypeParameters = taggedComponent(functionTypeParametersTag, function TypeParameters(props) {
|
|
92
|
+
if (props.children) {
|
|
93
|
+
return props.children;
|
|
85
94
|
}
|
|
86
|
-
|
|
95
|
+
if (!props.parameters) {
|
|
96
|
+
return undefined;
|
|
97
|
+
}
|
|
98
|
+
const typeParameters = normalizeAndDeclareParameters(props.parameters);
|
|
99
|
+
onCleanup(() => {
|
|
100
|
+
for (const param of typeParameters) {
|
|
101
|
+
param.symbol.binder.deleteSymbol(param.symbol);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
return ["<", _$createIntrinsic("group", {
|
|
105
|
+
get children() {
|
|
106
|
+
return _$createComponent(Indent, {
|
|
107
|
+
"break": "soft",
|
|
108
|
+
get children() {
|
|
109
|
+
return [_$createComponent(For, {
|
|
110
|
+
each: typeParameters,
|
|
111
|
+
comma: true,
|
|
112
|
+
line: true,
|
|
113
|
+
children: param => typeParameter(param)
|
|
114
|
+
}), _$createIntrinsic("ifBreak", {
|
|
115
|
+
children: ","
|
|
116
|
+
})];
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}), ">"];
|
|
87
121
|
});
|
|
122
|
+
function typeParameter(param) {
|
|
123
|
+
return _$createIntrinsic("group", {
|
|
124
|
+
get children() {
|
|
125
|
+
return [_$memo(() => param.symbol.name), _$createComponent(Show, {
|
|
126
|
+
get when() {
|
|
127
|
+
return !!param.type;
|
|
128
|
+
},
|
|
129
|
+
get children() {
|
|
130
|
+
return [" ", "extends", _$createIntrinsic("indent", {
|
|
131
|
+
get children() {
|
|
132
|
+
return [" ", _$memo(() => param.type)];
|
|
133
|
+
}
|
|
134
|
+
})];
|
|
135
|
+
}
|
|
136
|
+
})];
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
FunctionDeclaration.Parameters = taggedComponent(functionParametersTag, function Parameters(props) {
|
|
141
|
+
if (props.children) {
|
|
142
|
+
return props.children;
|
|
143
|
+
}
|
|
144
|
+
const parameters = normalizeAndDeclareParameters(props.parameters ?? {});
|
|
145
|
+
return _$createIntrinsic("group", {
|
|
146
|
+
get children() {
|
|
147
|
+
return _$createComponent(Indent, {
|
|
148
|
+
"break": "soft",
|
|
149
|
+
get children() {
|
|
150
|
+
return [_$createComponent(For, {
|
|
151
|
+
each: parameters,
|
|
152
|
+
comma: true,
|
|
153
|
+
line: true,
|
|
154
|
+
children: param => parameter(param)
|
|
155
|
+
}), _$createIntrinsic("ifBreak", {
|
|
156
|
+
children: ","
|
|
157
|
+
})];
|
|
158
|
+
}
|
|
159
|
+
});
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
function parameter(param) {
|
|
164
|
+
return _$createIntrinsic("group", {
|
|
165
|
+
get children() {
|
|
166
|
+
return [_$memo(() => param.symbol.name), _$createComponent(Show, {
|
|
167
|
+
get when() {
|
|
168
|
+
return !!param.optional;
|
|
169
|
+
},
|
|
170
|
+
children: "?"
|
|
171
|
+
}), _$createComponent(Show, {
|
|
172
|
+
get when() {
|
|
173
|
+
return !!param.type;
|
|
174
|
+
},
|
|
175
|
+
get children() {
|
|
176
|
+
return _$createIntrinsic("indent", {
|
|
177
|
+
get children() {
|
|
178
|
+
return [": ", _$memo(() => param.type)];
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
})];
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
}
|
|
88
186
|
FunctionDeclaration.Body = taggedComponent(functionBodyTag, function Body(props) {
|
|
89
|
-
return
|
|
187
|
+
return _$createComponent(Block, {
|
|
188
|
+
get children() {
|
|
189
|
+
return props.children;
|
|
190
|
+
}
|
|
191
|
+
});
|
|
90
192
|
});
|
|
91
193
|
//# sourceMappingURL=FunctionDeclaration.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FunctionDeclaration.js","names":["childrenArray","code","findKeyedChild","findUnkeyedChildren","
|
|
1
|
+
{"version":3,"file":"FunctionDeclaration.js","names":["Block","childrenArray","code","findKeyedChild","findUnkeyedChildren","For","Indent","Name","refkey","Scope","Show","taggedComponent","onCleanup","useTSNamePolicy","createTSSymbol","TSSymbolFlags","Declaration","isParameterDescriptor","value","Object","hasOwn","functionParametersTag","Symbol","functionTypeParametersTag","functionBodyTag","FunctionDeclaration","props","children","typeParametersChild","parametersChild","bodyChild","filteredChildren","returnType","getReturnType","async","sReturnType","undefined","sTypeParameters","_$createComponent","TypeParameters","parameters","typeParameters","sParams","Parameters","sBody","Body","asyncKwd","_$mergeProps","nameKind","name","kind","options","normalizeAndDeclareParameters","flags","ParameterSymbol","namePolicy","Array","isArray","map","paramName","symbol","getName","TypeSymbol","tsFlags","entries","descriptor","type","param","binder","deleteSymbol","_$createIntrinsic","each","comma","line","typeParameter","_$memo","when","parameter","optional"],"sources":["../../../src/components/FunctionDeclaration.tsx"],"sourcesContent":[null],"mappings":";;;;AAAA,SACEA,KAAK,EACLC,aAAa,EACbC,IAAI,EACJC,cAAc,EACdC,mBAAmB,EACnBC,GAAG,EACHC,MAAM,EACNC,IAAI,EAEJC,MAAM,EACNC,KAAK,EACLC,IAAI,EACJC,eAAe,QACV,gBAAgB;AACvB,SAAmBC,SAAS,QAAQ,4BAA4B;AAChE,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SACEC,cAAc,EAEdC,aAAa,QACR,qBAAqB;AAC5B,SAA+BC,WAAW,QAAQ,kBAAkB;AAQpE,SAASC,qBAAqBA,CAC5BC,KAAqC,EACP;EAC9B,OACE,OAAOA,KAAK,KAAK,QAAQ,IAAIA,KAAK,KAAK,IAAI,IAAIC,MAAM,CAACC,MAAM,CAACF,KAAK,EAAE,MAAM,CAAC;AAE/E;AASA,OAAO,MAAMG,qBAAqB,GAAGC,MAAM,CAAC,CAAC;AAC7C,OAAO,MAAMC,yBAAyB,GAAGD,MAAM,CAAC,CAAC;AACjD,OAAO,MAAME,eAAe,GAAGF,MAAM,CAAC,CAAC;AAEvC,OAAO,SAASG,mBAAmBA,CAACC,KAA+B,EAAE;EACnE,MAAMC,QAAQ,GAAG1B,aAAa,CAAC,MAAMyB,KAAK,CAACC,QAAQ,CAAC;EACpD,MAAMC,mBAAmB,GAAGzB,cAAc,CACxCwB,QAAQ,EACRJ,yBACF,CAAC;EACD,MAAMM,eAAe,GAAG1B,cAAc,CAACwB,QAAQ,EAAEN,qBAAqB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QAAA;MAAA;IAAA;EAAA;AAI7B;AAMAzC,mBAAmB,CAACoB,IAAI,GAAGlC,eAAe,CACxCa,eAAe,EACf,SAASqB,IAAIA,CAACnB,KAAwB,EAAE;EACtC,OAAAY,iBAAA,CAAQtC,KAAK;IAAA,IAAA2B,SAAA;MAAA,OAAED,KAAK,CAACC,QAAQ;IAAA;EAAA;AAC/B,CACF,CAAC","ignoreList":[]}
|
|
@@ -2,7 +2,7 @@ import { ImportedSymbol, ImportRecords } from "../symbols/index.js";
|
|
|
2
2
|
export interface ImportStatementsProps {
|
|
3
3
|
records: ImportRecords;
|
|
4
4
|
}
|
|
5
|
-
export declare function ImportStatements(props: ImportStatementsProps): () =>
|
|
5
|
+
export declare function ImportStatements(props: ImportStatementsProps): () => import("@alloy-js/core").Children[];
|
|
6
6
|
export interface ImportStatementProps {
|
|
7
7
|
path: string;
|
|
8
8
|
symbols: Set<ImportedSymbol>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImportStatement.d.ts","sourceRoot":"","sources":["../../../src/components/ImportStatement.tsx"],"names":[],"mappings":"AAOA,OAAO,EACL,cAAc,EACd,aAAa,EAEd,MAAM,qBAAqB,CAAC;AAI7B,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,aAAa,CAAC;CACxB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,
|
|
1
|
+
{"version":3,"file":"ImportStatement.d.ts","sourceRoot":"","sources":["../../../src/components/ImportStatement.tsx"],"names":[],"mappings":"AAOA,OAAO,EACL,cAAc,EACd,aAAa,EAEd,MAAM,qBAAqB,CAAC;AAI7B,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,aAAa,CAAC;CACxB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,6CA0C5D;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CAC9B;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,eAsC1D"}
|
|
@@ -5,39 +5,33 @@ import { modulePath } from "../utils.js";
|
|
|
5
5
|
import { usePackage } from "./PackageDirectory.js";
|
|
6
6
|
export function ImportStatements(props) {
|
|
7
7
|
const pkg = usePackage();
|
|
8
|
-
return
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
//
|
|
17
|
-
const targetPackage = module.parent;
|
|
18
|
-
let foundPath = false;
|
|
19
|
-
for (const [publicPath, exportedModule] of targetPackage.exportedSymbols) {
|
|
20
|
-
// a module could be exported from multiple paths, so here
|
|
21
|
-
// would be the place to handle that.
|
|
8
|
+
return mapJoin(() => props.records, (module, importedSymbols) => {
|
|
9
|
+
let targetPath;
|
|
10
|
+
if (pkg && pkg.scope !== module.parent || !pkg && module.parent.kind !== "global") {
|
|
11
|
+
// importing from another package, so let's calculate the import.
|
|
12
|
+
const targetPackage = module.parent;
|
|
13
|
+
let foundPath = false;
|
|
14
|
+
for (const [publicPath, exportedModule] of targetPackage.exportedSymbols) {
|
|
15
|
+
// a module could be exported from multiple paths, so here
|
|
16
|
+
// would be the place to handle that.
|
|
22
17
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
if (!foundPath) {
|
|
28
|
-
throw new Error("Module not exported from package");
|
|
18
|
+
if (exportedModule === module) {
|
|
19
|
+
foundPath = publicPath;
|
|
29
20
|
}
|
|
30
|
-
targetPath = targetPackage.name + foundPath.slice(1);
|
|
31
|
-
} else {
|
|
32
|
-
// local package import, so need relative import
|
|
33
|
-
const currentDir = useContext(SourceDirectoryContext).path;
|
|
34
|
-
// todo: don't allow importing non-exported symbols
|
|
35
|
-
targetPath = modulePath(relative(currentDir, module.name));
|
|
36
21
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
22
|
+
if (!foundPath) {
|
|
23
|
+
throw new Error("Module not exported from package");
|
|
24
|
+
}
|
|
25
|
+
targetPath = targetPackage.name + foundPath.slice(1);
|
|
26
|
+
} else {
|
|
27
|
+
// local package import, so need relative import
|
|
28
|
+
const currentDir = useContext(SourceDirectoryContext).path;
|
|
29
|
+
// todo: don't allow importing non-exported symbols
|
|
30
|
+
targetPath = modulePath(relative(currentDir, module.name));
|
|
31
|
+
}
|
|
32
|
+
return _$createComponent(ImportStatement, {
|
|
33
|
+
path: targetPath,
|
|
34
|
+
symbols: importedSymbols
|
|
41
35
|
});
|
|
42
36
|
});
|
|
43
37
|
}
|
|
@@ -64,7 +58,7 @@ export function ImportStatement(props) {
|
|
|
64
58
|
}
|
|
65
59
|
if (namedImportSymbols.length > 0) {
|
|
66
60
|
parts.push("{ ");
|
|
67
|
-
parts.push(mapJoin(namedImportSymbols, nis => _$createComponent(ImportBinding, {
|
|
61
|
+
parts.push(mapJoin(() => namedImportSymbols, nis => _$createComponent(ImportBinding, {
|
|
68
62
|
importedSymbol: nis
|
|
69
63
|
}), {
|
|
70
64
|
joiner: ", "
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImportStatement.js","names":["mapJoin","memo","SourceDirectoryContext","useContext","relative","modulePath","usePackage","ImportStatements","props","pkg","records","
|
|
1
|
+
{"version":3,"file":"ImportStatement.js","names":["mapJoin","memo","SourceDirectoryContext","useContext","relative","modulePath","usePackage","ImportStatements","props","pkg","records","module","importedSymbols","targetPath","scope","parent","kind","targetPackage","foundPath","publicPath","exportedModule","exportedSymbols","Error","name","slice","currentDir","path","_$createComponent","ImportStatement","symbols","defaultImportSymbol","undefined","namedImportSymbols","sym","target","default","push","parts","ImportBinding","importedSymbol","length","nis","joiner","text","localName","local","targetName"],"sources":["../../../src/components/ImportStatement.tsx"],"sourcesContent":[null],"mappings":";AAAA,SACEA,OAAO,EACPC,IAAI,EACJC,sBAAsB,EACtBC,UAAU,QACL,gBAAgB;A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ACX,IAAI;IACnD,IAAIqB,SAAS,KAAKE,UAAU,EAAE;MAC5B,OAAOA,UAAU;IACnB,CAAC,MAAM,IAAItC,KAAK,CAAC2B,OAAO,EAAE;MACxB,OAAOS,SAAS;IAClB,CAAC,MAAM;MACL,OAAO,GAAGE,UAAU,OAAOF,SAAS,EAAE;IACxC;EACF,CAAC,CAAC;EAEF,OAAOD,IAAI;AACb","ignoreList":[]}
|
|
@@ -12,11 +12,11 @@ export interface InterfaceDeclarationProps extends BaseDeclarationProps {
|
|
|
12
12
|
* `default` boolean props determine whether and how this symbol is exported
|
|
13
13
|
* from the package.
|
|
14
14
|
*/
|
|
15
|
-
export declare function InterfaceDeclaration(props: InterfaceDeclarationProps):
|
|
15
|
+
export declare function InterfaceDeclaration(props: InterfaceDeclarationProps): Children;
|
|
16
16
|
export interface InterfaceExpressionProps {
|
|
17
17
|
children?: Children;
|
|
18
18
|
}
|
|
19
|
-
export declare function InterfaceExpression(props: InterfaceExpressionProps):
|
|
19
|
+
export declare function InterfaceExpression(props: InterfaceExpressionProps): Children;
|
|
20
20
|
export interface InterfaceMemberProps {
|
|
21
21
|
name?: string;
|
|
22
22
|
indexer?: Children;
|
|
@@ -28,5 +28,5 @@ export interface InterfaceMemberProps {
|
|
|
28
28
|
/**
|
|
29
29
|
* Create a TypeScript interface declaration.
|
|
30
30
|
*/
|
|
31
|
-
export declare function InterfaceMember(props: InterfaceMemberProps):
|
|
31
|
+
export declare function InterfaceMember(props: InterfaceMemberProps): Children;
|
|
32
32
|
//# sourceMappingURL=Interface.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Interface.d.ts","sourceRoot":"","sources":["../../../src/components/Interface.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Interface.d.ts","sourceRoot":"","sources":["../../../src/components/Interface.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,QAAQ,EAAQ,MAAM,gBAAgB,CAAC;AAEvD,OAAO,EAAE,oBAAoB,EAAe,MAAM,kBAAkB,CAAC;AAErE,MAAM,WAAW,yBAA0B,SAAQ,oBAAoB;IACrE,OAAO,CAAC,EAAE,QAAQ,CAAC;CACpB;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,YASpE;AAED,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,EAAE,QAAQ,CAAC;CACrB;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,wBAAwB,YAElE;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,QAAQ,CAAC;IACnB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,oBAAoB,YAoB1D"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { mergeProps as _$mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
3
3
|
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
4
|
-
import {
|
|
4
|
+
import { Block, Name } from "@alloy-js/core";
|
|
5
5
|
import { useTSNamePolicy } from "../name-policy.js";
|
|
6
6
|
import { Declaration } from "./Declaration.js";
|
|
7
7
|
/**
|
|
@@ -27,11 +27,11 @@ export function InterfaceDeclaration(props) {
|
|
|
27
27
|
}));
|
|
28
28
|
}
|
|
29
29
|
export function InterfaceExpression(props) {
|
|
30
|
-
return
|
|
31
|
-
{
|
|
32
|
-
|
|
30
|
+
return _$createComponent(Block, {
|
|
31
|
+
get children() {
|
|
32
|
+
return props.children;
|
|
33
33
|
}
|
|
34
|
-
|
|
34
|
+
});
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* Create a TypeScript interface declaration.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Interface.js","names":["
|
|
1
|
+
{"version":3,"file":"Interface.js","names":["Block","Name","useTSNamePolicy","Declaration","InterfaceDeclaration","props","extendsPart","extends","_$memo","_$createComponent","_$mergeProps","nameKind","children","InterfaceExpression","InterfaceMember","namer","type","optionality","optional","readonly","indexer","getName","name"],"sources":["../../../src/components/Interface.tsx"],"sourcesContent":[null],"mappings":";;;AAAA,SAASA,KAAK,EAAYC,IAAI,QAAQ,gBAAgB;AACtD,SAASC,eAAe,QAAQ,mBAAmB;AACnD,SAA+BC,WAAW,QAAQ,kBAAkB;AAMpE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAACC,KAAgC,EAAE;EACrE,MAAMC,WAAW,GAAGD,KAAK,CAACE,OAAO,iBAAAC,MAAA,OAAeH,KAAK,CAACE,OAAO,KAAO,EAAE;EAEtE,OAAAE,iBAAA,CACGN,WAAW,EAAAO,YAAA,CAAKL,KAAK;IAAEM,QAAQ;IAAA,IAAAC,SAAA;MAAA,sBAAAH,iBAAA,CACnBR,IAAI,OACdK,WAAW,OAAAG,iBAAA,CAAGI,mBAAmB;QAAA,IAAAD,SAAA;UAAA,OAAEP,KAAK,CAACO,QAAQ;QAAA;MAAA;IAAA;EAAA;AAGxD;AAMA,OAAO,SAASC,mBAAmBA,CAACR,KAA+B,EAAE;EACnE,OAAAI,iBAAA,CAAQT,KAAK;IAAA,IAAAY,SAAA;MAAA,OAAEP,KAAK,CAACO,QAAQ;IAAA;EAAA;AAC/B;AAWA;AACA;AACA;AACA,OAAO,SAASE,eAAeA,CAACT,KAA2B,EAAE;EAC3D,MAAMU,KAAK,GAAGb,eAAe,CAAC,CAAC;EAC/B,MAAMc,IAAI,GAAGX,KAAK,CAACW,IAAI,IAAIX,KAAK,CAACO,QAAQ;EACzC,MAAMK,WAAW,GAAGZ,KAAK,CAACa,QAAQ,GAAG,GAAG,GAAG,EAAE;EAC7C,MAAMC,QAAQ,GAAGd,KAAK,CAACc,QAAQ,GAAG,WAAW,GAAG,EAAE;EAClD,IAAId,KAAK,CAACe,OAAO,EAAE;IACjB,aAAAZ,MAAA,OAEMH,KAAK,CAACe,OAAO,UAAKJ,IAAI;EAG9B,CAAC,MAAM;IACL,QAEKG,QAAQ,EAAAX,MAAA,OACRO,KAAK,CAACM,OAAO,CAAChB,KAAK,CAACiB,IAAI,EAAG,kBAAkB,CAAC,GAC9CL,WAAW,QAAID,IAAI;EAG1B;AACF","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Children } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
export interface JSDocProps {
|
|
3
|
+
children: Children;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* A JSDoc comment. The children of this component are joined with two hard
|
|
7
|
+
* linebreaks. This is useful for creating JSDoc comments with multiple paragraphs.
|
|
8
|
+
*/
|
|
9
|
+
export declare function JSDoc(props: JSDocProps): Children;
|
|
10
|
+
//# sourceMappingURL=JSDoc.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JSDoc.d.ts","sourceRoot":"","sources":["../../../src/components/JSDoc.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAGtD,MAAM,WAAW,UAAU;IACzB,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,KAAK,CAAC,KAAK,EAAE,UAAU,YAetC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
4
|
+
import { List, childrenArray } from "@alloy-js/core";
|
|
5
|
+
import { JSDocComment } from "./JSDocComment.js";
|
|
6
|
+
/**
|
|
7
|
+
* A JSDoc comment. The children of this component are joined with two hard
|
|
8
|
+
* linebreaks. This is useful for creating JSDoc comments with multiple paragraphs.
|
|
9
|
+
*/
|
|
10
|
+
export function JSDoc(props) {
|
|
11
|
+
return _$createComponent(JSDocComment, {
|
|
12
|
+
get children() {
|
|
13
|
+
return _$createComponent(List, {
|
|
14
|
+
get joiner() {
|
|
15
|
+
return [_$createIntrinsic("hbr", {}), _$createIntrinsic("hbr", {})];
|
|
16
|
+
},
|
|
17
|
+
get children() {
|
|
18
|
+
return childrenArray(() => props.children);
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=JSDoc.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JSDoc.js","names":["List","childrenArray","JSDocComment","JSDoc","props","_$createComponent","children","joiner","_$createIntrinsic"],"sources":["../../../src/components/JSDoc.tsx"],"sourcesContent":[null],"mappings":";;;AAAA,SAASA,IAAI,EAAEC,aAAa,QAAQ,gBAAgB;AAEpD,SAASC,YAAY;AAMrB;AACA;AACA;AACA;AACA,OAAO,SAASC,KAAKA,CAACC,KAAiB,EAAE;EACvC,OAAAC,iBAAA,CACGH,YAAY;IAAA,IAAAI,SAAA;MAAA,OAAAD,iBAAA,CACVL,IAAI;QAAA,IACHO,MAAMA,CAAA;UAAA,QAAAC,iBAAA,aAAAA,iBAAA;QAAA;QAAA,IAAAF,SAAA;UAAA,OAOLL,aAAa,CAAC,MAAMG,KAAK,CAACE,QAAQ,CAAC;QAAA;MAAA;IAAA;EAAA;AAI5C","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Children } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
export interface JSDocCommentProps {
|
|
3
|
+
children: Children;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* A JSDoc comment block. This is a low-level component that merely creates the
|
|
7
|
+
* block. Consider using {@link JSDoc} if you want to create more complex
|
|
8
|
+
* comments.
|
|
9
|
+
*/
|
|
10
|
+
export declare function JSDocComment(props: JSDocCommentProps): Children;
|
|
11
|
+
//# sourceMappingURL=JSDocComment.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JSDocComment.d.ts","sourceRoot":"","sources":["../../../src/components/JSDocComment.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,YAWpD"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
/**
|
|
4
|
+
* A JSDoc comment block. This is a low-level component that merely creates the
|
|
5
|
+
* block. Consider using {@link JSDoc} if you want to create more complex
|
|
6
|
+
* comments.
|
|
7
|
+
*/
|
|
8
|
+
export function JSDocComment(props) {
|
|
9
|
+
return ["/**", _$createIntrinsic("align", {
|
|
10
|
+
string: " * ",
|
|
11
|
+
get children() {
|
|
12
|
+
return [_$createIntrinsic("hbr", {}), _$memo(() => props.children)];
|
|
13
|
+
}
|
|
14
|
+
}), _$createIntrinsic("hbr", {}), " **/"];
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=JSDocComment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JSDocComment.js","names":["JSDocComment","props","_$createIntrinsic","string","children","_$memo"],"sources":["../../../src/components/JSDocComment.tsx"],"sourcesContent":[null],"mappings":";;AAMA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASA,YAAYA,CAACC,KAAwB,EAAE;EACrD,eAAAC,iBAAA;IAGWC,MAAM;IAAA,IAAAC,SAAA;MAAA,QAAAF,iBAAA,aAAAG,MAAA,OAEVJ,KAAK,CAACG,QAAQ;IAAA;EAAA,IAAAF,iBAAA;AAKvB","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Children } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
export interface JSDocExampleProps {
|
|
3
|
+
fenced?: boolean;
|
|
4
|
+
language?: string;
|
|
5
|
+
children: Children;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Create a JSDoc example set off with `@example`. When the `fenced` prop is true, a `language` prop can
|
|
9
|
+
* also be set.
|
|
10
|
+
*/
|
|
11
|
+
export declare function JSDocExample(props: JSDocExampleProps): Children;
|
|
12
|
+
//# sourceMappingURL=JSDocExample.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JSDocExample.d.ts","sourceRoot":"","sources":["../../../src/components/JSDocExample.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,MAAM,WAAW,iBAAiB;IAChC,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,YAgBpD"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { createComponent as _$createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { memo as _$memo } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import { createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
4
|
+
import { Show } from "@alloy-js/core";
|
|
5
|
+
/**
|
|
6
|
+
* Create a JSDoc example set off with `@example`. When the `fenced` prop is true, a `language` prop can
|
|
7
|
+
* also be set.
|
|
8
|
+
*/
|
|
9
|
+
export function JSDocExample(props) {
|
|
10
|
+
return ["@example", _$createIntrinsic("hbr", {}), _$createComponent(Show, {
|
|
11
|
+
get when() {
|
|
12
|
+
return props.fenced;
|
|
13
|
+
},
|
|
14
|
+
get children() {
|
|
15
|
+
return ["```", _$memo(() => props.language), _$createIntrinsic("hbr", {})];
|
|
16
|
+
}
|
|
17
|
+
}), _$memo(() => props.children), _$createComponent(Show, {
|
|
18
|
+
get when() {
|
|
19
|
+
return props.fenced;
|
|
20
|
+
},
|
|
21
|
+
get children() {
|
|
22
|
+
return [_$createIntrinsic("hbr", {}), "```"];
|
|
23
|
+
}
|
|
24
|
+
})];
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=JSDocExample.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JSDocExample.js","names":["Show","JSDocExample","props","_$createIntrinsic","_$createComponent","when","fenced","children","_$memo","language"],"sources":["../../../src/components/JSDocExample.tsx"],"sourcesContent":[null],"mappings":";;;AAAA,SAASA,IAAI,QAAQ,gBAAgB;AASrC;AACA;AACA;AACA;AACA,OAAO,SAASC,YAAYA,CAACC,KAAwB,EAAE;EACrD,oBAAAC,iBAAA,aAAAC,iBAAA,CAIKJ,IAAI;IAAA,IAACK,IAAIA,CAAA;MAAA,OAAEH,KAAK,CAACI,MAAM;IAAA;IAAA,IAAAC,SAAA;MAAA,eAAAC,MAAA,OAClBN,KAAK,CAACO,QAAQ,GAAAN,iBAAA;IAAA;EAAA,IAAAK,MAAA,OAGnBN,KAAK,CAACK,QAAQ,GAAAH,iBAAA,CACdJ,IAAI;IAAA,IAACK,IAAIA,CAAA;MAAA,OAAEH,KAAK,CAACI,MAAM;IAAA;IAAA,IAAAC,SAAA;MAAA,QAAAJ,iBAAA;IAAA;EAAA;AAM9B","ignoreList":[]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Children } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
export interface JSDocParagraphProps {
|
|
3
|
+
children: Children;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Create a paragraph in a JSDoc comment. The text of this component is word
|
|
7
|
+
* wrapped.
|
|
8
|
+
*/
|
|
9
|
+
export declare function JSDocParagraph(props: JSDocParagraphProps): Children;
|
|
10
|
+
//# sourceMappingURL=JSDocParagraph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JSDocParagraph.d.ts","sourceRoot":"","sources":["../../../src/components/JSDocParagraph.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD,MAAM,WAAW,mBAAmB;IAClC,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,mBAAmB,YAuBxD"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { createIntrinsic as _$createIntrinsic } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { childrenArray, computed } from "@alloy-js/core";
|
|
3
|
+
/**
|
|
4
|
+
* Create a paragraph in a JSDoc comment. The text of this component is word
|
|
5
|
+
* wrapped.
|
|
6
|
+
*/
|
|
7
|
+
export function JSDocParagraph(props) {
|
|
8
|
+
const brokenChildren = computed(() => {
|
|
9
|
+
const children = childrenArray(() => props.children);
|
|
10
|
+
return children.map(child => {
|
|
11
|
+
if (typeof child === "string") {
|
|
12
|
+
return child.trim().split(/\s+/).map(word => [word, _$createIntrinsic("br", {})]);
|
|
13
|
+
}
|
|
14
|
+
return child;
|
|
15
|
+
}).flat(2);
|
|
16
|
+
});
|
|
17
|
+
return _$createIntrinsic("fill", {
|
|
18
|
+
get children() {
|
|
19
|
+
return brokenChildren.value;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=JSDocParagraph.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"JSDocParagraph.js","names":["childrenArray","computed","JSDocParagraph","props","brokenChildren","children","map","child","trim","split","word","_$createIntrinsic","flat","value"],"sources":["../../../src/components/JSDocParagraph.tsx"],"sourcesContent":[null],"mappings":";AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,gBAAgB;AAOxD;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAACC,KAA0B,EAAE;EACzD,MAAMC,cAAc,GAAGH,QAAQ,CAAC,MAAM;IACpC,MAAMI,QAAQ,GAAGL,aAAa,CAAC,MAAMG,KAAK,CAACE,QAAQ,CAAC;IACpD,OAAOA,QAAQ,CACZC,GAAG,CAAEC,KAAK,IAAK;MACd,IAAI,OAAOA,KAAK,KAAK,QAAQ,EAAE;QAC7B,OAAOA,KAAK,CACTC,IAAI,CAAC,CAAC,CACNC,KAAK,CAAC,KAAK,CAAC,CACZH,GAAG,CAAEI,IAAI,KAELA,IAAI,EAAAC,iBAAA,WAGR,CAAC;MACN;MAEA,OAAOJ,KAAK;IACd,CAAC,CAAC,CACDK,IAAI,CAAC,CAAC,CAAC;EACZ,CAAC,CAAC;EAEF,OAAAD,iBAAA;IAAA,IAAAN,SAAA;MAAA,OAAcD,cAAc,CAACS,KAAK;IAAA;EAAA;AACpC","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Children } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
export interface MemberChainExpressionProps {
|
|
3
|
+
children: Children;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Create a member chain expression, which is a member expression comprised of
|
|
7
|
+
* either children or {@link FunctionCallExpression} components. It is formatted
|
|
8
|
+
* such that when a linebreak is required, the FunctionCallExpression
|
|
9
|
+
*/
|
|
10
|
+
export declare function MemberChainExpression(props: MemberChainExpressionProps): Children;
|
|
11
|
+
//# sourceMappingURL=MemberChainExpression.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MemberChainExpression.d.ts","sourceRoot":"","sources":["../../../src/components/MemberChainExpression.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAsB,MAAM,4BAA4B,CAAC;AAG1E,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,QAAQ,CAAC;CACpB;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,YA6CtE"}
|