gs2-studio-dsl 2026.11.16 → 2026.11.18
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/LLM.md +35 -13
- package/README.md +8 -5
- package/REFERENCE.md +60 -6
- package/index.d.ts +150 -141
- package/package.json +1 -1
package/LLM.md
CHANGED
|
@@ -21,7 +21,7 @@ Instructions for an agent that writes or edits a GS2 Studio package DSL. Follow
|
|
|
21
21
|
<project>/ GS2 Studio project (project.json, packages/)
|
|
22
22
|
<dsl>/
|
|
23
23
|
index.ts the entry: exports exactly one definePackage({...}) or .build() result
|
|
24
|
-
id-ledger.json ids of the package; created by dsl build --write-ledger;
|
|
24
|
+
id-ledger.json ids of the package; created by dsl build --write-ledger; keep it with index.ts
|
|
25
25
|
dependency-surface.json written by dsl build: what this package publishes to packages that depend on it
|
|
26
26
|
surfaces/<packageId>.json written by dsl surfaces: what each package of the project publishes
|
|
27
27
|
tsconfig.json the tsconfig from the README
|
|
@@ -41,9 +41,9 @@ To start a new `<dsl>`, run `"<GS2 Studio>" dsl init --dir <project> --out <dsl>
|
|
|
41
41
|
`tsconfig.json`, a starter `index.ts`, `surfaces/`, these documents under `docs/`, and an `AGENTS.md` that lists the
|
|
42
42
|
commands below with the executable's path; the first build writes the ledger. It refuses when one of its files exists.
|
|
43
43
|
|
|
44
|
-
1. Put every dependency in the project first:
|
|
45
|
-
|
|
46
|
-
packages.
|
|
44
|
+
1. Put every dependency in the project first: add it with `"<GS2 Studio>" package add --dir <project> ...`
|
|
45
|
+
(`"<GS2 Studio>" package search` finds it and prints the arguments), or, for a package you author too, build it into
|
|
46
|
+
the project with `dsl build`. The DSL cannot install packages.
|
|
47
47
|
2. If the package depends on other packages, write their surfaces (one file per package of the project):
|
|
48
48
|
`"<GS2 Studio>" dsl surfaces --dir <project> --out <dsl>/surfaces`
|
|
49
49
|
3. Write or edit `<dsl>/index.ts`. When the package depends on other packages, declare the dependencies first and build
|
|
@@ -64,7 +64,8 @@ commands below with the executable's path; the first build writes the ledger. It
|
|
|
64
64
|
[Building with dsl build](REFERENCE.md#building-with-dsl-build)). The build's last line counts the errors and
|
|
65
65
|
warnings, such as `project check (without Unity code generation): 0 error(s), 2 warning(s)`, and is
|
|
66
66
|
`project check (without Unity code generation): no errors or warnings` when there is none.
|
|
67
|
-
8. Keep `id-ledger.json` and `dependency-surface.json` with `index.ts`; commit them together.
|
|
67
|
+
8. Keep `id-ledger.json` and `dependency-surface.json` with `index.ts`; under version control, commit them together.
|
|
68
|
+
Whether to use version control is the user's choice: do not create a repository unless the user asks.
|
|
68
69
|
|
|
69
70
|
A build that fails a check writes nothing. On failure, read every listed problem, fix the DSL, and rerun.
|
|
70
71
|
|
|
@@ -98,6 +99,10 @@ MUST:
|
|
|
98
99
|
Start while a quest is in progress (`alreadyExists`). A player with no quest in progress, including one who never
|
|
99
100
|
started any, still has that row, with `inProgress` `false`, so this check passes once the `ProgressHandler` has loaded.
|
|
100
101
|
See [Rows in the game](REFERENCE.md#rows-in-the-game).
|
|
102
|
+
- Show the time left until a timestamp (a stamina's next recovery) with a `UiItem.countdown`, or the one a dependency
|
|
103
|
+
lists in `types.<Type>.uiComponents` (`foundation-economy-energy`'s `NextRecoveryCountdown`), never with a hand-written
|
|
104
|
+
timer: it counts on the session's GS2 clock, which `DateTime.UtcNow` is not. See
|
|
105
|
+
[UI components](REFERENCE.md#ui-components).
|
|
101
106
|
- Place an `activeToggle` such as `ProgressIdleActiveToggle` on a GameObject that stays active below the type's
|
|
102
107
|
Handler, with what it shows or hides as its targets, never on a GameObject it hides: once hidden it stops listening
|
|
103
108
|
and never shows it again. See [UI components](REFERENCE.md#ui-components).
|
|
@@ -234,6 +239,7 @@ Names and ids:
|
|
|
234
239
|
| Choose a binding hint | `.assetDelivery()` (the client shows it), none (only a transform argument), `.masterData()` (a resource binds it) | [Property modifiers](REFERENCE.md#property-modifiers) |
|
|
235
240
|
| Text shown in the player's language (a display name) | One `displayName: PT.localizedString().assetDelivery()`, rows `{ ja: "...", en: "..." }`, a `UiItem.label` on it; not one property per language | [Localized text](REFERENCE.md#localized-text) |
|
|
236
241
|
| Localized text in a template or a condition | `templateLabel` placeholder and `UiCond.truthy` / `eq` / `neq` read the player's locale's translation; never `gt`/`lt`, never against a number | [Localized text](REFERENCE.md#localized-text) |
|
|
242
|
+
| Fixed text and template words in the player's language (a heading, a button caption, `"{count} left"`) | `UiItem.templateLabel(className, { ja: "...", en: "..." }, sources)` with any BCP 47 locales (`zh-Hant`, `ko`, ...), every locale using the same placeholders; no placeholders and `{}` sources for fixed text. Not a hand-written localization script | [Localized templates](REFERENCE.md#localized-templates) |
|
|
237
243
|
| Conditional requirement | `.requiredWhen(Cond.eq("limited", true))` | [Conditions](REFERENCE.md#conditions) |
|
|
238
244
|
| Identity and order | `singleEntry: true`, `compositeKey: [...]`, `sort: { key, direction? }` | [Keys and identity](REFERENCE.md#keys-and-identity) |
|
|
239
245
|
| Author rows | `instance(definition, id, values)` in `instances: [...]` | [Instances](REFERENCE.md#instances) |
|
|
@@ -251,7 +257,7 @@ Names and ids:
|
|
|
251
257
|
| A method that runs a GS2 action | `delegatedActions: { Method: { targetActionKey, targetResource } }` on the type, or `definePackage({ delegatedActions: [{ target, methodName, action: { targetActionKey, targetResource } }] })` | [Delegated actions](REFERENCE.md#delegated-actions) |
|
|
252
258
|
| Generated UI | `defineUiComponent(T, { items: [UiItem.label(...), UiItem.buttonAction(...)] })`, `UiSource.*`, `UiCond.*` | [UI components](REFERENCE.md#ui-components) |
|
|
253
259
|
| Enable a button by another type's row (stamina, coins) | `UiItem.interactable("StartInteractable", UiCond.gte(UiSource.rowProp(energy.type("Energy"), "stamina", "currentValue"), UiSource.prop("cost")))` | [Another type's row](REFERENCE.md#another-types-row) |
|
|
254
|
-
| Choose a UI item and its options | `label` shows text, `templateLabel` text around values, `value` sends a typed value the game formats; a button never disables itself (add `interactable`). `{ name, description }` only label the item in GS2 Studio's editor; leave them out | [UI components](REFERENCE.md#ui-components), [Item options](REFERENCE.md#item-options) |
|
|
260
|
+
| Choose a UI item and its options | `label` shows text, `templateLabel` text around values, `countdown` the time left until a timestamp, `value` sends a typed value the game formats; a button never disables itself (add `interactable`). `{ name, description }` only label the item in GS2 Studio's editor; leave them out | [UI components](REFERENCE.md#ui-components), [Item options](REFERENCE.md#item-options) |
|
|
255
261
|
| Show every row in the game, in order | A UI component describes one row; the generated `<T>ListHandler` makes one instance of a prefab per row, in the order of `sort` (an overlay: the dependency's order unless it sets a `sort` other than id ascending) | [Rows in the game](REFERENCE.md#rows-in-the-game) |
|
|
256
262
|
| A button on a dependency's delegated action | `UiItem.buttonAction("ReceiveButton", "Receive", args, options)` (first check `types.<T>.uiComponents`, keyed by class name without the `<T>` prefix: a package may already ship the button); `args` takes only the names under `types.<T>.delegatedActions.Receive.parameters` of the surface and needs each `required: true` one; with none required it may be `undefined` | [Dependencies](REFERENCE.md#dependencies) |
|
|
257
263
|
| Code template | `codeTemplates: [{ outputFileName: "File.cs", templateSource: text }]` with a `?raw` import | [Code templates](REFERENCE.md#code-templates) |
|
|
@@ -277,6 +283,8 @@ Names and ids:
|
|
|
277
283
|
| `{"kind":"uiComponentUnknownDelegatedAction",...}` | `UiItem.buttonAction` names a method the target lacks. | Register the delegated action on that type. |
|
|
278
284
|
| `{"kind":"duplicateUiComponentClassName",...}` | Two items of the same type share a class name. | Make class names unique per type. |
|
|
279
285
|
| `{"kind":"uiComponentTemplateLabelKeyMismatch",...}` | `{key}` placeholders and `sources` keys differ. | Make them match one to one. |
|
|
286
|
+
| `{"kind":"uiComponentTemplateLabelLocaleInvalid",...,"issue":{...}}` | A template per locale with no locale, a tag that is no BCP 47 locale, one locale twice, or empty text (`issue.kind`). | Fix that locale or text. |
|
|
287
|
+
| `{"kind":"uiComponentTemplateLabelLocalePlaceholderMissing",...,"locale":"en","key":"count"}` | `locale`'s template leaves out `{key}`, which another locale's template uses. | Write `{key}` in that locale's template too. |
|
|
280
288
|
| `{"kind":"singleEntryInstanceIdMismatch",...,"expectedId":"..."}` | Wrong row id on a single-entry type. | Use `expectedId`. |
|
|
281
289
|
| `{"kind":"uiComponentForeignRowSingleEntryIdMismatch",...,"expectedId":"..."}` | A `UiSource.rowProp` names another row of a single-entry type than its one row, which is the only row its Handler holds. | Use `expectedId` (`types.<Type>.singleEntryRowId` of the surface). |
|
|
282
290
|
| `{"kind":"invalidCompositeKey","reason":"unsupportedMemberBindingHint",...}` | A key member without `masterData` / `assetDelivery`. | Add the hint. |
|
|
@@ -482,10 +490,24 @@ The game signs in to GS2 with a client ID and a client secret. Take them from th
|
|
|
482
490
|
- In Unity, they go into a `Gs2Environment` asset (Create > Game Server Services > Core > Environment) with `region`,
|
|
483
491
|
`clientId`, `clientSecret` and `name`. `Gs2ClientHolder` lists the asset under Environments, and its Active
|
|
484
492
|
Environment Name must equal the asset's `name` field, not its file name.
|
|
485
|
-
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
`
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
493
|
+
- `"<GS2 Studio>" deploy unity-environment --unity-project <unity>` writes them into
|
|
494
|
+
`Assets/GS2Studio/Gs2Environment.asset` (environment name `GS2Studio`) without printing them; pass `--project` and
|
|
495
|
+
`--region`. It signs in with the developer's account only to read them, with the sign-in the user saved by running
|
|
496
|
+
`"<GS2 Studio>" login` in their own terminal (your shell cannot answer its password prompt: ask the user to run it);
|
|
497
|
+
only the two output values go into the game. `deploy outputs --stack Default` prints them; do not run it where the
|
|
498
|
+
terminal is recorded or shared.
|
|
499
|
+
|
|
500
|
+
## 9. Master data after a deploy
|
|
501
|
+
|
|
502
|
+
- A deploy that changes master data (rows, rewards, costs, schedules) does not reach every player at once: GS2 caches
|
|
503
|
+
master data for up to 5 minutes. A request served by a node without the cache gets the new data right away, so a
|
|
504
|
+
player can see the new and the old values alternate for a few minutes.
|
|
505
|
+
- When you check a change in the game, wait about 5 minutes before deciding it did not apply. Do not deploy again or
|
|
506
|
+
change the DSL because a new value has not shown up yet.
|
|
507
|
+
- For a live game that must switch master data at a set moment for every player, GS2-Distributor fixes the master
|
|
508
|
+
data each request reads to the content at a given time: the developer's server signs that time with
|
|
509
|
+
`SignFreezeMasterDataTimestamp`, and the game passes the signed time to `FreezeMasterDataBySignedTimestamp`, which
|
|
510
|
+
returns a `Gs2Domain` that attaches the fixed version to every request it sends. Suggest it when the user needs
|
|
511
|
+
updates to take effect at a precise time; it needs a server that holds the signing key, so do not add it on your own.
|
|
512
|
+
See https://docs.gs2.io/ja/api_reference/distributor/sdk/#signfreezemasterdatatimestamp and
|
|
513
|
+
https://docs.gs2.io/ja/api_reference/distributor/game_engine/#freezemasterdatabysignedtimestamp.
|
package/README.md
CHANGED
|
@@ -9,11 +9,11 @@ type-check; use these declarations in your editor and with `tsc --noEmit`.
|
|
|
9
9
|
- For LLM coding agents: [LLM.md](LLM.md)
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
|
-
npm install --save-dev gs2-studio-dsl@2026.11.
|
|
12
|
+
npm install --save-dev gs2-studio-dsl@2026.11.18
|
|
13
13
|
```
|
|
14
14
|
|
|
15
15
|
The version is the GS2 Studio version whose DSL these declarations describe: a DSL written
|
|
16
|
-
against gs2-studio-dsl 2026.11.
|
|
16
|
+
against gs2-studio-dsl 2026.11.18 builds with GS2 Studio 2026.11.18 and later. Install the version that
|
|
17
17
|
matches the oldest GS2 Studio you build with.
|
|
18
18
|
|
|
19
19
|
```ts
|
|
@@ -73,9 +73,12 @@ The GS2 Studio executable runs the `dsl` commands headless and exits with their
|
|
|
73
73
|
"<GS2 Studio>" dsl build --dir <project> --entry <dsl/index.ts> --write-ledger
|
|
74
74
|
```
|
|
75
75
|
|
|
76
|
-
`<GS2 Studio>` is `/Applications/GS2 Studio.app/Contents/MacOS/GS2 Studio` on macOS
|
|
77
|
-
`GS2-Studio-<version>-linux-<arch>.AppImage` file on Linux
|
|
78
|
-
|
|
76
|
+
`<GS2 Studio>` is `/Applications/GS2 Studio.app/Contents/MacOS/GS2 Studio` on macOS, the
|
|
77
|
+
`GS2-Studio-<version>-linux-<arch>.AppImage` file on Linux, and `bin\gs2studio.cmd` in the install directory on Windows. `gs2studio`
|
|
78
|
+
runs it when it is on PATH (the installer puts it there on Windows; on macOS and Linux, "Install 'gs2studio' Command in PATH"
|
|
79
|
+
in the app's menu). `"<GS2 Studio>" guide` prints every step from creating a project and adding packages, through
|
|
80
|
+
`dsl init`, to deploying to GS2 and generating the Unity code.
|
|
81
|
+
`--help` lists every command and option.
|
|
79
82
|
|
|
80
83
|
## License
|
|
81
84
|
|
package/REFERENCE.md
CHANGED
|
@@ -406,8 +406,11 @@ UiItem.label("NameLabel", UiSource.prop("displayName")),
|
|
|
406
406
|
- Only `.assetDelivery()` is accepted: no GS2 resource field holds text per locale, so it is neither a binding nor an
|
|
407
407
|
action transform argument. It cannot be a list element, a key or sort member, a transform parameter, or a property of
|
|
408
408
|
an inline element.
|
|
409
|
-
- Unity: generated code reads it as `Gs2Bind.Localization.Gs2LocalizedText`, which `io.gs2.bind`
|
|
410
|
-
|
|
409
|
+
- Unity: generated code reads it as `Gs2Bind.Localization.Gs2LocalizedText`, which `io.gs2.bind` 2026.11.3 and later
|
|
410
|
+
provide, so code generation raises the Unity project's `io.gs2.bind` to that release (it never lowers a pin).
|
|
411
|
+
`io.gs2.unity.sdk` comes with it as its dependency; a project that pins `io.gs2.unity.sdk` / `io.gs2.csharp.sdk`
|
|
412
|
+
itself has the pin raised to 2026.11.12 / 2026.11.10, the SDKs it compiles against. A project without localized
|
|
413
|
+
properties or [localized templates](#localized-templates) needs no newer `io.gs2.bind`.
|
|
411
414
|
A `label` shows the translation for `Gs2Locale.Current`: the exact locale, then the same language, then `en`, then
|
|
412
415
|
`ja`, then the first one. The locale starts from the device language; with `com.unity.localization` installed it
|
|
413
416
|
follows Unity Localization's selected locale with nothing to set up, and without it the game calls
|
|
@@ -435,6 +438,40 @@ UiItem.activeToggle("NameToggle", UiCond.truthy(UiSource.prop("displayName"))),
|
|
|
435
438
|
- Like a `label`, a `templateLabel`, `activeToggle` or `interactable` that reads localized text applies itself again
|
|
436
439
|
when `Gs2Locale.Changed` fires while it is enabled.
|
|
437
440
|
|
|
441
|
+
#### Localized templates
|
|
442
|
+
|
|
443
|
+
The template of a `templateLabel` can be text per locale too, for the words around values and for fixed text such as a
|
|
444
|
+
heading or a button caption. Fixed text is a template without placeholders, with no sources:
|
|
445
|
+
|
|
446
|
+
```ts
|
|
447
|
+
UiItem.templateLabel(
|
|
448
|
+
"CountLabel",
|
|
449
|
+
{ ja: "残り {count} 個", en: "{count} left" },
|
|
450
|
+
{ count: UiSource.prop("count") }
|
|
451
|
+
),
|
|
452
|
+
UiItem.templateLabel(
|
|
453
|
+
"HeadingLabel",
|
|
454
|
+
{ ja: "ギフトショップ", en: "Gift shop", "zh-Hant": "禮品店" },
|
|
455
|
+
{}
|
|
456
|
+
),
|
|
457
|
+
```
|
|
458
|
+
|
|
459
|
+
- Its locales follow the rules of a `PT.localizedString` row: any set of BCP 47 tags (`en`, `ja`, `zh-Hant`, `ko`),
|
|
460
|
+
each once, every text non-empty, and at least one (`uiComponentTemplateLabelLocaleInvalid` names the problem). It is stored under canonical tags (`ja-jp` becomes
|
|
461
|
+
`ja-JP`).
|
|
462
|
+
- Every locale's template uses the same placeholders, in its own order (`"残り {count} 個"`, `"{count} left"`). A
|
|
463
|
+
locale that leaves out a placeholder another locale uses fails with `uiComponentTemplateLabelLocalePlaceholderMissing`
|
|
464
|
+
(`locale`, `key`), so no language drops a value; `sources` match the placeholders as for one template.
|
|
465
|
+
- Unity: the component sends the template for `Gs2Locale.Current`, chosen as a `label` chooses a translation (the exact
|
|
466
|
+
locale, then the same language, then `en`, then `ja`, then the first one), and sends it again when
|
|
467
|
+
`Gs2Locale.Changed` fires while it is enabled. It needs no localized property: code generation raises `io.gs2.bind`
|
|
468
|
+
to 2026.11.3 as localized properties do.
|
|
469
|
+
- Fixed text reads no row, so it is sent as soon as the component is enabled, before its handler holds a row, and
|
|
470
|
+
`fallbackText` is not used. Like every item, it still needs the type's handler above it. A template with placeholders
|
|
471
|
+
sends `fallbackText` while no row is loaded, as one template does.
|
|
472
|
+
- A package that has one needs GS2 Studio 2026.11.18 or later, which its `package.json` states for older releases to
|
|
473
|
+
refuse it. A template given as one string reads the same in every locale.
|
|
474
|
+
|
|
438
475
|
### Conditions
|
|
439
476
|
|
|
440
477
|
`Cond` builds the conditions of `requiredWhen` and `optionalWhen`. `propertyName` names another property of the same
|
|
@@ -1136,15 +1173,16 @@ row again when it is shown. `interactable` changes only `interactable`, so it ca
|
|
|
1136
1173
|
| --- | --- | --- |
|
|
1137
1174
|
| `UiItem.label(className, source, options?)` | `source`: `UiSource.prop(...)` or `UiSource.lit(...)`. `options.fallbackText`: the text sent while the property has no value. | Sends the value as text through `OnUpdate` (`UnityEvent<string>`). A `timestamp` is written `yyyy-MM-dd HH:mm`; other values are converted with `Convert.ToString`, so a list or inline element property does not show its contents. A `PT.localizedString` source sends the translation for the player's locale and sends again when the locale changes ([Localized text](#localized-text)); of the other items only `templateLabel` and the `UiCond` of `activeToggle` and `interactable` accept that source. |
|
|
1138
1175
|
| `UiItem.value(className, propertySource, options?)` | `propertySource`: `UiSource.prop(...)` of a property of a primitive type, a `ref`, or `"id"`. No literal. | Sends the value in its own C# type through `OnUpdate`: `UnityEvent<int>` for `int32`, `long` for `int64`, `float`, `double`, `bool`, `string`, `DateTime` for `timestamp`, and `string` for a `ref` or `"id"`. A missing value is sent as the type's default (`0`, `""`). `Select(value)` raises `OnSelect` with a value the game passes. Any other property type (`enum`, a list, an inline element) leaves the item out with a warning. |
|
|
1139
|
-
| `UiItem.
|
|
1176
|
+
| `UiItem.countdown(className, propertySource, options?)` | `propertySource`: `UiSource.prop(...)` of a `timestamp` property. No literal. `options.fallbackText`: the text sent while the property holds no time. | Counts down to the time on GS2's clock for the player's session (UTC shifted by the access token's time offset) with GS2-Bind's `Gs2Countdown`, so code generation raises the Unity project's `io.gs2.bind` to 2026.11.3 or later, and a pin of `io.gs2.unity.sdk` / `io.gs2.csharp.sdk` the project has itself to 2026.11.12 / 2026.11.10 or later. Once a second, reading the clock each time, and again whenever the row changes, it sends the time left as text through `OnUpdate` (`UnityEvent<string>`: `m:ss`, `h:mm:ss` from an hour on) and in whole seconds through `OnRemaining` (`UnityEvent<TimeSpan>`), ending at `0:00`; `OnCounting` (`UnityEvent<bool>`) sends `true` when it starts. A time of 0 or before, or no value, is no time (GS2's next recovery of a full stamina): it sends the fallback text through `OnUpdate` and `false` through `OnCounting`, and nothing through `OnRemaining`. It reads the session from the scene's `Gs2HolderRuntimeContextProvider` (or the provider given to its `SetRuntimeProvider`) and warns once when there is none, counting on UTC alone. Any other property type leaves the item out with a warning. |
|
|
1177
|
+
| `UiItem.templateLabel(className, template, sources, options?)` | `template` with `{key}` placeholders, or text per locale such as `{ ja: "残り {count} 個", en: "{count} left" }` ([Localized templates](#localized-templates)); `sources` maps each key to a source. Every placeholder needs exactly one source and every source a placeholder. `options.fallbackText`: the text sent while no row is loaded. | Sends `template` with each `{key}` replaced by its value through `OnUpdate` (`UnityEvent<string>`). A `PT.localizedString` source is replaced by the translation for the player's locale, and the text is sent again when the locale changes ([Localized text](#localized-text)). A template per locale is the one for the player's locale; without placeholders it is fixed text, such as a heading or a button caption, sent without waiting for a row. |
|
|
1140
1178
|
| `UiItem.image(className, source, imageMode, options?)` | `imageMode`: `"spriteResourcePath"`, `"addressableKey"`, `"url"` or `"assetReference"`. `options.fallback`: the reference used while the property has no value. | Calls `partial void ApplyImage(Image target, string reference)`, which the game implements in its own part of the class to load the image; `ImageMode` names the mode. The generated code loads nothing. |
|
|
1141
|
-
| `UiItem.gauge(className, current, max, options?)` | Numeric sources. `options.min` accepts the same sources as `max` and defaults to 0; `options.clamp` (default `true`) keeps the fill between 0 and 1. | Sets `fillAmount` of its target `Image` to `(current - min) / (max - min)`, or 0 when that range is not positive. A non-numeric source leaves the item out with a warning. |
|
|
1179
|
+
| `UiItem.gauge(className, current, max, options?)` | Numeric sources. `options.min` accepts the same sources as `max` and defaults to 0; `options.clamp` (default `true`) keeps the fill between 0 and 1. | Sets `fillAmount` of its target `Image` to `(current - min) / (max - min)`, or 0 when that range is not positive, and warns once when that `Image` is not of Image Type Filled or has no sprite, which show no fill. A non-numeric source leaves the item out with a warning. |
|
|
1142
1180
|
| `UiItem.buttonAction(className, methodName, args?, options?)` | `methodName`: a delegated action of the target. `args` binds by name the parameters the action's generated method takes from its caller (for a dependency's action, its surface's `parameters`; see [Dependencies](#dependencies)); the sources are read when the button is clicked. | Calls the method for the row when its `Button` is clicked and ignores clicks while a call runs; then raises `OnCompleted`, or `OnFailed` on a GS2 error. It never disables the button: add an `interactable` item for that. |
|
|
1143
1181
|
| `UiItem.activeToggle(className, condition, options?)` | A `UiCond` condition. | Activates the GameObjects in `_activeWhenTrue` and deactivates those in `_activeWhenFalse` while the condition holds, and the reverse while it does not. List siblings or children, never the component's own GameObject or an ancestor of it (see above). |
|
|
1144
1182
|
| `UiItem.interactable(className, condition, options?)` | A `UiCond` condition. | Sets `interactable` of the `Selectable`s (such as a `Button`) in `_interactableWhenTrue` to the condition and of those in `_interactableWhenFalse` to its negation. |
|
|
1145
1183
|
|
|
1146
|
-
Choose `label` for a value shown as text as it is, `templateLabel` for text with words around values,
|
|
1147
|
-
value the game formats or uses itself (a number it animates
|
|
1184
|
+
Choose `label` for a value shown as text as it is, `templateLabel` for text with words around values, `countdown` for
|
|
1185
|
+
the time left until a timestamp, and `value` for a value the game formats or uses itself (a number it animates). Sources read only the target row,
|
|
1148
1186
|
apart from the table band sources of `gauge`; a condition also reads the parent row with `UiCond.rowElement` and one row
|
|
1149
1187
|
of any type with `UiSource.rowProp`.
|
|
1150
1188
|
|
|
@@ -1175,6 +1213,16 @@ defineUiComponent(Item, {
|
|
|
1175
1213
|
message: UiSource.prop("giftMessage"),
|
|
1176
1214
|
}),
|
|
1177
1215
|
UiItem.activeToggle("NameToggle", UiCond.truthy(UiSource.prop("displayName"))),
|
|
1216
|
+
UiItem.templateLabel(
|
|
1217
|
+
"CountLabel",
|
|
1218
|
+
{ ja: "残り {count} 個", en: "{count} left" },
|
|
1219
|
+
{ count: UiSource.prop("count") }
|
|
1220
|
+
),
|
|
1221
|
+
UiItem.templateLabel(
|
|
1222
|
+
"HeadingLabel",
|
|
1223
|
+
{ ja: "ギフトショップ", en: "Gift shop", "zh-Hant": "禮品店" },
|
|
1224
|
+
{}
|
|
1225
|
+
),
|
|
1178
1226
|
UiItem.value("GiftCountValue", UiSource.prop("count")),
|
|
1179
1227
|
],
|
|
1180
1228
|
}),
|
|
@@ -1279,6 +1327,10 @@ component and no `UiSource.rowProp`, unless your package mounts its overlay of t
|
|
|
1279
1327
|
A list shows the rows GS2 holds at run time (the deployed master data, or the player's user data), each with the values
|
|
1280
1328
|
of its asset-delivered properties.
|
|
1281
1329
|
|
|
1330
|
+
To show the time left until a timestamp of a row, such as a stamina's next recovery, use a `UiItem.countdown` (or the one
|
|
1331
|
+
the dependency lists in `types.<Type>.uiComponents`) instead of a hand-written timer: it counts on the session's GS2 clock,
|
|
1332
|
+
which `DateTime.UtcNow` is not.
|
|
1333
|
+
|
|
1282
1334
|
A dependency's own UI components are generated with it, so a dependency used as it is needs nothing in the DSL beyond
|
|
1283
1335
|
the dependency and what its surface asks for. `foundation-economy-currency` is an example: the transforms that deposit
|
|
1284
1336
|
into a wallet (`DepositFreeCurrency`, `DepositCurrency`) are all the DSL needs, and no `Wallet` row is needed. The game
|
|
@@ -1789,6 +1841,8 @@ that resolves to nothing (`unresolvedPropertySlot`, `uiComponentUnknownProperty`
|
|
|
1789
1841
|
| `uiComponentForeignRowSourceTypeUnknown`, `uiComponentForeignRowPropertyUnknown`, `uiComponentForeignRowIdInvalid`, `uiComponentForeignRowSingleEntryIdMismatch` | A `UiSource.rowProp` on an unknown type or property, with a row id that is not letters, digits, `_`, `.` and `-`, or, on a single-entry type, with another row id than `expectedId`. |
|
|
1790
1842
|
| `uiComponentConditionTooDeep` | A UI condition nested deeper than `maxDepth`. |
|
|
1791
1843
|
| `uiComponentTemplateLabelKeyMismatch` | A `templateLabel` placeholder without a source, a source without a placeholder, or a key given twice (`direction`). |
|
|
1844
|
+
| `uiComponentTemplateLabelLocaleInvalid` | A template per locale with no locale, a tag that is no BCP 47 locale, one locale twice, or empty text (`issue.kind`). |
|
|
1845
|
+
| `uiComponentTemplateLabelLocalePlaceholderMissing` | `locale`'s template leaves out `{key}`, which another locale's template uses. |
|
|
1792
1846
|
| `unsafeCodeTemplateOutputFileName` | A code template output name that cannot be written as a file. |
|
|
1793
1847
|
|
|
1794
1848
|
## Exported types
|
package/index.d.ts
CHANGED
|
@@ -460,7 +460,147 @@ type InlineListNames<T> = T extends {
|
|
|
460
460
|
undefined
|
|
461
461
|
] ? never : keyof NonNullable<L> & string : never;
|
|
462
462
|
export declare function dependencyPackage<S extends DependencySurface>(surface: S): DependencyPackage<S>;
|
|
463
|
+
declare const PRIMITIVE_TYPES: {
|
|
464
|
+
readonly kinds: readonly ("string" | "int32" | "int64" | "float32" | "float64" | "bool" | "timestamp")[];
|
|
465
|
+
has(value: unknown): value is "string" | "int32" | "int64" | "float32" | "float64" | "bool" | "timestamp";
|
|
466
|
+
};
|
|
467
|
+
type PrimitiveTypeKind = (typeof PRIMITIVE_TYPES.kinds)[number];
|
|
468
|
+
declare const COMPARISON_OPS: {
|
|
469
|
+
readonly kinds: readonly ("eq" | "neq" | "gt" | "gte" | "lt" | "lte")[];
|
|
470
|
+
has(value: unknown): value is "eq" | "neq" | "gt" | "gte" | "lt" | "lte";
|
|
471
|
+
};
|
|
472
|
+
type ComparisonOp = (typeof COMPARISON_OPS.kinds)[number];
|
|
473
|
+
type EqualityComparisonOp = Extract<ComparisonOp, "eq" | "neq">;
|
|
474
|
+
type OrderingComparisonOp = Exclude<ComparisonOp, EqualityComparisonOp>;
|
|
475
|
+
interface AndCondition<TCondition> {
|
|
476
|
+
readonly kind: "and";
|
|
477
|
+
readonly children: readonly TCondition[];
|
|
478
|
+
}
|
|
479
|
+
interface OrCondition<TCondition> {
|
|
480
|
+
readonly kind: "or";
|
|
481
|
+
readonly children: readonly TCondition[];
|
|
482
|
+
}
|
|
483
|
+
interface NotCondition<TCondition> {
|
|
484
|
+
readonly kind: "not";
|
|
485
|
+
readonly child: TCondition;
|
|
486
|
+
}
|
|
487
|
+
type ConditionPropertyName = string;
|
|
488
|
+
type RequirementCondition = {
|
|
489
|
+
readonly kind: EqualityComparisonOp;
|
|
490
|
+
readonly propertyName: ConditionPropertyName;
|
|
491
|
+
readonly value: string | number | boolean;
|
|
492
|
+
} | {
|
|
493
|
+
readonly kind: OrderingComparisonOp;
|
|
494
|
+
readonly propertyName: ConditionPropertyName;
|
|
495
|
+
readonly value: number;
|
|
496
|
+
} | {
|
|
497
|
+
readonly kind: "isSet" | "isNotSet";
|
|
498
|
+
readonly propertyName: ConditionPropertyName;
|
|
499
|
+
} | AndCondition<RequirementCondition> | OrCondition<RequirementCondition> | NotCondition<RequirementCondition>;
|
|
500
|
+
declare const BINDING_HINT_KINDS: {
|
|
501
|
+
readonly kinds: readonly ("none" | "masterData" | "userData" | "assetDelivery")[];
|
|
502
|
+
has(value: unknown): value is "none" | "masterData" | "userData" | "assetDelivery";
|
|
503
|
+
};
|
|
504
|
+
type BindingHintKind = (typeof BINDING_HINT_KINDS.kinds)[number];
|
|
505
|
+
/** An instance value of `PT.localizedString`: non-empty text per locale, such as `{ ja: "森の巡回", en: "Forest Patrol" }`. */
|
|
506
|
+
export type LocalizedStringValue = {
|
|
507
|
+
readonly [locale: string]: string;
|
|
508
|
+
};
|
|
509
|
+
type PrimitivePropertyTypeNode = {
|
|
510
|
+
readonly kind: "primitive";
|
|
511
|
+
readonly primitiveType: PrimitiveTypeKind;
|
|
512
|
+
};
|
|
513
|
+
type LocalizedStringPropertyTypeNode = {
|
|
514
|
+
readonly kind: "localizedString";
|
|
515
|
+
};
|
|
516
|
+
type EnumPropertyTypeNode = {
|
|
517
|
+
readonly kind: "enum";
|
|
518
|
+
readonly values: readonly string[];
|
|
519
|
+
};
|
|
520
|
+
type RefPropertyTypeNode = {
|
|
521
|
+
readonly kind: "ref";
|
|
522
|
+
readonly target: LazyDomainTypeTarget;
|
|
523
|
+
};
|
|
524
|
+
type InlinePropertyTypeNode = {
|
|
525
|
+
readonly kind: "inline";
|
|
526
|
+
readonly target: LazyDomainTypeTarget;
|
|
527
|
+
};
|
|
528
|
+
type InlineElementTypeNode = {
|
|
529
|
+
readonly kind: "inlineElement";
|
|
530
|
+
readonly schema: InlineElementDef;
|
|
531
|
+
};
|
|
532
|
+
type VerifyActionPropertyTypeNode = {
|
|
533
|
+
readonly kind: "verifyAction";
|
|
534
|
+
};
|
|
535
|
+
type ConsumeActionPropertyTypeNode = {
|
|
536
|
+
readonly kind: "consumeAction";
|
|
537
|
+
};
|
|
538
|
+
type AcquireActionPropertyTypeNode = {
|
|
539
|
+
readonly kind: "acquireAction";
|
|
540
|
+
};
|
|
541
|
+
type PropertyElementTypeNode = PrimitivePropertyTypeNode | EnumPropertyTypeNode | RefPropertyTypeNode | InlinePropertyTypeNode | VerifyActionPropertyTypeNode | ConsumeActionPropertyTypeNode | AcquireActionPropertyTypeNode;
|
|
542
|
+
type ListPropertyTypeNode<TElement extends PropertyElementTypeNode | InlineElementTypeNode = PropertyElementTypeNode | InlineElementTypeNode> = {
|
|
543
|
+
readonly kind: "list";
|
|
544
|
+
readonly elementType: TElement;
|
|
545
|
+
};
|
|
546
|
+
type PropertyTypeNode = PropertyElementTypeNode | LocalizedStringPropertyTypeNode | ListPropertyTypeNode;
|
|
547
|
+
type PropertyValueOf<T> = T extends PropertySpec<infer TValue, boolean, PropertyTypeNode> ? TValue : FileDomainPropertyValueDto;
|
|
548
|
+
type IsRequiredProperty<T> = T extends PropertySpec<FileDomainPropertyValueDto, true, PropertyTypeNode, true> ? false : T extends PropertySpec<FileDomainPropertyValueDto, true, PropertyTypeNode> ? true : false;
|
|
549
|
+
interface PropertySpec<TValue extends FileDomainPropertyValueDto = FileDomainPropertyValueDto, TRequired extends boolean = boolean, TNode extends PropertyTypeNode = PropertyTypeNode, TUserData extends boolean = boolean> {
|
|
550
|
+
readonly __brand: "PropertySpec";
|
|
551
|
+
readonly __value?: TValue;
|
|
552
|
+
readonly __required?: TRequired;
|
|
553
|
+
readonly __userData?: TUserData;
|
|
554
|
+
readonly type: TNode;
|
|
555
|
+
readonly requirement: FileRequirementDto;
|
|
556
|
+
readonly bindingHint?: BindingHintKind;
|
|
557
|
+
readonly localizedDisplay?: LocalizedDisplaySnapshotDto;
|
|
558
|
+
localizedDisplayOf(display: LocalizedDisplaySnapshotDto): PropertySpec<TValue, TRequired, TNode, TUserData>;
|
|
559
|
+
display(display: LocalizedDisplaySnapshotDto): PropertySpec<TValue, TRequired, TNode, TUserData>;
|
|
560
|
+
required(): PropertySpec<TValue, true, TNode, TUserData>;
|
|
561
|
+
requiredWhen(condition: RequirementCondition, requiredWhenMet?: boolean): PropertySpec<TValue, false, TNode, TUserData>;
|
|
562
|
+
optionalWhen(condition: RequirementCondition): PropertySpec<TValue, false, TNode, TUserData>;
|
|
563
|
+
masterData(): PropertySpec<TValue, TRequired, TNode, false>;
|
|
564
|
+
userData(): PropertySpec<TValue, TRequired, TNode, true>;
|
|
565
|
+
assetDelivery(): PropertySpec<TValue, TRequired, TNode, false>;
|
|
566
|
+
}
|
|
567
|
+
type InlineElementSpec = InlineElementTypeNode;
|
|
568
|
+
export declare const PT: {
|
|
569
|
+
readonly string: () => PropertySpec<string, false, PrimitivePropertyTypeNode, false>;
|
|
570
|
+
readonly int32: () => PropertySpec<number, false, PrimitivePropertyTypeNode, false>;
|
|
571
|
+
readonly int64: () => PropertySpec<number, false, PrimitivePropertyTypeNode, false>;
|
|
572
|
+
readonly float32: () => PropertySpec<number, false, PrimitivePropertyTypeNode, false>;
|
|
573
|
+
readonly float64: () => PropertySpec<number, false, PrimitivePropertyTypeNode, false>;
|
|
574
|
+
readonly bool: () => PropertySpec<boolean, false, PrimitivePropertyTypeNode, false>;
|
|
575
|
+
readonly timestamp: () => PropertySpec<string, false, PrimitivePropertyTypeNode, false>;
|
|
576
|
+
/** Text per locale, delivered to the client as an asset: only `.assetDelivery()` is accepted. */
|
|
577
|
+
readonly localizedString: () => PropertySpec<LocalizedStringValue, false, LocalizedStringPropertyTypeNode, false>;
|
|
578
|
+
readonly enum: <T extends string>(...values: readonly T[]) => PropertySpec<T, false, EnumPropertyTypeNode, false>;
|
|
579
|
+
readonly ref: (target: LazyDomainTypeTarget) => PropertySpec<string, false, RefPropertyTypeNode, false>;
|
|
580
|
+
readonly inline: (target: LazyDomainTypeTarget) => PropertySpec<FileDomainPropertyValueDto, false, InlinePropertyTypeNode, false>;
|
|
581
|
+
readonly inlineElement: (schema: InlineElementDef) => InlineElementSpec;
|
|
582
|
+
readonly listOf: <TElement extends PropertySpec<FileDomainPropertyValueDto, boolean, PropertyElementTypeNode> | InlineElementSpec>(element: TElement) => PropertySpec<FileDomainPropertyValueDto, false, ListPropertyTypeNode, false>;
|
|
583
|
+
readonly verifyAction: () => PropertySpec<FileDomainPropertyValueDto, false, VerifyActionPropertyTypeNode, false>;
|
|
584
|
+
readonly consumeAction: () => PropertySpec<FileDomainPropertyValueDto, false, ConsumeActionPropertyTypeNode, false>;
|
|
585
|
+
readonly acquireAction: () => PropertySpec<FileDomainPropertyValueDto, false, AcquireActionPropertyTypeNode, false>;
|
|
586
|
+
};
|
|
587
|
+
type ConditionScalar = string | number | boolean;
|
|
588
|
+
/** The signatures refuse the shapes the stored-condition parser rejects: a non-scalar comparison value and an empty junction. */
|
|
589
|
+
export declare const Cond: {
|
|
590
|
+
readonly eq: (propertyName: string, value: ConditionScalar) => RequirementCondition;
|
|
591
|
+
readonly neq: (propertyName: string, value: ConditionScalar) => RequirementCondition;
|
|
592
|
+
readonly isSet: (propertyName: string) => RequirementCondition;
|
|
593
|
+
readonly isNotSet: (propertyName: string) => RequirementCondition;
|
|
594
|
+
readonly not: (condition: RequirementCondition) => RequirementCondition;
|
|
595
|
+
readonly and: (conditions_0: RequirementCondition, ...conditions: RequirementCondition[]) => RequirementCondition;
|
|
596
|
+
readonly or: (conditions_0: RequirementCondition, ...conditions: RequirementCondition[]) => RequirementCondition;
|
|
597
|
+
readonly gt: (propertyName: string, value: number) => RequirementCondition;
|
|
598
|
+
readonly lt: (propertyName: string, value: number) => RequirementCondition;
|
|
599
|
+
readonly gte: (propertyName: string, value: number) => RequirementCondition;
|
|
600
|
+
readonly lte: (propertyName: string, value: number) => RequirementCondition;
|
|
601
|
+
};
|
|
463
602
|
type UiLiteralValue = string | number | boolean | null;
|
|
603
|
+
type UiTemplateText = string | LocalizedStringValue;
|
|
464
604
|
type UiImageMode = UiImageModeSnapshotDto;
|
|
465
605
|
type UiTableBandEdge = "lower" | "upper";
|
|
466
606
|
/**
|
|
@@ -543,6 +683,11 @@ export type UiItemSpec<TName extends string = string> = ({
|
|
|
543
683
|
readonly kind: "value";
|
|
544
684
|
readonly componentClassName: string;
|
|
545
685
|
readonly source: UiPropertySourceSpec<TName>;
|
|
686
|
+
} & UiItemOptions) | ({
|
|
687
|
+
readonly kind: "countdown";
|
|
688
|
+
readonly componentClassName: string;
|
|
689
|
+
readonly source: UiPropertySourceSpec<TName>;
|
|
690
|
+
readonly fallbackText?: string;
|
|
546
691
|
} & UiItemOptions) | ({
|
|
547
692
|
readonly kind: "image";
|
|
548
693
|
readonly componentClassName: string;
|
|
@@ -568,7 +713,7 @@ export type UiItemSpec<TName extends string = string> = ({
|
|
|
568
713
|
} & UiItemOptions) | ({
|
|
569
714
|
readonly kind: "templateLabel";
|
|
570
715
|
readonly componentClassName: string;
|
|
571
|
-
readonly template:
|
|
716
|
+
readonly template: UiTemplateText;
|
|
572
717
|
readonly sources: Readonly<Record<string, UiValueSourceSpec<TName>>>;
|
|
573
718
|
readonly fallbackText?: string;
|
|
574
719
|
} & UiItemOptions);
|
|
@@ -605,6 +750,9 @@ export declare const UiItem: {
|
|
|
605
750
|
readonly fallbackText?: string;
|
|
606
751
|
}) => UiItemSpec<TName>;
|
|
607
752
|
readonly value: <TName extends string = never>(componentClassName: string, source: NoInfer<UiPropertySourceSpec<TName>>, options?: UiItemOptions) => UiItemSpec<TName>;
|
|
753
|
+
readonly countdown: <TName extends string = never>(componentClassName: string, source: NoInfer<UiPropertySourceSpec<TName>>, options?: UiItemOptions & {
|
|
754
|
+
readonly fallbackText?: string;
|
|
755
|
+
}) => UiItemSpec<TName>;
|
|
608
756
|
readonly image: <TName extends string = never>(componentClassName: string, source: NoInfer<UiValueSourceSpec<TName>>, imageMode: UiImageMode, options?: UiItemOptions & {
|
|
609
757
|
readonly fallback?: string;
|
|
610
758
|
}) => UiItemSpec<TName>;
|
|
@@ -615,7 +763,7 @@ export declare const UiItem: {
|
|
|
615
763
|
readonly buttonAction: <TName extends string = never>(componentClassName: string, methodName: string, args?: NoInfer<Readonly<Record<string, UiValueSourceSpec<TName>>>>, options?: UiItemOptions) => UiItemSpec<TName>;
|
|
616
764
|
readonly activeToggle: <TName extends string = never>(componentClassName: string, condition: NoInfer<UiConditionSpec<TName>>, options?: UiItemOptions) => UiItemSpec<TName>;
|
|
617
765
|
readonly interactable: <TName extends string = never>(componentClassName: string, condition: NoInfer<UiConditionSpec<TName>>, options?: UiItemOptions) => UiItemSpec<TName>;
|
|
618
|
-
readonly templateLabel: <TName extends string = never>(componentClassName: string, template:
|
|
766
|
+
readonly templateLabel: <TName extends string = never>(componentClassName: string, template: UiTemplateText, sources: NoInfer<Readonly<Record<string, UiValueSourceSpec<TName>>>>, options?: UiItemOptions & {
|
|
619
767
|
readonly fallbackText?: string;
|
|
620
768
|
}) => UiItemSpec<TName>;
|
|
621
769
|
};
|
|
@@ -5707,145 +5855,6 @@ interface ModelRef<S extends Gs2ServiceName = Gs2ServiceName, M extends ModelNam
|
|
|
5707
5855
|
readonly service: S;
|
|
5708
5856
|
readonly modelName: M;
|
|
5709
5857
|
}
|
|
5710
|
-
declare const PRIMITIVE_TYPES: {
|
|
5711
|
-
readonly kinds: readonly ("string" | "int32" | "int64" | "float32" | "float64" | "bool" | "timestamp")[];
|
|
5712
|
-
has(value: unknown): value is "string" | "int32" | "int64" | "float32" | "float64" | "bool" | "timestamp";
|
|
5713
|
-
};
|
|
5714
|
-
type PrimitiveTypeKind = (typeof PRIMITIVE_TYPES.kinds)[number];
|
|
5715
|
-
declare const COMPARISON_OPS: {
|
|
5716
|
-
readonly kinds: readonly ("eq" | "neq" | "gt" | "gte" | "lt" | "lte")[];
|
|
5717
|
-
has(value: unknown): value is "eq" | "neq" | "gt" | "gte" | "lt" | "lte";
|
|
5718
|
-
};
|
|
5719
|
-
type ComparisonOp = (typeof COMPARISON_OPS.kinds)[number];
|
|
5720
|
-
type EqualityComparisonOp = Extract<ComparisonOp, "eq" | "neq">;
|
|
5721
|
-
type OrderingComparisonOp = Exclude<ComparisonOp, EqualityComparisonOp>;
|
|
5722
|
-
interface AndCondition<TCondition> {
|
|
5723
|
-
readonly kind: "and";
|
|
5724
|
-
readonly children: readonly TCondition[];
|
|
5725
|
-
}
|
|
5726
|
-
interface OrCondition<TCondition> {
|
|
5727
|
-
readonly kind: "or";
|
|
5728
|
-
readonly children: readonly TCondition[];
|
|
5729
|
-
}
|
|
5730
|
-
interface NotCondition<TCondition> {
|
|
5731
|
-
readonly kind: "not";
|
|
5732
|
-
readonly child: TCondition;
|
|
5733
|
-
}
|
|
5734
|
-
type ConditionPropertyName = string;
|
|
5735
|
-
type RequirementCondition = {
|
|
5736
|
-
readonly kind: EqualityComparisonOp;
|
|
5737
|
-
readonly propertyName: ConditionPropertyName;
|
|
5738
|
-
readonly value: string | number | boolean;
|
|
5739
|
-
} | {
|
|
5740
|
-
readonly kind: OrderingComparisonOp;
|
|
5741
|
-
readonly propertyName: ConditionPropertyName;
|
|
5742
|
-
readonly value: number;
|
|
5743
|
-
} | {
|
|
5744
|
-
readonly kind: "isSet" | "isNotSet";
|
|
5745
|
-
readonly propertyName: ConditionPropertyName;
|
|
5746
|
-
} | AndCondition<RequirementCondition> | OrCondition<RequirementCondition> | NotCondition<RequirementCondition>;
|
|
5747
|
-
declare const BINDING_HINT_KINDS: {
|
|
5748
|
-
readonly kinds: readonly ("none" | "masterData" | "userData" | "assetDelivery")[];
|
|
5749
|
-
has(value: unknown): value is "none" | "masterData" | "userData" | "assetDelivery";
|
|
5750
|
-
};
|
|
5751
|
-
type BindingHintKind = (typeof BINDING_HINT_KINDS.kinds)[number];
|
|
5752
|
-
/** An instance value of `PT.localizedString`: non-empty text per locale, such as `{ ja: "森の巡回", en: "Forest Patrol" }`. */
|
|
5753
|
-
export type LocalizedStringValue = {
|
|
5754
|
-
readonly [locale: string]: string;
|
|
5755
|
-
};
|
|
5756
|
-
type PrimitivePropertyTypeNode = {
|
|
5757
|
-
readonly kind: "primitive";
|
|
5758
|
-
readonly primitiveType: PrimitiveTypeKind;
|
|
5759
|
-
};
|
|
5760
|
-
type LocalizedStringPropertyTypeNode = {
|
|
5761
|
-
readonly kind: "localizedString";
|
|
5762
|
-
};
|
|
5763
|
-
type EnumPropertyTypeNode = {
|
|
5764
|
-
readonly kind: "enum";
|
|
5765
|
-
readonly values: readonly string[];
|
|
5766
|
-
};
|
|
5767
|
-
type RefPropertyTypeNode = {
|
|
5768
|
-
readonly kind: "ref";
|
|
5769
|
-
readonly target: LazyDomainTypeTarget;
|
|
5770
|
-
};
|
|
5771
|
-
type InlinePropertyTypeNode = {
|
|
5772
|
-
readonly kind: "inline";
|
|
5773
|
-
readonly target: LazyDomainTypeTarget;
|
|
5774
|
-
};
|
|
5775
|
-
type InlineElementTypeNode = {
|
|
5776
|
-
readonly kind: "inlineElement";
|
|
5777
|
-
readonly schema: InlineElementDef;
|
|
5778
|
-
};
|
|
5779
|
-
type VerifyActionPropertyTypeNode = {
|
|
5780
|
-
readonly kind: "verifyAction";
|
|
5781
|
-
};
|
|
5782
|
-
type ConsumeActionPropertyTypeNode = {
|
|
5783
|
-
readonly kind: "consumeAction";
|
|
5784
|
-
};
|
|
5785
|
-
type AcquireActionPropertyTypeNode = {
|
|
5786
|
-
readonly kind: "acquireAction";
|
|
5787
|
-
};
|
|
5788
|
-
type PropertyElementTypeNode = PrimitivePropertyTypeNode | EnumPropertyTypeNode | RefPropertyTypeNode | InlinePropertyTypeNode | VerifyActionPropertyTypeNode | ConsumeActionPropertyTypeNode | AcquireActionPropertyTypeNode;
|
|
5789
|
-
type ListPropertyTypeNode<TElement extends PropertyElementTypeNode | InlineElementTypeNode = PropertyElementTypeNode | InlineElementTypeNode> = {
|
|
5790
|
-
readonly kind: "list";
|
|
5791
|
-
readonly elementType: TElement;
|
|
5792
|
-
};
|
|
5793
|
-
type PropertyTypeNode = PropertyElementTypeNode | LocalizedStringPropertyTypeNode | ListPropertyTypeNode;
|
|
5794
|
-
type PropertyValueOf<T> = T extends PropertySpec<infer TValue, boolean, PropertyTypeNode> ? TValue : FileDomainPropertyValueDto;
|
|
5795
|
-
type IsRequiredProperty<T> = T extends PropertySpec<FileDomainPropertyValueDto, true, PropertyTypeNode, true> ? false : T extends PropertySpec<FileDomainPropertyValueDto, true, PropertyTypeNode> ? true : false;
|
|
5796
|
-
interface PropertySpec<TValue extends FileDomainPropertyValueDto = FileDomainPropertyValueDto, TRequired extends boolean = boolean, TNode extends PropertyTypeNode = PropertyTypeNode, TUserData extends boolean = boolean> {
|
|
5797
|
-
readonly __brand: "PropertySpec";
|
|
5798
|
-
readonly __value?: TValue;
|
|
5799
|
-
readonly __required?: TRequired;
|
|
5800
|
-
readonly __userData?: TUserData;
|
|
5801
|
-
readonly type: TNode;
|
|
5802
|
-
readonly requirement: FileRequirementDto;
|
|
5803
|
-
readonly bindingHint?: BindingHintKind;
|
|
5804
|
-
readonly localizedDisplay?: LocalizedDisplaySnapshotDto;
|
|
5805
|
-
localizedDisplayOf(display: LocalizedDisplaySnapshotDto): PropertySpec<TValue, TRequired, TNode, TUserData>;
|
|
5806
|
-
display(display: LocalizedDisplaySnapshotDto): PropertySpec<TValue, TRequired, TNode, TUserData>;
|
|
5807
|
-
required(): PropertySpec<TValue, true, TNode, TUserData>;
|
|
5808
|
-
requiredWhen(condition: RequirementCondition, requiredWhenMet?: boolean): PropertySpec<TValue, false, TNode, TUserData>;
|
|
5809
|
-
optionalWhen(condition: RequirementCondition): PropertySpec<TValue, false, TNode, TUserData>;
|
|
5810
|
-
masterData(): PropertySpec<TValue, TRequired, TNode, false>;
|
|
5811
|
-
userData(): PropertySpec<TValue, TRequired, TNode, true>;
|
|
5812
|
-
assetDelivery(): PropertySpec<TValue, TRequired, TNode, false>;
|
|
5813
|
-
}
|
|
5814
|
-
type InlineElementSpec = InlineElementTypeNode;
|
|
5815
|
-
export declare const PT: {
|
|
5816
|
-
readonly string: () => PropertySpec<string, false, PrimitivePropertyTypeNode, false>;
|
|
5817
|
-
readonly int32: () => PropertySpec<number, false, PrimitivePropertyTypeNode, false>;
|
|
5818
|
-
readonly int64: () => PropertySpec<number, false, PrimitivePropertyTypeNode, false>;
|
|
5819
|
-
readonly float32: () => PropertySpec<number, false, PrimitivePropertyTypeNode, false>;
|
|
5820
|
-
readonly float64: () => PropertySpec<number, false, PrimitivePropertyTypeNode, false>;
|
|
5821
|
-
readonly bool: () => PropertySpec<boolean, false, PrimitivePropertyTypeNode, false>;
|
|
5822
|
-
readonly timestamp: () => PropertySpec<string, false, PrimitivePropertyTypeNode, false>;
|
|
5823
|
-
/** Text per locale, delivered to the client as an asset: only `.assetDelivery()` is accepted. */
|
|
5824
|
-
readonly localizedString: () => PropertySpec<LocalizedStringValue, false, LocalizedStringPropertyTypeNode, false>;
|
|
5825
|
-
readonly enum: <T extends string>(...values: readonly T[]) => PropertySpec<T, false, EnumPropertyTypeNode, false>;
|
|
5826
|
-
readonly ref: (target: LazyDomainTypeTarget) => PropertySpec<string, false, RefPropertyTypeNode, false>;
|
|
5827
|
-
readonly inline: (target: LazyDomainTypeTarget) => PropertySpec<FileDomainPropertyValueDto, false, InlinePropertyTypeNode, false>;
|
|
5828
|
-
readonly inlineElement: (schema: InlineElementDef) => InlineElementSpec;
|
|
5829
|
-
readonly listOf: <TElement extends PropertySpec<FileDomainPropertyValueDto, boolean, PropertyElementTypeNode> | InlineElementSpec>(element: TElement) => PropertySpec<FileDomainPropertyValueDto, false, ListPropertyTypeNode, false>;
|
|
5830
|
-
readonly verifyAction: () => PropertySpec<FileDomainPropertyValueDto, false, VerifyActionPropertyTypeNode, false>;
|
|
5831
|
-
readonly consumeAction: () => PropertySpec<FileDomainPropertyValueDto, false, ConsumeActionPropertyTypeNode, false>;
|
|
5832
|
-
readonly acquireAction: () => PropertySpec<FileDomainPropertyValueDto, false, AcquireActionPropertyTypeNode, false>;
|
|
5833
|
-
};
|
|
5834
|
-
type ConditionScalar = string | number | boolean;
|
|
5835
|
-
/** The signatures refuse the shapes the stored-condition parser rejects: a non-scalar comparison value and an empty junction. */
|
|
5836
|
-
export declare const Cond: {
|
|
5837
|
-
readonly eq: (propertyName: string, value: ConditionScalar) => RequirementCondition;
|
|
5838
|
-
readonly neq: (propertyName: string, value: ConditionScalar) => RequirementCondition;
|
|
5839
|
-
readonly isSet: (propertyName: string) => RequirementCondition;
|
|
5840
|
-
readonly isNotSet: (propertyName: string) => RequirementCondition;
|
|
5841
|
-
readonly not: (condition: RequirementCondition) => RequirementCondition;
|
|
5842
|
-
readonly and: (conditions_0: RequirementCondition, ...conditions: RequirementCondition[]) => RequirementCondition;
|
|
5843
|
-
readonly or: (conditions_0: RequirementCondition, ...conditions: RequirementCondition[]) => RequirementCondition;
|
|
5844
|
-
readonly gt: (propertyName: string, value: number) => RequirementCondition;
|
|
5845
|
-
readonly lt: (propertyName: string, value: number) => RequirementCondition;
|
|
5846
|
-
readonly gte: (propertyName: string, value: number) => RequirementCondition;
|
|
5847
|
-
readonly lte: (propertyName: string, value: number) => RequirementCondition;
|
|
5848
|
-
};
|
|
5849
5858
|
interface CodeTemplateSnapshotDto {
|
|
5850
5859
|
readonly outputFileName: string;
|
|
5851
5860
|
readonly templateSource: string;
|