@tinta-lang/engine 0.1.0-dev.0 → 0.1.16

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/README.md ADDED
@@ -0,0 +1,25 @@
1
+ # @tinta-lang/engine
2
+
3
+ Compile and evaluate tinta documents. Create a session to change controls and receive a complete new document state after each valid change.
4
+
5
+ ```ts
6
+ import { compile, createSession } from "@tinta-lang/engine";
7
+
8
+ const compiled = compile({
9
+ uri: "tinta:example",
10
+ profile: "tinta",
11
+ text: "@slider people = 5\n@calc total = people * 19\n{{ total }}\n",
12
+ });
13
+
14
+ if (compiled.ok) {
15
+ const created = createSession(compiled.value);
16
+ if (created.ok) {
17
+ created.value.setControl("people", 6);
18
+ created.value.destroy();
19
+ }
20
+ }
21
+ ```
22
+
23
+ Check each result before using its value. An invalid control change leaves the previous state intact. This package does not mount a reader or access files.
24
+
25
+ See the [engine API](https://github.com/planta7/tinta/blob/main/docs/11_ENGINE_API.md).
@@ -93,10 +93,10 @@ export declare const registry: {
93
93
  readonly E_EXPRESSION_SYNTAX: "Invalid/unfinished expression token sequence.";
94
94
  readonly E_NAME_RESERVED: "Reserved or invalid identifier.";
95
95
  readonly E_NAME_DUPLICATE: "Document name declared more than once.";
96
- readonly E_NAME_UNKNOWN: "Unresolved global name.";
96
+ readonly E_NAME_UNKNOWN: "This name has not been defined in the document.";
97
97
  readonly E_ROW_SCOPE: "row.field used outside a supported row context.";
98
98
  readonly E_COLUMN_UNKNOWN: "Referenced table column does not exist.";
99
- readonly E_TYPE: "Types do not satisfy an operator/directive/function contract.";
99
+ readonly E_TYPE: "This value has the wrong type for this operation.";
100
100
  readonly E_FUNCTION_ARITY: "Incorrect number of function arguments.";
101
101
  readonly E_CONST_DEPENDENCY: "Constant depends on nonconstant state/data.";
102
102
  readonly E_CYCLE: "Dependency cycle detected.";
@@ -105,7 +105,7 @@ export declare const registry: {
105
105
  readonly E_DIGITS_RANGE: "Formatting/rounding digits are outside integer 0–10.";
106
106
  readonly E_EMPTY_MEAN: "Mean requested for an empty table/view.";
107
107
  readonly E_STATE_NAME: "Update names an unknown/non-control symbol.";
108
- readonly E_STATE_DOMAIN: "Control update/default violates its allowed domain.";
108
+ readonly E_STATE_DOMAIN: "The control value is outside its allowed range or choices.";
109
109
  readonly E_DATA_HEADER: "Invalid or duplicate typed table header.";
110
110
  readonly E_DATA_ARITY: "Row cell count differs from the schema.";
111
111
  readonly E_DATA_VALUE: "Cell is not a valid scalar for its declared type.";
@@ -124,11 +124,11 @@ export declare const registry: {
124
124
  readonly E_ASSET_PATH: "Unsafe resource or ZIP entry path.";
125
125
  readonly E_BUNDLE: "Malformed bundle, duplicate keys/entries, CRC or manifest mismatch.";
126
126
  readonly E_HASH_MISMATCH: "Source/resource hash does not match its envelope.";
127
- readonly E_SNAPSHOT: "State envelope does not match source/schema/controls.";
127
+ readonly E_SNAPSHOT: "The saved answers do not match this document and its controls.";
128
128
  readonly E_EXPORT_INVALID: "Export requested for invalid/stale source or an invalid state.";
129
129
  readonly E_OUTPUT_EXISTS: "Output already exists and replacement is not authorized.";
130
- readonly E_IO: "Authorized filesystem operation failed.";
131
- readonly E_WORKER_TIMEOUT: "Worker did not complete before the watchdog.";
130
+ readonly E_IO: "Could not read or write the selected file.";
131
+ readonly E_WORKER_TIMEOUT: "The document took too long to process.";
132
132
  readonly E_PROTOCOL: "Malformed or unauthorized host protocol message; stale valid results are ignored.";
133
133
  readonly E_INTERNAL: "Unexpected engine fault; not a document syntax diagnosis.";
134
134
  };
@@ -137,7 +137,7 @@ export declare const registry: {
137
137
  readonly W_HTML_INERT: "Raw author HTML displayed as text.";
138
138
  readonly W_LINK_LOCAL_UNSUPPORTED: "Local document navigation is not implemented.";
139
139
  readonly W_LINK_UNSAFE: "Unsafe/unsupported link disabled.";
140
- readonly W_ASSET_UNAVAILABLE: "Preview image unavailable; export remains blocked.";
140
+ readonly W_ASSET_UNAVAILABLE: "A document image is unavailable. Exports require all images they include.";
141
141
  readonly W_RECOVERY_UNAVAILABLE: "Local browser recovery is unavailable.";
142
142
  readonly W_MARKDOWN_COLLISION: "Enrichment proposes escapes for Tinta-looking literal text.";
143
143
  };
package/dist/registry.js CHANGED
@@ -149,10 +149,10 @@ export const registry = {
149
149
  E_EXPRESSION_SYNTAX: "Invalid/unfinished expression token sequence.",
150
150
  E_NAME_RESERVED: "Reserved or invalid identifier.",
151
151
  E_NAME_DUPLICATE: "Document name declared more than once.",
152
- E_NAME_UNKNOWN: "Unresolved global name.",
152
+ E_NAME_UNKNOWN: "This name has not been defined in the document.",
153
153
  E_ROW_SCOPE: "row.field used outside a supported row context.",
154
154
  E_COLUMN_UNKNOWN: "Referenced table column does not exist.",
155
- E_TYPE: "Types do not satisfy an operator/directive/function contract.",
155
+ E_TYPE: "This value has the wrong type for this operation.",
156
156
  E_FUNCTION_ARITY: "Incorrect number of function arguments.",
157
157
  E_CONST_DEPENDENCY: "Constant depends on nonconstant state/data.",
158
158
  E_CYCLE: "Dependency cycle detected.",
@@ -161,7 +161,7 @@ export const registry = {
161
161
  E_DIGITS_RANGE: "Formatting/rounding digits are outside integer 0\u201310.",
162
162
  E_EMPTY_MEAN: "Mean requested for an empty table/view.",
163
163
  E_STATE_NAME: "Update names an unknown/non-control symbol.",
164
- E_STATE_DOMAIN: "Control update/default violates its allowed domain.",
164
+ E_STATE_DOMAIN: "The control value is outside its allowed range or choices.",
165
165
  E_DATA_HEADER: "Invalid or duplicate typed table header.",
166
166
  E_DATA_ARITY: "Row cell count differs from the schema.",
167
167
  E_DATA_VALUE: "Cell is not a valid scalar for its declared type.",
@@ -180,11 +180,11 @@ export const registry = {
180
180
  E_ASSET_PATH: "Unsafe resource or ZIP entry path.",
181
181
  E_BUNDLE: "Malformed bundle, duplicate keys/entries, CRC or manifest mismatch.",
182
182
  E_HASH_MISMATCH: "Source/resource hash does not match its envelope.",
183
- E_SNAPSHOT: "State envelope does not match source/schema/controls.",
183
+ E_SNAPSHOT: "The saved answers do not match this document and its controls.",
184
184
  E_EXPORT_INVALID: "Export requested for invalid/stale source or an invalid state.",
185
185
  E_OUTPUT_EXISTS: "Output already exists and replacement is not authorized.",
186
- E_IO: "Authorized filesystem operation failed.",
187
- E_WORKER_TIMEOUT: "Worker did not complete before the watchdog.",
186
+ E_IO: "Could not read or write the selected file.",
187
+ E_WORKER_TIMEOUT: "The document took too long to process.",
188
188
  E_PROTOCOL: "Malformed or unauthorized host protocol message; stale valid results are ignored.",
189
189
  E_INTERNAL: "Unexpected engine fault; not a document syntax diagnosis.",
190
190
  },
@@ -193,7 +193,7 @@ export const registry = {
193
193
  W_HTML_INERT: "Raw author HTML displayed as text.",
194
194
  W_LINK_LOCAL_UNSUPPORTED: "Local document navigation is not implemented.",
195
195
  W_LINK_UNSAFE: "Unsafe/unsupported link disabled.",
196
- W_ASSET_UNAVAILABLE: "Preview image unavailable; export remains blocked.",
196
+ W_ASSET_UNAVAILABLE: "A document image is unavailable. Exports require all images they include.",
197
197
  W_RECOVERY_UNAVAILABLE: "Local browser recovery is unavailable.",
198
198
  W_MARKDOWN_COLLISION: "Enrichment proposes escapes for Tinta-looking literal text.",
199
199
  },
package/package.json CHANGED
@@ -1,6 +1,14 @@
1
1
  {
2
2
  "name": "@tinta-lang/engine",
3
- "version": "0.1.0-dev.0",
3
+ "version": "0.1.16",
4
+ "description": "Compile and evaluate interactive tinta documents with transactional controls.",
5
+ "keywords": [
6
+ "tinta",
7
+ "markdown",
8
+ "expressions",
9
+ "documents"
10
+ ],
11
+ "homepage": "https://github.com/planta7/tinta/blob/main/packages/engine/README.md",
4
12
  "private": false,
5
13
  "type": "module",
6
14
  "license": "MIT",
@@ -9,7 +17,7 @@
9
17
  },
10
18
  "publishConfig": {
11
19
  "access": "public",
12
- "tag": "next"
20
+ "tag": "latest"
13
21
  },
14
22
  "exports": {
15
23
  ".": {
@@ -26,12 +34,13 @@
26
34
  }
27
35
  },
28
36
  "dependencies": {
29
- "@tinta-lang/types": "0.1.0-dev.0",
30
- "@tinta-lang/syntax": "0.1.0-dev.0",
37
+ "@tinta-lang/types": "0.1.16",
38
+ "@tinta-lang/syntax": "0.1.16",
31
39
  "@noble/hashes": "2.4.0"
32
40
  },
33
41
  "files": [
34
42
  "LICENSE",
43
+ "README.md",
35
44
  "THIRD_PARTY_NOTICES.txt",
36
45
  "dist/analysis.d.ts",
37
46
  "dist/analysis.js",