@powerlines/plugin-alloy 0.26.226 → 0.26.228
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/core/components/infrastructure-file.cjs +1 -1
- package/dist/core/components/source-file.cjs +1 -1
- package/dist/helpers/capnp.cjs +141 -87
- package/dist/helpers/capnp.d.cts +20 -15
- package/dist/helpers/capnp.d.cts.map +1 -1
- package/dist/helpers/capnp.d.mts +20 -15
- package/dist/helpers/capnp.mjs +142 -87
- package/dist/helpers/index.cjs +0 -3
- package/dist/helpers/index.d.cts +2 -3
- package/dist/helpers/index.d.mts +2 -3
- package/dist/helpers/index.mjs +2 -3
- package/dist/index.cjs +1 -1
- package/dist/markdown/components/alert.cjs +74 -0
- package/dist/markdown/components/alert.d.cts +53 -0
- package/dist/markdown/components/alert.d.cts.map +1 -0
- package/dist/markdown/components/alert.d.mts +53 -0
- package/dist/markdown/components/alert.d.mts.map +1 -0
- package/dist/markdown/components/alert.mjs +69 -0
- package/dist/markdown/components/alert.mjs.map +1 -0
- package/dist/markdown/components/index.cjs +8 -1
- package/dist/markdown/components/index.d.cts +2 -1
- package/dist/markdown/components/index.d.mts +2 -1
- package/dist/markdown/components/index.mjs +2 -1
- package/dist/markdown/index.cjs +7 -0
- package/dist/markdown/index.d.cts +2 -1
- package/dist/markdown/index.d.mts +2 -1
- package/dist/markdown/index.mjs +2 -1
- package/dist/typescript/components/builtin-file.cjs +5 -3
- package/dist/typescript/components/builtin-file.d.cts +6 -0
- package/dist/typescript/components/builtin-file.d.cts.map +1 -1
- package/dist/typescript/components/builtin-file.d.mts +6 -0
- package/dist/typescript/components/builtin-file.mjs +5 -3
- package/dist/typescript/components/entry-file.cjs +1 -1
- package/dist/typescript/components/interface-declaration.cjs +1 -1
- package/dist/typescript/components/interface-declaration.d.mts +1 -1
- package/dist/typescript/components/interface-declaration.mjs +1 -1
- package/dist/typescript/components/object-declaration.cjs +2 -2
- package/dist/typescript/components/object-declaration.d.mts +1 -1
- package/dist/typescript/components/object-declaration.mjs +2 -2
- package/dist/typescript/components/tsdoc-schema.cjs +2 -2
- package/dist/typescript/components/tsdoc-schema.mjs +2 -2
- package/dist/typescript/components/tsdoc.cjs +1 -1
- package/dist/typescript/components/tsdoc.d.mts +1 -1
- package/dist/typescript/components/tsdoc.mjs +1 -1
- package/package.json +23 -22
- package/dist/helpers/typescript.cjs +0 -47
- package/dist/helpers/typescript.d.cts +0 -24
- package/dist/helpers/typescript.d.cts.map +0 -1
- package/dist/helpers/typescript.d.mts +0 -24
- package/dist/helpers/typescript.d.mts.map +0 -1
- package/dist/helpers/typescript.mjs +0 -47
- package/dist/helpers/typescript.mjs.map +0 -1
package/dist/helpers/capnp.mjs
CHANGED
|
@@ -1,24 +1,19 @@
|
|
|
1
1
|
import defu from "defu";
|
|
2
2
|
import { titleCase } from "@stryke/string-format/title-case";
|
|
3
3
|
import { getFileHeader } from "powerlines/utils";
|
|
4
|
-
import {
|
|
5
|
-
import { camelCase } from "@stryke/string-format/camel-case";
|
|
6
|
-
import { isUndefined } from "@stryke/type-checks/is-undefined";
|
|
7
|
-
import { getClassName } from "@powerlines/deepkit/vendor/core";
|
|
8
|
-
import { ReflectionKind, memberNameToString } from "@powerlines/deepkit/vendor/type";
|
|
4
|
+
import { getPropertiesList, isJsonSchemaAnyOf, isJsonSchemaArray, isJsonSchemaBigint, isJsonSchemaBoolean, isJsonSchemaDate, isJsonSchemaEnum, isJsonSchemaInteger, isJsonSchemaLiteral, isJsonSchemaMap, isJsonSchemaNativeEnum, isJsonSchemaNever, isJsonSchemaNull, isJsonSchemaNumber, isJsonSchemaObject, isJsonSchemaRecord, isJsonSchemaRef, isJsonSchemaSet, isJsonSchemaString, isJsonSchemaTuple, isJsonSchemaUndefined, isJsonSchemaUnion } from "@powerlines/schema";
|
|
9
5
|
import { capnpc } from "@stryke/capnp/compile";
|
|
10
6
|
import { resolveOptions } from "@stryke/capnp/helpers";
|
|
11
7
|
import { toArray } from "@stryke/convert/to-array";
|
|
12
8
|
import { getUniqueBy } from "@stryke/helpers/get-unique";
|
|
13
9
|
import { StormJSON } from "@stryke/json";
|
|
14
10
|
import { joinPaths } from "@stryke/path/join";
|
|
11
|
+
import { camelCase } from "@stryke/string-format/camel-case";
|
|
15
12
|
import { getWords } from "@stryke/string-format/get-words";
|
|
16
13
|
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
17
14
|
import { isBigInt } from "@stryke/type-checks/is-bigint";
|
|
18
|
-
import { isNull } from "@stryke/type-checks/is-null";
|
|
19
15
|
import { isNumber } from "@stryke/type-checks/is-number";
|
|
20
16
|
import { isString } from "@stryke/type-checks/is-string";
|
|
21
|
-
import { Buffer } from "node:buffer";
|
|
22
17
|
import { exec } from "node:child_process";
|
|
23
18
|
import { promisify } from "node:util";
|
|
24
19
|
|
|
@@ -53,7 +48,7 @@ async function compile(context, options = {}) {
|
|
|
53
48
|
* @returns A string representation of the value.
|
|
54
49
|
*/
|
|
55
50
|
function stringifyCapnpDefaultValue(property, value) {
|
|
56
|
-
return stringifyCapnpValue(property
|
|
51
|
+
return stringifyCapnpValue(property, value ?? property.default);
|
|
57
52
|
}
|
|
58
53
|
/**
|
|
59
54
|
* Converts any {@link Type}'s actual value to string representation.
|
|
@@ -62,8 +57,8 @@ function stringifyCapnpDefaultValue(property, value) {
|
|
|
62
57
|
* @param value - The value to stringify.
|
|
63
58
|
* @returns A string representation of the value.
|
|
64
59
|
*/
|
|
65
|
-
function stringifyCapnpValue(
|
|
66
|
-
return
|
|
60
|
+
function stringifyCapnpValue(schema, value) {
|
|
61
|
+
return isJsonSchemaString(schema) || isJsonSchemaLiteral(schema) && isString(schema.const) ? `"${String(value)}"` : isJsonSchemaEnum(schema) || isJsonSchemaNativeEnum(schema) ? `${camelCase(String(value))}` : isJsonSchemaArray(schema) && !isJsonSchemaMap(schema) ? StormJSON.stringify(value) : isJsonSchemaObject(schema) || isJsonSchemaRecord(schema) ? StormJSON.stringify(value).replaceAll("{", "(").replaceAll("}", ")") : String(value);
|
|
67
62
|
}
|
|
68
63
|
/**
|
|
69
64
|
* Converts a ReflectionProperty's default value to a Cap'n Proto schema string representation.
|
|
@@ -71,11 +66,13 @@ function stringifyCapnpValue(type, value) {
|
|
|
71
66
|
* @param type - The TypeEnum to evaluate.
|
|
72
67
|
* @returns A string representation of the property.
|
|
73
68
|
*/
|
|
74
|
-
function getCapnpEnumTypes(
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
69
|
+
function getCapnpEnumTypes(schema) {
|
|
70
|
+
const s = schema;
|
|
71
|
+
if (!s.enum || !Array.isArray(s.enum)) return null;
|
|
72
|
+
const values = s.enum.filter((v) => v !== null && v !== void 0);
|
|
73
|
+
if (values.length === 0) return null;
|
|
74
|
+
const unique = getUniqueBy(values, (v) => isString(v) ? "Text" : "Float32");
|
|
75
|
+
return unique.length > 0 && isString(unique[0]) ? "Text" : "Float32";
|
|
79
76
|
}
|
|
80
77
|
/**
|
|
81
78
|
* Determines if a Type is a `Void` type in a Cap'n Proto schema.
|
|
@@ -83,8 +80,8 @@ function getCapnpEnumTypes(type) {
|
|
|
83
80
|
* @param type - The Type to check.
|
|
84
81
|
* @returns True if the Type is a `Void` type, false otherwise.
|
|
85
82
|
*/
|
|
86
|
-
function isVoidType(
|
|
87
|
-
return
|
|
83
|
+
function isVoidType(schema) {
|
|
84
|
+
return isJsonSchemaNever(schema) || isJsonSchemaNull(schema) || isJsonSchemaUndefined(schema);
|
|
88
85
|
}
|
|
89
86
|
/**
|
|
90
87
|
* Converts a {@link TypeUnion} to an array of its underlying Cap'n Proto primitive type representation.
|
|
@@ -92,8 +89,12 @@ function isVoidType(type) {
|
|
|
92
89
|
* @param type - The {@link TypeUnion} to convert.
|
|
93
90
|
* @returns A string representation of the Cap'n Proto primitive type.
|
|
94
91
|
*/
|
|
95
|
-
function getCapnpUnionTypes(
|
|
96
|
-
|
|
92
|
+
function getCapnpUnionTypes(schema) {
|
|
93
|
+
const s = schema;
|
|
94
|
+
if (Array.isArray(s.anyOf)) return s.anyOf;
|
|
95
|
+
if (Array.isArray(s.oneOf)) return s.oneOf;
|
|
96
|
+
if (Array.isArray(s.type)) return s.type.map((t) => ({ type: t }));
|
|
97
|
+
return [];
|
|
97
98
|
}
|
|
98
99
|
/**
|
|
99
100
|
* Converts a {@link TypeUnion} to an array of its underlying Cap'n Proto primitive type representation.
|
|
@@ -101,8 +102,8 @@ function getCapnpUnionTypes(type) {
|
|
|
101
102
|
* @param type - The {@link TypeUnion} to convert.
|
|
102
103
|
* @returns An array of Cap'n Proto primitive types.
|
|
103
104
|
*/
|
|
104
|
-
function isCapnpStringUnion(
|
|
105
|
-
return getCapnpUnionTypes(
|
|
105
|
+
function isCapnpStringUnion(schema) {
|
|
106
|
+
return getCapnpUnionTypes(schema).some((member) => isJsonSchemaString(member) || isJsonSchemaLiteral(member) && isString(member.const));
|
|
106
107
|
}
|
|
107
108
|
const LARGE_BUFFER = 1024 * 1e6;
|
|
108
109
|
const execAsync = promisify(exec);
|
|
@@ -114,44 +115,48 @@ async function generateCapnpId() {
|
|
|
114
115
|
});
|
|
115
116
|
return stdout;
|
|
116
117
|
}
|
|
117
|
-
async function generateCapnp(context,
|
|
118
|
+
async function generateCapnp(context, schema, options) {
|
|
118
119
|
return `${(await generateCapnpId()).trim()};
|
|
119
120
|
${getFileHeader(context).replace(/^\r*\n*/g, "").replaceAll("//", "#")}
|
|
120
|
-
${
|
|
121
|
+
${generateCapnpStruct(schema, options)}
|
|
121
122
|
`.trim();
|
|
122
123
|
}
|
|
123
|
-
function generateCapnpStruct(
|
|
124
|
-
const structName = options?.name ||
|
|
125
|
-
return `${generateCapnpEnums(
|
|
124
|
+
function generateCapnpStruct(schema, options = {}) {
|
|
125
|
+
const structName = options?.name || schema.title || schema.name || "Schema";
|
|
126
|
+
return `${generateCapnpEnums(schema)}struct ${pascalCase(structName)} {
|
|
126
127
|
# Struct definition for ${titleCase(structName)}.
|
|
127
128
|
|
|
128
|
-
${generateCapnpSchema(
|
|
129
|
+
${generateCapnpSchema(schema, options)}
|
|
129
130
|
}
|
|
130
131
|
`;
|
|
131
132
|
}
|
|
132
|
-
function generateCapnpInterface(
|
|
133
|
-
const interfaceName = options?.name ||
|
|
134
|
-
return `${generateCapnpEnums(
|
|
133
|
+
function generateCapnpInterface(schema, options = {}) {
|
|
134
|
+
const interfaceName = options?.name || schema.title || schema.name || "Schema";
|
|
135
|
+
return `${generateCapnpEnums(schema)}interface ${pascalCase(interfaceName)} {
|
|
135
136
|
# Interface definition for ${titleCase(interfaceName)}.
|
|
136
137
|
|
|
137
|
-
${generateCapnpSchema(
|
|
138
|
+
${generateCapnpSchema(schema, options)}
|
|
138
139
|
}
|
|
139
140
|
`;
|
|
140
141
|
}
|
|
141
142
|
function formatEnumName(name) {
|
|
142
143
|
return pascalCase(`${name}_Type`);
|
|
143
144
|
}
|
|
144
|
-
function generateCapnpEnums(
|
|
145
|
-
const enums =
|
|
145
|
+
function generateCapnpEnums(schema) {
|
|
146
|
+
const enums = getPropertiesList(schema).filter((prop) => !prop.ignore && (isJsonSchemaEnum(prop) || isJsonSchemaNativeEnum(prop) || (isJsonSchemaUnion(prop) || isJsonSchemaAnyOf(prop)) && getCapnpUnionTypes(prop).filter((t) => isJsonSchemaLiteral(t) && (isString(t.const) || isNumber(t.const))).length === 1)).sort((a, b) => a.readOnly && b.readOnly || !a.readOnly && !b.readOnly ? b.name.localeCompare(a.name) : a.readOnly ? 1 : -1);
|
|
146
147
|
if (enums.length === 0) return "";
|
|
147
|
-
return `${enums.map((
|
|
148
|
+
return `${enums.map((prop) => generateCapnpEnumSchema(prop, formatEnumName(prop.name))).join("\n\n")}
|
|
148
149
|
|
|
149
150
|
`;
|
|
150
151
|
}
|
|
151
|
-
function generateCapnpSchema(
|
|
152
|
+
function generateCapnpSchema(schema, options = {}) {
|
|
152
153
|
let index = 0;
|
|
153
154
|
const indexCounter = options?.indexCounter ?? (() => index++);
|
|
154
|
-
|
|
155
|
+
const props = getPropertiesList(schema);
|
|
156
|
+
const filteredProps = props.filter((prop) => !prop.ignore).sort((a, b) => a.readOnly && b.readOnly || !a.readOnly && !b.readOnly ? b.name.localeCompare(a.name) : a.readOnly ? 1 : -1);
|
|
157
|
+
const hasMap = props.some((prop) => isJsonSchemaMap(prop));
|
|
158
|
+
const hasDate = props.some((prop) => isJsonSchemaDate(prop));
|
|
159
|
+
return `${filteredProps.map((prop) => generateCapnpPropertySchema(prop, indexCounter)).join(" \n\n ")}${hasMap ? `
|
|
155
160
|
struct Map(Key, Value) {
|
|
156
161
|
entries @0 :List(Entry);
|
|
157
162
|
|
|
@@ -159,7 +164,7 @@ function generateCapnpSchema(reflection, options = {}) {
|
|
|
159
164
|
key @0 :Key;
|
|
160
165
|
value @1 :Value;
|
|
161
166
|
}
|
|
162
|
-
}` : ""}${
|
|
167
|
+
}` : ""}${hasDate ? `
|
|
163
168
|
struct Date {
|
|
164
169
|
# A standard Gregorian calendar date.
|
|
165
170
|
|
|
@@ -180,15 +185,8 @@ function generateCapnpSchema(reflection, options = {}) {
|
|
|
180
185
|
millisecond @6 :UInt16; # Milliseconds of the second, 0-999
|
|
181
186
|
}` : ""}`;
|
|
182
187
|
}
|
|
183
|
-
function
|
|
184
|
-
const
|
|
185
|
-
if (!methodName) throw new Error(`Cannot generate Cap'n Proto schema for method without a name - Parent interface: ${reflection.reflectionClass.getName()}`);
|
|
186
|
-
return `${camelCase(methodName)} @${indexCounter()} (${reflection.getParameters().map((param) => {
|
|
187
|
-
return `${camelCase(param.getName())} :${generateCapnpPrimitive(param.getType())}${param.hasDefault() ? ` = ${stringifyCapnpDefaultValue(param)}` : ""}`;
|
|
188
|
-
}).join(", ")})${isVoidType(reflection.getReturnType()) ? "" : ` -> (${kindToName(reflection.getReturnType().kind)}: ${generateCapnpPrimitive(reflection.getReturnType())})`}; # ${(reflection.getDescription() || `The ${titleCase(reflection.reflectionClass.getTitle() || reflection.reflectionClass.getName())} interface ${titleCase(methodName)} method.`).replaceAll("\n", ". ")}`;
|
|
189
|
-
}
|
|
190
|
-
function generateCapnpPropertyComment(reflection) {
|
|
191
|
-
const result = getWords(reflection.getDescription() || `A schema property for ${titleCase(reflection.getTitle() || reflection.getNameAsString())} field.`, { relaxed: true }).reduce((ret, word) => {
|
|
188
|
+
function generateCapnpPropertyComment(prop) {
|
|
189
|
+
const result = getWords(prop.description || `A schema property for ${titleCase(prop.title || prop.name)} field.`, { relaxed: true }).reduce((ret, word) => {
|
|
192
190
|
let length = ret.length;
|
|
193
191
|
if (ret.includes("\n")) length = ret.substring(ret.lastIndexOf("\n") + 1).length;
|
|
194
192
|
const current = word.trim();
|
|
@@ -199,50 +197,65 @@ function generateCapnpPropertyComment(reflection) {
|
|
|
199
197
|
if (result.length > 0) return `\t# ${result}`;
|
|
200
198
|
return "";
|
|
201
199
|
}
|
|
202
|
-
function generateCapnpPropertySchema(
|
|
203
|
-
|
|
204
|
-
${
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
${
|
|
200
|
+
function generateCapnpPropertySchema(prop, indexCounter) {
|
|
201
|
+
const propName = prop.name;
|
|
202
|
+
const defaultStr = prop.default !== void 0 ? ` = ${stringifyCapnpDefaultValue(prop)}` : "";
|
|
203
|
+
if (isJsonSchemaUnion(prop) || isJsonSchemaAnyOf(prop)) {
|
|
204
|
+
const unionTypes = getCapnpUnionTypes(prop);
|
|
205
|
+
if (unionTypes.length === 0) return `${camelCase(propName)} @${indexCounter()} :Void;
|
|
206
|
+
${generateCapnpPropertyComment(prop)}`;
|
|
207
|
+
else if (unionTypes.filter((t) => isJsonSchemaLiteral(t) && (isString(t.const) || isNumber(t.const))).length === 1) return `${camelCase(propName)} @${indexCounter()} :${formatEnumName(propName)}${defaultStr};
|
|
208
|
+
${generateCapnpPropertyComment(prop)}`;
|
|
209
|
+
else return `${camelCase(propName)} :union {
|
|
210
|
+
${unionTypes.map((t) => {
|
|
211
|
+
return ` ${getJsonSchemaCapnpTypeName(t)} @${indexCounter()} :${generateCapnpPrimitive(t)};`;
|
|
212
|
+
}).join("\n")}
|
|
209
213
|
}
|
|
210
|
-
${generateCapnpPropertyComment(
|
|
211
|
-
else if (
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
${
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
${
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
${
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
214
|
+
${generateCapnpPropertyComment(prop)}`;
|
|
215
|
+
} else if (isJsonSchemaMap(prop)) {
|
|
216
|
+
const keySchema = prop.items?.prefixItems?.[0];
|
|
217
|
+
const valueSchema = prop.items?.prefixItems?.[1];
|
|
218
|
+
return `${camelCase(propName)} @${indexCounter()} :Map(${keySchema ? generateCapnpPrimitive(keySchema) : "Data"}, ${valueSchema ? generateCapnpPrimitive(valueSchema) : "Data"})${defaultStr};
|
|
219
|
+
${generateCapnpPropertyComment(prop)}`;
|
|
220
|
+
} else if (isJsonSchemaDate(prop)) return `${camelCase(propName)} @${indexCounter()} :Data${defaultStr};
|
|
221
|
+
${generateCapnpPropertyComment(prop)}`;
|
|
222
|
+
else if (isJsonSchemaSet(prop) || isJsonSchemaTuple(prop)) {
|
|
223
|
+
const itemSchema = prop.items;
|
|
224
|
+
return `${camelCase(propName)} @${indexCounter()} :List(${itemSchema ? generateCapnpPrimitive(itemSchema) : "Data"})${defaultStr};
|
|
225
|
+
${generateCapnpPropertyComment(prop)}`;
|
|
226
|
+
} else if (isJsonSchemaArray(prop)) {
|
|
227
|
+
const itemSchema = prop.items;
|
|
228
|
+
return `${camelCase(propName)} @${indexCounter()} :List(${itemSchema ? generateCapnpPrimitive(itemSchema) : "Data"})${defaultStr};
|
|
229
|
+
${generateCapnpPropertyComment(prop)}`;
|
|
230
|
+
} else if (isJsonSchemaRef(prop)) {
|
|
231
|
+
const refName = prop.$ref.split("/").pop() || prop.$ref;
|
|
232
|
+
return `${camelCase(propName)} @${indexCounter()} :${pascalCase(refName)}${defaultStr};
|
|
233
|
+
${generateCapnpPropertyComment(prop)}`;
|
|
234
|
+
} else if (isJsonSchemaObject(prop) || isJsonSchemaRecord(prop)) {
|
|
235
|
+
const typeName = prop.title || propName;
|
|
236
|
+
return `${camelCase(propName)} @${indexCounter()} :${pascalCase(typeName)}${generateCapnpStruct(prop, { name: pascalCase(typeName) })}${defaultStr};
|
|
237
|
+
${generateCapnpPropertyComment(prop)}`;
|
|
238
|
+
} else if (isJsonSchemaEnum(prop) || isJsonSchemaNativeEnum(prop)) return `${camelCase(propName)} @${indexCounter()} :${pascalCase(propName)}${defaultStr};
|
|
239
|
+
${generateCapnpPropertyComment(prop)}`;
|
|
240
|
+
return `${camelCase(propName)} @${indexCounter()} :${generateCapnpPrimitive(prop)}${defaultStr};
|
|
241
|
+
${generateCapnpPropertyComment(prop)}`;
|
|
229
242
|
}
|
|
230
|
-
function generateCapnpEnumSchema(
|
|
231
|
-
if (
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
values: getCapnpUnionTypes(type).filter((type) => type.kind === ReflectionKind.literal && (isString(type.literal) || isNumber(type.literal))).map((type) => type.literal)
|
|
239
|
-
}, name);
|
|
243
|
+
function generateCapnpEnumSchema(schema, name) {
|
|
244
|
+
if (isJsonSchemaAnyOf(schema)) {
|
|
245
|
+
const enumValues = (schema.anyOf || []).filter((t) => isJsonSchemaLiteral(t) && (isString(t.const) || isNumber(t.const))).map((t) => t.const);
|
|
246
|
+
return generateCapnpEnumSchema({
|
|
247
|
+
type: enumValues.some((v) => isString(v)) ? "string" : "number",
|
|
248
|
+
enum: enumValues
|
|
249
|
+
}, name);
|
|
250
|
+
}
|
|
240
251
|
let index = 0;
|
|
241
252
|
const indexCounter = () => index++;
|
|
242
|
-
const enumType = getCapnpEnumTypes(
|
|
253
|
+
const enumType = getCapnpEnumTypes(schema);
|
|
243
254
|
if (!enumType) return "";
|
|
255
|
+
const values = (schema.enum || []).filter((v) => v !== null && v !== void 0);
|
|
256
|
+
const schemaTitle = schema.title;
|
|
244
257
|
return `enum ${pascalCase(name)} {
|
|
245
|
-
${
|
|
258
|
+
${values.map((value) => ` ${enumType === "Text" && value ? camelCase(String(value)) : `${schemaTitle ? `${camelCase(schemaTitle)}_` : ""}${value || ""}`} @${indexCounter()};`).join("\n")}
|
|
246
259
|
}`;
|
|
247
260
|
}
|
|
248
261
|
/**
|
|
@@ -251,10 +264,52 @@ ${type.enum && Object.entries(type.enum).length > 0 ? Object.entries(type.enum).
|
|
|
251
264
|
* @param type - The Deepkit Type to convert.
|
|
252
265
|
* @returns A string representation of the Cap'n Proto primitive type.
|
|
253
266
|
*/
|
|
254
|
-
|
|
255
|
-
|
|
267
|
+
/**
|
|
268
|
+
* Generates a string representation of Cap'n Proto primitive types from a JSON Schema.
|
|
269
|
+
*
|
|
270
|
+
* @param schema - The JSON Schema to convert.
|
|
271
|
+
* @returns A string representation of the Cap'n Proto primitive type.
|
|
272
|
+
*/
|
|
273
|
+
function generateCapnpPrimitive(schema) {
|
|
274
|
+
if (isJsonSchemaNever(schema) || isJsonSchemaNull(schema) || isJsonSchemaUndefined(schema)) return "Void";
|
|
275
|
+
if (isJsonSchemaDate(schema)) return "Date";
|
|
276
|
+
if (isJsonSchemaSet(schema)) {
|
|
277
|
+
const itemSchema = schema.items;
|
|
278
|
+
return `List(${itemSchema ? generateCapnpPrimitive(itemSchema) : "Data"})`;
|
|
279
|
+
}
|
|
280
|
+
if (isJsonSchemaBigint(schema)) return "UInt64";
|
|
281
|
+
if (isJsonSchemaNumber(schema) || isJsonSchemaInteger(schema)) return "Float64";
|
|
282
|
+
if (isJsonSchemaString(schema)) return "Text";
|
|
283
|
+
if (isJsonSchemaBoolean(schema)) return "Bool";
|
|
284
|
+
if (isJsonSchemaLiteral(schema)) {
|
|
285
|
+
const constVal = schema.const;
|
|
286
|
+
if (isNumber(constVal)) return "Float64";
|
|
287
|
+
if (isBigInt(constVal)) return "UInt64";
|
|
288
|
+
if (isString(constVal)) return "Text";
|
|
289
|
+
if (typeof constVal === "boolean") return "Bool";
|
|
290
|
+
}
|
|
291
|
+
return "Data";
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Returns a descriptive Cap'n Proto field name for a JSON Schema member in a union.
|
|
295
|
+
*
|
|
296
|
+
* @param schema - The JSON Schema union member.
|
|
297
|
+
* @returns A camelCase name suitable for use as a Cap'n Proto union field label.
|
|
298
|
+
*/
|
|
299
|
+
function getJsonSchemaCapnpTypeName(schema) {
|
|
300
|
+
const s = schema;
|
|
301
|
+
if (s.title || s.name) return camelCase(String(s.title || s.name));
|
|
302
|
+
if (s.type) return camelCase(Array.isArray(s.type) ? String(s.type[0]) : String(s.type));
|
|
303
|
+
if ("const" in s) {
|
|
304
|
+
if (isString(s.const)) return "string";
|
|
305
|
+
if (isNumber(s.const)) return "number";
|
|
306
|
+
if (typeof s.const === "boolean") return "bool";
|
|
307
|
+
if (isBigInt(s.const)) return "bigInt";
|
|
308
|
+
}
|
|
309
|
+
if (s.anyOf) return "union";
|
|
310
|
+
return "data";
|
|
256
311
|
}
|
|
257
312
|
|
|
258
313
|
//#endregion
|
|
259
|
-
export { LARGE_BUFFER, compile, generateCapnp, generateCapnpEnumSchema, generateCapnpId, generateCapnpInterface,
|
|
314
|
+
export { LARGE_BUFFER, compile, generateCapnp, generateCapnpEnumSchema, generateCapnpId, generateCapnpInterface, generateCapnpPrimitive, generateCapnpSchema, generateCapnpStruct, getCapnpEnumTypes, getCapnpUnionTypes, isCapnpStringUnion, isVoidType, stringifyCapnpDefaultValue, stringifyCapnpValue };
|
|
260
315
|
//# sourceMappingURL=capnp.mjs.map
|
package/dist/helpers/index.cjs
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_helpers_typescript = require('./typescript.cjs');
|
|
3
2
|
const require_helpers_refkey = require('./refkey.cjs');
|
|
4
3
|
const require_helpers_capnp = require('./capnp.cjs');
|
|
5
4
|
const require_helpers_create_builtin = require('./create-builtin.cjs');
|
|
@@ -11,11 +10,9 @@ exports.generateCapnp = require_helpers_capnp.generateCapnp;
|
|
|
11
10
|
exports.generateCapnpEnumSchema = require_helpers_capnp.generateCapnpEnumSchema;
|
|
12
11
|
exports.generateCapnpId = require_helpers_capnp.generateCapnpId;
|
|
13
12
|
exports.generateCapnpInterface = require_helpers_capnp.generateCapnpInterface;
|
|
14
|
-
exports.generateCapnpMethodSchema = require_helpers_capnp.generateCapnpMethodSchema;
|
|
15
13
|
exports.generateCapnpPrimitive = require_helpers_capnp.generateCapnpPrimitive;
|
|
16
14
|
exports.generateCapnpSchema = require_helpers_capnp.generateCapnpSchema;
|
|
17
15
|
exports.generateCapnpStruct = require_helpers_capnp.generateCapnpStruct;
|
|
18
|
-
exports.generateObjectDeclaration = require_helpers_typescript.generateObjectDeclaration;
|
|
19
16
|
exports.getCapnpEnumTypes = require_helpers_capnp.getCapnpEnumTypes;
|
|
20
17
|
exports.getCapnpUnionTypes = require_helpers_capnp.getCapnpUnionTypes;
|
|
21
18
|
exports.isCapnpStringUnion = require_helpers_capnp.isCapnpStringUnion;
|
package/dist/helpers/index.d.cts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { GenerateCapnpOptions, GenerateCapnpStructOptions, IOType, LARGE_BUFFER, StdioOptions, compile, generateCapnp, generateCapnpEnumSchema, generateCapnpId, generateCapnpInterface,
|
|
1
|
+
import { GenerateCapnpOptions, GenerateCapnpStructOptions, IOType, LARGE_BUFFER, StdioOptions, compile, generateCapnp, generateCapnpEnumSchema, generateCapnpId, generateCapnpInterface, generateCapnpPrimitive, generateCapnpSchema, generateCapnpStruct, getCapnpEnumTypes, getCapnpUnionTypes, isCapnpStringUnion, isVoidType, stringifyCapnpDefaultValue, stringifyCapnpValue } from "./capnp.cjs";
|
|
2
2
|
import { CreateBuiltinOptions, createBuiltin } from "./create-builtin.cjs";
|
|
3
3
|
import { refkey } from "./refkey.cjs";
|
|
4
|
-
|
|
5
|
-
export { CreateBuiltinOptions, GenerateCapnpOptions, GenerateCapnpStructOptions, GenerateInterfaceDeclarationOptions, GenerateObjectDeclarationOptions, IOType, LARGE_BUFFER, StdioOptions, compile, createBuiltin, generateCapnp, generateCapnpEnumSchema, generateCapnpId, generateCapnpInterface, generateCapnpMethodSchema, generateCapnpPrimitive, generateCapnpSchema, generateCapnpStruct, generateObjectDeclaration, getCapnpEnumTypes, getCapnpUnionTypes, isCapnpStringUnion, isVoidType, refkey, stringifyCapnpDefaultValue, stringifyCapnpValue };
|
|
4
|
+
export { CreateBuiltinOptions, GenerateCapnpOptions, GenerateCapnpStructOptions, IOType, LARGE_BUFFER, StdioOptions, compile, createBuiltin, generateCapnp, generateCapnpEnumSchema, generateCapnpId, generateCapnpInterface, generateCapnpPrimitive, generateCapnpSchema, generateCapnpStruct, getCapnpEnumTypes, getCapnpUnionTypes, isCapnpStringUnion, isVoidType, refkey, stringifyCapnpDefaultValue, stringifyCapnpValue };
|
package/dist/helpers/index.d.mts
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import { GenerateCapnpOptions, GenerateCapnpStructOptions, IOType, LARGE_BUFFER, StdioOptions, compile, generateCapnp, generateCapnpEnumSchema, generateCapnpId, generateCapnpInterface,
|
|
1
|
+
import { GenerateCapnpOptions, GenerateCapnpStructOptions, IOType, LARGE_BUFFER, StdioOptions, compile, generateCapnp, generateCapnpEnumSchema, generateCapnpId, generateCapnpInterface, generateCapnpPrimitive, generateCapnpSchema, generateCapnpStruct, getCapnpEnumTypes, getCapnpUnionTypes, isCapnpStringUnion, isVoidType, stringifyCapnpDefaultValue, stringifyCapnpValue } from "./capnp.mjs";
|
|
2
2
|
import { CreateBuiltinOptions, createBuiltin } from "./create-builtin.mjs";
|
|
3
3
|
import { refkey } from "./refkey.mjs";
|
|
4
|
-
|
|
5
|
-
export { CreateBuiltinOptions, GenerateCapnpOptions, GenerateCapnpStructOptions, GenerateInterfaceDeclarationOptions, GenerateObjectDeclarationOptions, IOType, LARGE_BUFFER, StdioOptions, compile, createBuiltin, generateCapnp, generateCapnpEnumSchema, generateCapnpId, generateCapnpInterface, generateCapnpMethodSchema, generateCapnpPrimitive, generateCapnpSchema, generateCapnpStruct, generateObjectDeclaration, getCapnpEnumTypes, getCapnpUnionTypes, isCapnpStringUnion, isVoidType, refkey, stringifyCapnpDefaultValue, stringifyCapnpValue };
|
|
4
|
+
export { CreateBuiltinOptions, GenerateCapnpOptions, GenerateCapnpStructOptions, IOType, LARGE_BUFFER, StdioOptions, compile, createBuiltin, generateCapnp, generateCapnpEnumSchema, generateCapnpId, generateCapnpInterface, generateCapnpPrimitive, generateCapnpSchema, generateCapnpStruct, getCapnpEnumTypes, getCapnpUnionTypes, isCapnpStringUnion, isVoidType, refkey, stringifyCapnpDefaultValue, stringifyCapnpValue };
|
package/dist/helpers/index.mjs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { generateObjectDeclaration } from "./typescript.mjs";
|
|
2
1
|
import { refkey } from "./refkey.mjs";
|
|
3
|
-
import { LARGE_BUFFER, compile, generateCapnp, generateCapnpEnumSchema, generateCapnpId, generateCapnpInterface,
|
|
2
|
+
import { LARGE_BUFFER, compile, generateCapnp, generateCapnpEnumSchema, generateCapnpId, generateCapnpInterface, generateCapnpPrimitive, generateCapnpSchema, generateCapnpStruct, getCapnpEnumTypes, getCapnpUnionTypes, isCapnpStringUnion, isVoidType, stringifyCapnpDefaultValue, stringifyCapnpValue } from "./capnp.mjs";
|
|
4
3
|
import { createBuiltin } from "./create-builtin.mjs";
|
|
5
4
|
|
|
6
|
-
export { LARGE_BUFFER, compile, createBuiltin, generateCapnp, generateCapnpEnumSchema, generateCapnpId, generateCapnpInterface,
|
|
5
|
+
export { LARGE_BUFFER, compile, createBuiltin, generateCapnp, generateCapnpEnumSchema, generateCapnpId, generateCapnpInterface, generateCapnpPrimitive, generateCapnpSchema, generateCapnpStruct, getCapnpEnumTypes, getCapnpUnionTypes, isCapnpStringUnion, isVoidType, refkey, stringifyCapnpDefaultValue, stringifyCapnpValue };
|
package/dist/index.cjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
2
|
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
3
|
let _powerlines_plugin_babel = require("@powerlines/plugin-babel");
|
|
4
|
-
_powerlines_plugin_babel = require_runtime.__toESM(_powerlines_plugin_babel);
|
|
4
|
+
_powerlines_plugin_babel = require_runtime.__toESM(_powerlines_plugin_babel, 1);
|
|
5
5
|
let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
6
6
|
|
|
7
7
|
//#region src/index.tsx
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_core_components_spacing = require('../../core/components/spacing.cjs');
|
|
3
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
4
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
5
|
+
|
|
6
|
+
//#region src/markdown/components/alert.tsx
|
|
7
|
+
/**
|
|
8
|
+
* Renders an alert component for a markdown file.
|
|
9
|
+
*
|
|
10
|
+
* @see https://github.blog/changelog/2023-12-14-new-markdown-extension-alerts-provide-distinctive-styling-for-significant-content/
|
|
11
|
+
* @see https://github.com/KeJunMao/vscode-markdown-alert
|
|
12
|
+
*/
|
|
13
|
+
function Alert(props) {
|
|
14
|
+
return [
|
|
15
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`> [!${props.variant.toUpperCase()}]`),
|
|
16
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
17
|
+
_alloy_js_core.code`> `,
|
|
18
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => props.children),
|
|
19
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_core_components_spacing.Spacing, {})
|
|
20
|
+
];
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Renders a Note alert component for a markdown file.
|
|
24
|
+
*
|
|
25
|
+
* @see https://github.blog/changelog/2023-12-14-new-markdown-extension-alerts-provide-distinctive-styling-for-significant-content/
|
|
26
|
+
* @see https://github.com/KeJunMao/vscode-markdown-alert
|
|
27
|
+
*/
|
|
28
|
+
function NoteAlert(props) {
|
|
29
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(Alert, (0, _alloy_js_core_jsx_runtime.mergeProps)({ variant: "note" }, props));
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Renders a Tip alert component for a markdown file.
|
|
33
|
+
*
|
|
34
|
+
* @see https://github.blog/changelog/2023-12-14-new-markdown-extension-alerts-provide-distinctive-styling-for-significant-content/
|
|
35
|
+
* @see https://github.com/KeJunMao/vscode-markdown-alert
|
|
36
|
+
*/
|
|
37
|
+
function TipAlert(props) {
|
|
38
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(Alert, (0, _alloy_js_core_jsx_runtime.mergeProps)({ variant: "tip" }, props));
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Renders an Important alert component for a markdown file.
|
|
42
|
+
*
|
|
43
|
+
* @see https://github.blog/changelog/2023-12-14-new-markdown-extension-alerts-provide-distinctive-styling-for-significant-content/
|
|
44
|
+
* @see https://github.com/KeJunMao/vscode-markdown-alert
|
|
45
|
+
*/
|
|
46
|
+
function ImportantAlert(props) {
|
|
47
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(Alert, (0, _alloy_js_core_jsx_runtime.mergeProps)({ variant: "important" }, props));
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Renders a Warning alert component for a markdown file.
|
|
51
|
+
*
|
|
52
|
+
* @see https://github.blog/changelog/2023-12-14-new-markdown-extension-alerts-provide-distinctive-styling-for-significant-content/
|
|
53
|
+
* @see https://github.com/KeJunMao/vscode-markdown-alert
|
|
54
|
+
*/
|
|
55
|
+
function WarningAlert(props) {
|
|
56
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(Alert, (0, _alloy_js_core_jsx_runtime.mergeProps)({ variant: "warning" }, props));
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Renders a Caution alert component for a markdown file.
|
|
60
|
+
*
|
|
61
|
+
* @see https://github.blog/changelog/2023-12-14-new-markdown-extension-alerts-provide-distinctive-styling-for-significant-content/
|
|
62
|
+
* @see https://github.com/KeJunMao/vscode-markdown-alert
|
|
63
|
+
*/
|
|
64
|
+
function CautionAlert(props) {
|
|
65
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(Alert, (0, _alloy_js_core_jsx_runtime.mergeProps)({ variant: "caution" }, props));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
//#endregion
|
|
69
|
+
exports.Alert = Alert;
|
|
70
|
+
exports.CautionAlert = CautionAlert;
|
|
71
|
+
exports.ImportantAlert = ImportantAlert;
|
|
72
|
+
exports.NoteAlert = NoteAlert;
|
|
73
|
+
exports.TipAlert = TipAlert;
|
|
74
|
+
exports.WarningAlert = WarningAlert;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Children } from "@alloy-js/core";
|
|
2
|
+
|
|
3
|
+
//#region src/markdown/components/alert.d.ts
|
|
4
|
+
interface AlertProps {
|
|
5
|
+
variant: "note" | "tip" | "important" | "warning" | "caution";
|
|
6
|
+
children: Children;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Renders an alert component for a markdown file.
|
|
10
|
+
*
|
|
11
|
+
* @see https://github.blog/changelog/2023-12-14-new-markdown-extension-alerts-provide-distinctive-styling-for-significant-content/
|
|
12
|
+
* @see https://github.com/KeJunMao/vscode-markdown-alert
|
|
13
|
+
*/
|
|
14
|
+
declare function Alert(props: AlertProps): Children;
|
|
15
|
+
type AlertVariantProps = Omit<AlertProps, "variant">;
|
|
16
|
+
/**
|
|
17
|
+
* Renders a Note alert component for a markdown file.
|
|
18
|
+
*
|
|
19
|
+
* @see https://github.blog/changelog/2023-12-14-new-markdown-extension-alerts-provide-distinctive-styling-for-significant-content/
|
|
20
|
+
* @see https://github.com/KeJunMao/vscode-markdown-alert
|
|
21
|
+
*/
|
|
22
|
+
declare function NoteAlert(props: AlertVariantProps): Children;
|
|
23
|
+
/**
|
|
24
|
+
* Renders a Tip alert component for a markdown file.
|
|
25
|
+
*
|
|
26
|
+
* @see https://github.blog/changelog/2023-12-14-new-markdown-extension-alerts-provide-distinctive-styling-for-significant-content/
|
|
27
|
+
* @see https://github.com/KeJunMao/vscode-markdown-alert
|
|
28
|
+
*/
|
|
29
|
+
declare function TipAlert(props: AlertVariantProps): Children;
|
|
30
|
+
/**
|
|
31
|
+
* Renders an Important alert component for a markdown file.
|
|
32
|
+
*
|
|
33
|
+
* @see https://github.blog/changelog/2023-12-14-new-markdown-extension-alerts-provide-distinctive-styling-for-significant-content/
|
|
34
|
+
* @see https://github.com/KeJunMao/vscode-markdown-alert
|
|
35
|
+
*/
|
|
36
|
+
declare function ImportantAlert(props: AlertVariantProps): Children;
|
|
37
|
+
/**
|
|
38
|
+
* Renders a Warning alert component for a markdown file.
|
|
39
|
+
*
|
|
40
|
+
* @see https://github.blog/changelog/2023-12-14-new-markdown-extension-alerts-provide-distinctive-styling-for-significant-content/
|
|
41
|
+
* @see https://github.com/KeJunMao/vscode-markdown-alert
|
|
42
|
+
*/
|
|
43
|
+
declare function WarningAlert(props: AlertVariantProps): Children;
|
|
44
|
+
/**
|
|
45
|
+
* Renders a Caution alert component for a markdown file.
|
|
46
|
+
*
|
|
47
|
+
* @see https://github.blog/changelog/2023-12-14-new-markdown-extension-alerts-provide-distinctive-styling-for-significant-content/
|
|
48
|
+
* @see https://github.com/KeJunMao/vscode-markdown-alert
|
|
49
|
+
*/
|
|
50
|
+
declare function CautionAlert(props: AlertVariantProps): Children;
|
|
51
|
+
//#endregion
|
|
52
|
+
export { Alert, AlertProps, AlertVariantProps, CautionAlert, ImportantAlert, NoteAlert, TipAlert, WarningAlert };
|
|
53
|
+
//# sourceMappingURL=alert.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert.d.cts","names":[],"sources":["../../../src/markdown/components/alert.tsx"],"mappings":";;;UAqBiB,UAAA;EACf,OAAA;EACA,QAAA,EAAU,QAAQ;AAAA;;;;;;;iBASJ,KAAA,CAAM,KAAA,EAAO,UAAA,GAAU,QAAA;AAAA,KAY3B,iBAAA,GAAoB,IAAI,CAAC,UAAA;;;;;;;iBAQrB,SAAA,CAAU,KAAA,EAAO,iBAAA,GAAiB,QAAA;AApBX;AAYvC;;;;AAA+C;AAZR,iBA8BvB,QAAA,CAAS,KAAA,EAAO,iBAAA,GAAiB,QAAA;;;;;;;iBAUjC,cAAA,CAAe,KAAA,EAAO,iBAAA,GAAiB,QAAA;AApBL;AAUlD;;;;;AAVkD,iBA8BlC,YAAA,CAAa,KAAA,EAAO,iBAAA,GAAiB,QAAA;;;AApBJ;AAUjD;;;iBAoBgB,YAAA,CAAa,KAAA,EAAO,iBAAA,GAAiB,QAAA"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { Children } from "@alloy-js/core";
|
|
2
|
+
|
|
3
|
+
//#region src/markdown/components/alert.d.ts
|
|
4
|
+
interface AlertProps {
|
|
5
|
+
variant: "note" | "tip" | "important" | "warning" | "caution";
|
|
6
|
+
children: Children;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Renders an alert component for a markdown file.
|
|
10
|
+
*
|
|
11
|
+
* @see https://github.blog/changelog/2023-12-14-new-markdown-extension-alerts-provide-distinctive-styling-for-significant-content/
|
|
12
|
+
* @see https://github.com/KeJunMao/vscode-markdown-alert
|
|
13
|
+
*/
|
|
14
|
+
declare function Alert(props: AlertProps): Children;
|
|
15
|
+
type AlertVariantProps = Omit<AlertProps, "variant">;
|
|
16
|
+
/**
|
|
17
|
+
* Renders a Note alert component for a markdown file.
|
|
18
|
+
*
|
|
19
|
+
* @see https://github.blog/changelog/2023-12-14-new-markdown-extension-alerts-provide-distinctive-styling-for-significant-content/
|
|
20
|
+
* @see https://github.com/KeJunMao/vscode-markdown-alert
|
|
21
|
+
*/
|
|
22
|
+
declare function NoteAlert(props: AlertVariantProps): Children;
|
|
23
|
+
/**
|
|
24
|
+
* Renders a Tip alert component for a markdown file.
|
|
25
|
+
*
|
|
26
|
+
* @see https://github.blog/changelog/2023-12-14-new-markdown-extension-alerts-provide-distinctive-styling-for-significant-content/
|
|
27
|
+
* @see https://github.com/KeJunMao/vscode-markdown-alert
|
|
28
|
+
*/
|
|
29
|
+
declare function TipAlert(props: AlertVariantProps): Children;
|
|
30
|
+
/**
|
|
31
|
+
* Renders an Important alert component for a markdown file.
|
|
32
|
+
*
|
|
33
|
+
* @see https://github.blog/changelog/2023-12-14-new-markdown-extension-alerts-provide-distinctive-styling-for-significant-content/
|
|
34
|
+
* @see https://github.com/KeJunMao/vscode-markdown-alert
|
|
35
|
+
*/
|
|
36
|
+
declare function ImportantAlert(props: AlertVariantProps): Children;
|
|
37
|
+
/**
|
|
38
|
+
* Renders a Warning alert component for a markdown file.
|
|
39
|
+
*
|
|
40
|
+
* @see https://github.blog/changelog/2023-12-14-new-markdown-extension-alerts-provide-distinctive-styling-for-significant-content/
|
|
41
|
+
* @see https://github.com/KeJunMao/vscode-markdown-alert
|
|
42
|
+
*/
|
|
43
|
+
declare function WarningAlert(props: AlertVariantProps): Children;
|
|
44
|
+
/**
|
|
45
|
+
* Renders a Caution alert component for a markdown file.
|
|
46
|
+
*
|
|
47
|
+
* @see https://github.blog/changelog/2023-12-14-new-markdown-extension-alerts-provide-distinctive-styling-for-significant-content/
|
|
48
|
+
* @see https://github.com/KeJunMao/vscode-markdown-alert
|
|
49
|
+
*/
|
|
50
|
+
declare function CautionAlert(props: AlertVariantProps): Children;
|
|
51
|
+
//#endregion
|
|
52
|
+
export { Alert, AlertProps, AlertVariantProps, CautionAlert, ImportantAlert, NoteAlert, TipAlert, WarningAlert };
|
|
53
|
+
//# sourceMappingURL=alert.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"alert.d.mts","names":[],"sources":["../../../src/markdown/components/alert.tsx"],"mappings":""}
|