@routevn/creator-model 1.10.3 → 1.11.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.
Files changed (3) hide show
  1. package/README.md +67 -0
  2. package/package.json +1 -1
  3. package/src/model.js +1425 -88
package/README.md CHANGED
@@ -106,6 +106,73 @@ Design rules:
106
106
  - random ids across RouteVN should use `nanoid` with the RouteVN base58 variant;
107
107
  deterministic derived tokens such as partition hashes are a separate case
108
108
 
109
+ ## Font Weight Metadata
110
+
111
+ Font resources may store extracted weight capabilities in three flat fields:
112
+
113
+ ```js
114
+ {
115
+ minWeight: 100,
116
+ defaultWeight: 400,
117
+ maxWeight: 900,
118
+ }
119
+ ```
120
+
121
+ The fields are optional for compatibility with existing font resources. When
122
+ one is present, all three are required and must satisfy
123
+ `1 <= minWeight <= defaultWeight <= maxWeight <= 1000`. Static fonts store the
124
+ same value in all three fields; variable fonts store their `fvar` `wght` axis
125
+ range and default.
126
+
127
+ ## Text Style Font References
128
+
129
+ `textStyle.fontId` accepts either one font ID or a non-empty array of unique
130
+ font IDs. Both forms are persisted as supplied, and every ID must reference an
131
+ existing non-folder font:
132
+
133
+ ```js
134
+ { fontId: "font-primary" }
135
+ { fontId: ["font-primary", "font-fallback"] }
136
+ ```
137
+
138
+ ## Computed Variables
139
+
140
+ Variables support read-only computed definitions for `string`, `number`,
141
+ `boolean`, and `object` results. The presence of `computed` is the source
142
+ discriminator; computed variables omit stored `scope`, `default`, and `value`
143
+ fields:
144
+
145
+ ```js
146
+ {
147
+ id: "hpPercent",
148
+ type: "variable",
149
+ variableType: "number",
150
+ name: "HP Percent",
151
+ computed: {
152
+ expr: {
153
+ round: [
154
+ {
155
+ mul: [
156
+ {
157
+ div: [
158
+ { var: "variables.hp" },
159
+ { var: "variables.maxHp" },
160
+ ],
161
+ },
162
+ 100,
163
+ ],
164
+ },
165
+ ],
166
+ },
167
+ },
168
+ }
169
+ ```
170
+
171
+ Computed definitions may use a simple `expr` or literal `value`, or ordered
172
+ `branches` with an explicit `default`. Validation enforces the Route Engine
173
+ operator grammar, result types, concrete `variables.*`/`runtime.*` paths,
174
+ declared variable references, and an acyclic computed dependency graph.
175
+
109
176
  ## File Structure
110
177
 
111
178
  ```text
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@routevn/creator-model",
3
- "version": "1.10.3",
3
+ "version": "1.11.0",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "license": "MIT",