@patterkit/dialect 0.2.4 → 0.2.6
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 +41 -0
- package/package.json +2 -2
package/README.md
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# @patterkit/dialect
|
|
2
|
+
|
|
3
|
+
Patter's configuration of the [`@wildwinter/expr`](https://www.npmjs.com/package/@wildwinter/expr)
|
|
4
|
+
expression language: the scopes and built-in functions that conditions and effects use, plus the helpers for
|
|
5
|
+
`{@name}` placeholders in dialogue text. The compiler uses it to check expressions and the runtime uses it
|
|
6
|
+
to evaluate them, so both agree by construction.
|
|
7
|
+
|
|
8
|
+
Most people won't need to install this directly. To play Patter dialogue in a game or web page, use
|
|
9
|
+
[`@patterkit/runtime`](https://www.npmjs.com/package/@patterkit/runtime); to work with Patter projects from
|
|
10
|
+
a terminal or a build script, use [`@patterkit/cli`](https://www.npmjs.com/package/@patterkit/cli).
|
|
11
|
+
|
|
12
|
+
## What's in it
|
|
13
|
+
|
|
14
|
+
- **The dialect** (`patterDialect`): the `@patter` scope (the default, so a bare `@name` means
|
|
15
|
+
`@patter.name`) and the `@scene` scope, and the built-in functions `random`, `check_flags`, `set_flags`,
|
|
16
|
+
`visits`, `seen`, `patter_visits`, and `patter_seen`.
|
|
17
|
+
- **Scopes from the game**: `dialectWithForeignScopes` and `hostScopesToSpec` add the scopes a game
|
|
18
|
+
declares itself, such as `@world`, alongside Patter's own.
|
|
19
|
+
- **An expression schema** (`buildSchema`) built from a project's property declarations, for checking
|
|
20
|
+
expressions before anything runs.
|
|
21
|
+
- **Placeholders**: `extractSlots`, `interpolate`, and `renderSlotValue` find and fill `{@name}`
|
|
22
|
+
placeholders, and `stripCaptions` removes caption cues for closed captions.
|
|
23
|
+
|
|
24
|
+
The expressions themselves are described in [Choices and
|
|
25
|
+
logic](https://patterkit.dev/format/choices-and-logic/).
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
npm install @patterkit/dialect
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Part of Patter
|
|
32
|
+
|
|
33
|
+
[Patter](https://patterkit.dev/) is a branching dialogue format with its own editor (Patterpad), command line
|
|
34
|
+
tool (`patter`), and runtimes for JavaScript, Unity, Unreal, and Godot. This package is one layer of the
|
|
35
|
+
JavaScript tooling, and the other `@patterkit` packages build on it. [How it fits
|
|
36
|
+
together](https://patterkit.dev/architecture/) shows where each piece sits, and the source is in the
|
|
37
|
+
[patter repository](https://github.com/patterkit/patter).
|
|
38
|
+
|
|
39
|
+
## Licence
|
|
40
|
+
|
|
41
|
+
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@patterkit/dialect",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "The Patter dialect for @wildwinter/expr (scopes shared/scene/flow, built-in functions), an ExpressionSchema builder from property declarations, and the inline {@ref} interpolation helpers (spec §16).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"build": "tsup src/index.ts --format esm,cjs --dts --clean"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@patterkit/model": "0.
|
|
37
|
+
"@patterkit/model": "0.10.0",
|
|
38
38
|
"@wildwinter/expr": "^0.5.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|