@jxsuite/schema 0.22.0 → 0.23.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/package.json +1 -1
- package/schema.json +2726 -299
- package/src/schema.js +147 -1
package/src/schema.js
CHANGED
|
@@ -285,6 +285,8 @@ export async function generateSchema() {
|
|
|
285
285
|
{ $ref: "#/$defs/FunctionDef" },
|
|
286
286
|
// Shape 4: External class / data source ($prototype: <other>)
|
|
287
287
|
{ $ref: "#/$defs/ExternalClassDef" },
|
|
288
|
+
// Shape 5: Expression ($expression)
|
|
289
|
+
{ $ref: "#/$defs/ExpressionEntry" },
|
|
288
290
|
// Shape 1: Naked object (plain object, no reserved keys)
|
|
289
291
|
{
|
|
290
292
|
type: "object",
|
|
@@ -293,6 +295,7 @@ export async function generateSchema() {
|
|
|
293
295
|
{ required: ["$prototype"] },
|
|
294
296
|
{ required: ["default"] },
|
|
295
297
|
{ required: ["type"] },
|
|
298
|
+
{ required: ["$expression"] },
|
|
296
299
|
],
|
|
297
300
|
},
|
|
298
301
|
},
|
|
@@ -893,6 +896,149 @@ export async function generateSchema() {
|
|
|
893
896
|
examples: ["$map/item", "$map/index", "$map/item/text", "$map/item/done"],
|
|
894
897
|
},
|
|
895
898
|
|
|
899
|
+
// ── Expression ($expression) ──────────────────────────────────────
|
|
900
|
+
|
|
901
|
+
ExpressionPointer: {
|
|
902
|
+
description: "A JSON Pointer $ref operand within an expression node.",
|
|
903
|
+
type: "object",
|
|
904
|
+
properties: {
|
|
905
|
+
$ref: {
|
|
906
|
+
type: "string",
|
|
907
|
+
pattern: "^(\\$map/|\\$reduce/|event#/|#/|parent#/|window#/|document#/)",
|
|
908
|
+
},
|
|
909
|
+
},
|
|
910
|
+
required: ["$ref"],
|
|
911
|
+
additionalProperties: false,
|
|
912
|
+
},
|
|
913
|
+
|
|
914
|
+
ExpressionLiteral: {
|
|
915
|
+
description: "A non-reactive operand: scalar or array of operands.",
|
|
916
|
+
anyOf: [
|
|
917
|
+
{ type: "string", not: { pattern: "\\$\\{" } },
|
|
918
|
+
{ type: "number" },
|
|
919
|
+
{ type: "boolean" },
|
|
920
|
+
{ type: "null" },
|
|
921
|
+
{ type: "array", items: { $ref: "#/$defs/ExpressionOperand" } },
|
|
922
|
+
],
|
|
923
|
+
},
|
|
924
|
+
|
|
925
|
+
ExpressionOperand: {
|
|
926
|
+
description:
|
|
927
|
+
"Anything that may appear in target or value: a pointer, a literal, or a nested expression node.",
|
|
928
|
+
anyOf: [
|
|
929
|
+
{ $ref: "#/$defs/ExpressionPointer" },
|
|
930
|
+
{ $ref: "#/$defs/ExpressionNode" },
|
|
931
|
+
{ $ref: "#/$defs/ExpressionLiteral" },
|
|
932
|
+
],
|
|
933
|
+
},
|
|
934
|
+
|
|
935
|
+
UnaryOperator: { enum: ["!", "-"] },
|
|
936
|
+
BinaryOperator: {
|
|
937
|
+
enum: ["+", "-", "*", "/", "%", "===", "!==", "<", "<=", ">", ">=", "&&", "||"],
|
|
938
|
+
},
|
|
939
|
+
AssignmentOperator: { enum: ["=", "+=", "-=", "*=", "/="] },
|
|
940
|
+
NoArgMethod: { enum: ["pop", "shift"] },
|
|
941
|
+
OneArgMethod: { enum: ["push", "unshift"] },
|
|
942
|
+
SpliceMethod: { const: "splice" },
|
|
943
|
+
ReduceMethod: { const: "reduce" },
|
|
944
|
+
MapFilterMethod: { enum: ["map", "filter"] },
|
|
945
|
+
|
|
946
|
+
ExpressionNode: {
|
|
947
|
+
description: "The core expression node. operator + target, with value gated by arity.",
|
|
948
|
+
type: "object",
|
|
949
|
+
required: ["operator", "target"],
|
|
950
|
+
additionalProperties: false,
|
|
951
|
+
properties: {
|
|
952
|
+
operator: { type: "string" },
|
|
953
|
+
target: { $ref: "#/$defs/ExpressionOperand" },
|
|
954
|
+
value: { $ref: "#/$defs/ExpressionOperand" },
|
|
955
|
+
initial: { $ref: "#/$defs/ExpressionOperand" },
|
|
956
|
+
},
|
|
957
|
+
oneOf: [
|
|
958
|
+
{
|
|
959
|
+
title: "Unary — target only, no value",
|
|
960
|
+
properties: { operator: { $ref: "#/$defs/UnaryOperator" } },
|
|
961
|
+
required: ["operator"],
|
|
962
|
+
not: { anyOf: [{ required: ["value"] }, { required: ["initial"] }] },
|
|
963
|
+
},
|
|
964
|
+
{
|
|
965
|
+
title: "Binary — left in target, right in value",
|
|
966
|
+
properties: { operator: { $ref: "#/$defs/BinaryOperator" } },
|
|
967
|
+
required: ["operator", "value"],
|
|
968
|
+
not: { required: ["initial"] },
|
|
969
|
+
},
|
|
970
|
+
{
|
|
971
|
+
title: "Assignment — writable target, value required",
|
|
972
|
+
properties: {
|
|
973
|
+
operator: { $ref: "#/$defs/AssignmentOperator" },
|
|
974
|
+
target: { $ref: "#/$defs/ExpressionPointer" },
|
|
975
|
+
},
|
|
976
|
+
required: ["operator", "value"],
|
|
977
|
+
not: { required: ["initial"] },
|
|
978
|
+
},
|
|
979
|
+
{
|
|
980
|
+
title: "pop / shift — array receiver, no value",
|
|
981
|
+
properties: {
|
|
982
|
+
operator: { $ref: "#/$defs/NoArgMethod" },
|
|
983
|
+
target: { $ref: "#/$defs/ExpressionPointer" },
|
|
984
|
+
},
|
|
985
|
+
required: ["operator"],
|
|
986
|
+
not: { anyOf: [{ required: ["value"] }, { required: ["initial"] }] },
|
|
987
|
+
},
|
|
988
|
+
{
|
|
989
|
+
title: "push / unshift — array receiver, single value argument",
|
|
990
|
+
properties: {
|
|
991
|
+
operator: { $ref: "#/$defs/OneArgMethod" },
|
|
992
|
+
target: { $ref: "#/$defs/ExpressionPointer" },
|
|
993
|
+
},
|
|
994
|
+
required: ["operator", "value"],
|
|
995
|
+
not: { required: ["initial"] },
|
|
996
|
+
},
|
|
997
|
+
{
|
|
998
|
+
title: "splice — array receiver, [start, deleteCount, ...items]",
|
|
999
|
+
properties: {
|
|
1000
|
+
operator: { $ref: "#/$defs/SpliceMethod" },
|
|
1001
|
+
target: { $ref: "#/$defs/ExpressionPointer" },
|
|
1002
|
+
value: { type: "array", items: { $ref: "#/$defs/ExpressionOperand" }, minItems: 1 },
|
|
1003
|
+
},
|
|
1004
|
+
required: ["operator", "value"],
|
|
1005
|
+
not: { required: ["initial"] },
|
|
1006
|
+
},
|
|
1007
|
+
{
|
|
1008
|
+
title: "reduce — pure fold; per-item expression in value, seed in initial",
|
|
1009
|
+
properties: {
|
|
1010
|
+
operator: { $ref: "#/$defs/ReduceMethod" },
|
|
1011
|
+
target: { $ref: "#/$defs/ExpressionPointer" },
|
|
1012
|
+
value: { $ref: "#/$defs/ExpressionNode" },
|
|
1013
|
+
},
|
|
1014
|
+
required: ["operator", "value", "initial"],
|
|
1015
|
+
},
|
|
1016
|
+
{
|
|
1017
|
+
title: "map / filter — pure; per-item expression in value, no initial",
|
|
1018
|
+
properties: {
|
|
1019
|
+
operator: { $ref: "#/$defs/MapFilterMethod" },
|
|
1020
|
+
target: { $ref: "#/$defs/ExpressionPointer" },
|
|
1021
|
+
value: { $ref: "#/$defs/ExpressionNode" },
|
|
1022
|
+
},
|
|
1023
|
+
required: ["operator", "value"],
|
|
1024
|
+
not: { required: ["initial"] },
|
|
1025
|
+
},
|
|
1026
|
+
],
|
|
1027
|
+
},
|
|
1028
|
+
|
|
1029
|
+
ExpressionEntry: {
|
|
1030
|
+
description:
|
|
1031
|
+
"A declarative expression entry (Shape 5). Used as a state entry or inline event handler.",
|
|
1032
|
+
type: "object",
|
|
1033
|
+
required: ["$expression"],
|
|
1034
|
+
properties: {
|
|
1035
|
+
$expression: { $ref: "#/$defs/ExpressionNode" },
|
|
1036
|
+
$title: { type: "string" },
|
|
1037
|
+
$description: { type: "string" },
|
|
1038
|
+
},
|
|
1039
|
+
additionalProperties: false,
|
|
1040
|
+
},
|
|
1041
|
+
|
|
896
1042
|
// ── Property value types ──────────────────────────────────────────────
|
|
897
1043
|
ElementPropertyValue: {
|
|
898
1044
|
oneOf: [
|
|
@@ -983,7 +1129,7 @@ function buildEventHandlerProperties(eventHandlers) {
|
|
|
983
1129
|
for (const name of eventHandlers) {
|
|
984
1130
|
properties[name] = {
|
|
985
1131
|
description: `Event handler for the "${name.slice(2)}" event.`,
|
|
986
|
-
$ref: "#/$defs/RefObject",
|
|
1132
|
+
oneOf: [{ $ref: "#/$defs/RefObject" }, { $ref: "#/$defs/ExpressionEntry" }],
|
|
987
1133
|
};
|
|
988
1134
|
}
|
|
989
1135
|
return properties;
|