@paramrig/web 0.1.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/LICENSE +21 -0
- package/README.md +359 -0
- package/dist/index-L3Zm-CoX.js +512 -0
- package/dist/paramrig-web.js +533 -0
- package/dist/rigs/extended-types.d.ts +184 -0
- package/dist/rigs/types.d.ts +199 -0
- package/dist/web/contracts.d.ts +287 -0
- package/dist/web/geometry.d.ts +5 -0
- package/dist/web/sdk.d.ts +20 -0
- package/package.json +40 -0
- package/schemas/batch.schema.json +126 -0
- package/schemas/manifest.schema.json +83 -0
- package/schemas/response.schema.json +33 -0
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@paramrig/web",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "public"
|
|
8
|
+
},
|
|
9
|
+
"description": "Development integration for the ParamRig connected web workspace",
|
|
10
|
+
"keywords": [
|
|
11
|
+
"paramrig",
|
|
12
|
+
"design-tokens",
|
|
13
|
+
"developer-tools",
|
|
14
|
+
"design-review",
|
|
15
|
+
"feedback",
|
|
16
|
+
"iframe"
|
|
17
|
+
],
|
|
18
|
+
"homepage": "https://github.com/Anymfah/paramrig/tree/main/packages/web-sdk#readme",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/Anymfah/paramrig.git",
|
|
22
|
+
"directory": "packages/web-sdk"
|
|
23
|
+
},
|
|
24
|
+
"bugs": "https://github.com/Anymfah/paramrig/issues",
|
|
25
|
+
"sideEffects": false,
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/web/sdk.d.ts",
|
|
29
|
+
"import": "./dist/paramrig-web.js",
|
|
30
|
+
"default": "./dist/paramrig-web.js"
|
|
31
|
+
},
|
|
32
|
+
"./schemas/*": "./schemas/*",
|
|
33
|
+
"./package.json": "./package.json"
|
|
34
|
+
},
|
|
35
|
+
"files": [
|
|
36
|
+
"dist",
|
|
37
|
+
"schemas",
|
|
38
|
+
"README.md"
|
|
39
|
+
]
|
|
40
|
+
}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/Anymfah/paramrig/packages/web-sdk/schemas/batch.schema.json",
|
|
4
|
+
"title": "ParamRig approved feedback batch",
|
|
5
|
+
"description": "One immutable file at .paramrig/batches/<id>.json, written when a person approves. A second expression of isBatch in @paramrig/web; the guard stays the authority at runtime. Its file name must be <id>.json, which only the service can check.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["version", "id", "projectId", "sourceRevision", "createdAt", "values", "changes", "tickets"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"version": { "const": 1 },
|
|
10
|
+
"id": { "$ref": "#/$defs/identifier" },
|
|
11
|
+
"projectId": { "$ref": "#/$defs/identifier" },
|
|
12
|
+
"sourceRevision": { "$ref": "#/$defs/text" },
|
|
13
|
+
"createdAt": { "$ref": "#/$defs/text" },
|
|
14
|
+
"values": { "$ref": "#/$defs/values" },
|
|
15
|
+
"changes": {
|
|
16
|
+
"type": "array",
|
|
17
|
+
"items": {
|
|
18
|
+
"type": "object", "required": ["paramId", "label", "before", "after", "bindings"],
|
|
19
|
+
"properties": {
|
|
20
|
+
"paramId": { "$ref": "#/$defs/identifier" },
|
|
21
|
+
"label": { "type": "string" },
|
|
22
|
+
"before": { "$ref": "#/$defs/value" },
|
|
23
|
+
"after": { "$ref": "#/$defs/value" },
|
|
24
|
+
"bindings": { "type": "array" }
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
"tickets": { "type": "array", "items": { "$ref": "#/$defs/ticket" } }
|
|
29
|
+
},
|
|
30
|
+
"$defs": {
|
|
31
|
+
"identifier": { "type": "string", "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$" },
|
|
32
|
+
"text": { "type": "string", "minLength": 1, "maxLength": 2000 },
|
|
33
|
+
"value": { "description": "Any JSON a control can hold, at most 12 deep." },
|
|
34
|
+
"values": { "type": "object" },
|
|
35
|
+
"colour": { "type": "string", "pattern": "^#[0-9a-fA-F]{6}$" },
|
|
36
|
+
"rect": {
|
|
37
|
+
"type": "object", "required": ["x", "y", "width", "height"],
|
|
38
|
+
"properties": { "x": { "type": "number" }, "y": { "type": "number" }, "width": { "type": "number", "minimum": 0 }, "height": { "type": "number", "minimum": 0 } }
|
|
39
|
+
},
|
|
40
|
+
"target": {
|
|
41
|
+
"type": "object",
|
|
42
|
+
"required": ["key", "selector", "fingerprint", "label", "tag", "pageId", "rect", "ancestors", "status"],
|
|
43
|
+
"properties": {
|
|
44
|
+
"key": { "$ref": "#/$defs/text" },
|
|
45
|
+
"stable": { "type": "object", "required": ["id"], "properties": { "id": { "$ref": "#/$defs/text" }, "instance": { "$ref": "#/$defs/text" } } },
|
|
46
|
+
"selector": { "type": "string" },
|
|
47
|
+
"fingerprint": { "type": "string" },
|
|
48
|
+
"label": { "type": "string" },
|
|
49
|
+
"tag": { "type": "string" },
|
|
50
|
+
"source": { "type": "string" },
|
|
51
|
+
"pageId": { "type": "string" },
|
|
52
|
+
"rect": { "$ref": "#/$defs/rect" },
|
|
53
|
+
"clip": { "$ref": "#/$defs/rect" },
|
|
54
|
+
"ancestors": {
|
|
55
|
+
"type": "array",
|
|
56
|
+
"items": { "type": "object", "required": ["key", "label"], "properties": { "key": { "$ref": "#/$defs/text" }, "label": { "type": "string" }, "stable": { "type": "object" } } }
|
|
57
|
+
},
|
|
58
|
+
"status": { "enum": ["resolved", "provisional", "missing", "ambiguous"] },
|
|
59
|
+
"controls": { "type": "integer", "minimum": 0, "maximum": 1000 }
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"mark": {
|
|
63
|
+
"type": "object",
|
|
64
|
+
"required": ["id", "tool", "color", "width", "points", "pageId", "viewport"],
|
|
65
|
+
"properties": {
|
|
66
|
+
"id": { "$ref": "#/$defs/identifier" },
|
|
67
|
+
"tool": { "enum": ["note", "arrow", "rectangle", "ellipse", "highlight", "pen"] },
|
|
68
|
+
"color": { "$ref": "#/$defs/colour" },
|
|
69
|
+
"width": { "type": "number", "exclusiveMinimum": 0, "maximum": 32 },
|
|
70
|
+
"points": { "type": "array", "maxItems": 10000, "items": { "type": "object", "required": ["x", "y"], "properties": { "x": { "type": "number" }, "y": { "type": "number" } } } },
|
|
71
|
+
"targetKey": { "type": "string" },
|
|
72
|
+
"pageId": { "type": "string" },
|
|
73
|
+
"viewport": { "type": "object", "required": ["width", "height"], "properties": { "width": { "type": "number" }, "height": { "type": "number" } } }
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"capture": {
|
|
77
|
+
"type": "object",
|
|
78
|
+
"required": ["id", "kind", "status", "note"],
|
|
79
|
+
"properties": {
|
|
80
|
+
"id": { "$ref": "#/$defs/identifier" },
|
|
81
|
+
"kind": { "enum": ["dom", "screen"] },
|
|
82
|
+
"status": { "enum": ["ready", "failed"] },
|
|
83
|
+
"createdAt": { "type": "string" },
|
|
84
|
+
"file": { "type": "string" },
|
|
85
|
+
"note": { "type": "string" },
|
|
86
|
+
"dataUrl": { "type": "string" }
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
"context": {
|
|
90
|
+
"type": "object",
|
|
91
|
+
"required": ["pageId", "url", "viewport", "scroll", "scrollers"],
|
|
92
|
+
"properties": {
|
|
93
|
+
"pageId": { "type": "string" },
|
|
94
|
+
"url": { "type": "string" },
|
|
95
|
+
"viewport": {
|
|
96
|
+
"type": "object", "required": ["width", "height", "dpr"],
|
|
97
|
+
"properties": { "width": { "type": "number", "exclusiveMinimum": 0 }, "height": { "type": "number", "exclusiveMinimum": 0 }, "dpr": { "type": "number", "exclusiveMinimum": 0 } }
|
|
98
|
+
},
|
|
99
|
+
"scroll": { "type": "object", "required": ["x", "y"], "properties": { "x": { "type": "number" }, "y": { "type": "number" } } },
|
|
100
|
+
"scrollers": {
|
|
101
|
+
"type": "array", "maxItems": 1000,
|
|
102
|
+
"items": { "type": "object", "required": ["target", "x", "y"], "properties": { "target": { "$ref": "#/$defs/target" }, "x": { "type": "number" }, "y": { "type": "number" } } }
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"ticket": {
|
|
107
|
+
"type": "object",
|
|
108
|
+
"required": ["id", "comment", "status", "revision", "createdAt", "context", "targets", "marks", "captures"],
|
|
109
|
+
"properties": {
|
|
110
|
+
"id": { "$ref": "#/$defs/identifier" },
|
|
111
|
+
"number": { "type": "integer", "exclusiveMinimum": 0, "maximum": 100000 },
|
|
112
|
+
"comment": { "type": "string", "maxLength": 20000 },
|
|
113
|
+
"status": { "enum": ["draft", "todo", "review", "validated", "clarification"] },
|
|
114
|
+
"revision": { "$ref": "#/$defs/text" },
|
|
115
|
+
"createdAt": { "$ref": "#/$defs/text" },
|
|
116
|
+
"context": { "$ref": "#/$defs/context" },
|
|
117
|
+
"targets": { "type": "array", "items": { "$ref": "#/$defs/target" } },
|
|
118
|
+
"marks": { "type": "array", "items": { "$ref": "#/$defs/mark" } },
|
|
119
|
+
"captures": { "type": "array", "items": { "$ref": "#/$defs/capture" } },
|
|
120
|
+
"batchId": { "type": "string" },
|
|
121
|
+
"response": { "type": "string" },
|
|
122
|
+
"responseRevision": { "type": "string" }
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/Anymfah/paramrig/packages/web-sdk/schemas/manifest.schema.json",
|
|
4
|
+
"title": "ParamRig web project manifest",
|
|
5
|
+
"description": "The contract a project writes at .paramrig/manifest.json. A second expression of parseManifest in @paramrig/web; the guard stays the authority at runtime. Two of its rules cannot be written in JSON Schema and are checked only by the guard: control and page identifiers must be unique, and every binding's paramId must name a declared control.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["version", "id", "name", "revision", "origin", "pages", "groups", "parameters", "bindings"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"version": { "const": 1 },
|
|
10
|
+
"id": { "$ref": "#/$defs/identifier" },
|
|
11
|
+
"name": { "$ref": "#/$defs/text" },
|
|
12
|
+
"revision": { "$ref": "#/$defs/text" },
|
|
13
|
+
"origin": {
|
|
14
|
+
"type": "string",
|
|
15
|
+
"description": "An HTTP or HTTPS origin and nothing else: no path, no credentials, lower case.",
|
|
16
|
+
"pattern": "^https?://([a-z0-9.-]+|\\[[0-9a-f:.]+\\])(:[0-9]{1,5})?$"
|
|
17
|
+
},
|
|
18
|
+
"pages": {
|
|
19
|
+
"type": "array", "minItems": 1, "maxItems": 100,
|
|
20
|
+
"items": {
|
|
21
|
+
"type": "object", "required": ["id", "name", "path"],
|
|
22
|
+
"properties": {
|
|
23
|
+
"id": { "$ref": "#/$defs/identifier" },
|
|
24
|
+
"name": { "$ref": "#/$defs/text" },
|
|
25
|
+
"path": { "type": "string", "description": "Same-origin, so one leading slash and no second.", "pattern": "^/([^/\\\\].*)?$" }
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"groups": {
|
|
30
|
+
"type": "array",
|
|
31
|
+
"items": { "type": "object", "required": ["id", "label"], "properties": { "id": { "$ref": "#/$defs/identifier" }, "label": { "$ref": "#/$defs/text" } } }
|
|
32
|
+
},
|
|
33
|
+
"parameters": { "type": "array", "maxItems": 500, "items": { "$ref": "#/$defs/parameter" } },
|
|
34
|
+
"bindings": { "type": "array", "items": { "$ref": "#/$defs/binding" } }
|
|
35
|
+
},
|
|
36
|
+
"$defs": {
|
|
37
|
+
"identifier": { "type": "string", "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$" },
|
|
38
|
+
"text": { "type": "string", "minLength": 1, "maxLength": 2000 },
|
|
39
|
+
"parameter": {
|
|
40
|
+
"type": "object",
|
|
41
|
+
"required": ["id", "label", "group", "kind", "defaultValue"],
|
|
42
|
+
"properties": {
|
|
43
|
+
"id": { "$ref": "#/$defs/identifier" },
|
|
44
|
+
"label": { "$ref": "#/$defs/text" },
|
|
45
|
+
"group": { "type": "string" },
|
|
46
|
+
"kind": {
|
|
47
|
+
"enum": ["number", "color", "select", "curve", "switch", "gradient", "text", "vector", "range", "palette", "points", "radial", "group", "list", "resource", "gizmo2d", "gizmo3d", "camera", "textureFrame", "multiselect", "action", "preset"]
|
|
48
|
+
},
|
|
49
|
+
"unit": { "type": "string" },
|
|
50
|
+
"min": { "type": "number" },
|
|
51
|
+
"max": { "type": "number" },
|
|
52
|
+
"step": { "type": "number", "exclusiveMinimum": 0 },
|
|
53
|
+
"options": { "type": "array", "items": { "type": "object", "required": ["value", "label"], "properties": { "value": { "type": "string" }, "label": { "$ref": "#/$defs/text" } } } },
|
|
54
|
+
"fields": { "type": "array", "items": { "$ref": "#/$defs/parameter" } },
|
|
55
|
+
"item": { "$ref": "#/$defs/parameter" }
|
|
56
|
+
},
|
|
57
|
+
"allOf": [
|
|
58
|
+
{ "if": { "required": ["kind"], "properties": { "kind": { "const": "number" } } }, "then": { "required": ["min", "max", "step"] } },
|
|
59
|
+
{ "if": { "required": ["kind"], "properties": { "kind": { "enum": ["select", "preset", "multiselect"] } } }, "then": { "required": ["options"] } },
|
|
60
|
+
{ "if": { "required": ["kind"], "properties": { "kind": { "const": "group" } } }, "then": { "required": ["fields"] } },
|
|
61
|
+
{ "if": { "required": ["kind"], "properties": { "kind": { "const": "list" } } }, "then": { "required": ["item"] } }
|
|
62
|
+
]
|
|
63
|
+
},
|
|
64
|
+
"binding": {
|
|
65
|
+
"type": "object",
|
|
66
|
+
"required": ["paramId", "scope", "kind", "property"],
|
|
67
|
+
"properties": {
|
|
68
|
+
"paramId": { "type": "string" },
|
|
69
|
+
"scope": { "enum": ["global", "page", "element"] },
|
|
70
|
+
"kind": { "enum": ["css-variable", "style", "adapter"] },
|
|
71
|
+
"property": { "$ref": "#/$defs/text" },
|
|
72
|
+
"pageId": { "type": "string" },
|
|
73
|
+
"unit": { "type": "string" },
|
|
74
|
+
"source": { "type": "string" },
|
|
75
|
+
"target": { "type": "object", "required": ["id"], "properties": { "id": { "$ref": "#/$defs/text" }, "instance": { "$ref": "#/$defs/text" } } }
|
|
76
|
+
},
|
|
77
|
+
"allOf": [
|
|
78
|
+
{ "if": { "required": ["scope"], "properties": { "scope": { "const": "element" } } }, "then": { "required": ["target"] } },
|
|
79
|
+
{ "if": { "required": ["scope"], "properties": { "scope": { "const": "page" } } }, "then": { "required": ["pageId"] } }
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://github.com/Anymfah/paramrig/packages/web-sdk/schemas/response.schema.json",
|
|
4
|
+
"title": "ParamRig agent response",
|
|
5
|
+
"description": "What the project's agent writes at .paramrig/responses/<id>.json after applying a batch. A second expression of isResponse in @paramrig/web; the guard stays the authority at runtime. Three rules need the batch beside it and live in the workspace instead: the response must name an existing batch, its sourceRevision must be that batch's, and every ticket it answers must belong to it.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": ["version", "id", "batchId", "projectId", "sourceRevision", "resultRevision", "createdAt", "summary", "tickets"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"version": { "const": 1 },
|
|
10
|
+
"id": { "$ref": "#/$defs/identifier" },
|
|
11
|
+
"batchId": { "$ref": "#/$defs/identifier" },
|
|
12
|
+
"projectId": { "$ref": "#/$defs/identifier" },
|
|
13
|
+
"sourceRevision": { "$ref": "#/$defs/text" },
|
|
14
|
+
"resultRevision": { "$ref": "#/$defs/text" },
|
|
15
|
+
"createdAt": { "$ref": "#/$defs/text" },
|
|
16
|
+
"summary": { "type": "string" },
|
|
17
|
+
"tickets": {
|
|
18
|
+
"type": "array",
|
|
19
|
+
"items": {
|
|
20
|
+
"type": "object", "required": ["id", "status", "message"],
|
|
21
|
+
"properties": {
|
|
22
|
+
"id": { "$ref": "#/$defs/identifier" },
|
|
23
|
+
"status": { "enum": ["implemented", "needs-info"] },
|
|
24
|
+
"message": { "type": "string" }
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"$defs": {
|
|
30
|
+
"identifier": { "type": "string", "pattern": "^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$" },
|
|
31
|
+
"text": { "type": "string", "minLength": 1, "maxLength": 2000 }
|
|
32
|
+
}
|
|
33
|
+
}
|