@nowline/core 0.8.6 → 0.9.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 (174) hide show
  1. package/README.md +9 -0
  2. package/dist/convert/printer.d.ts.map +1 -1
  3. package/dist/convert/printer.js +20 -9
  4. package/dist/convert/printer.js.map +1 -1
  5. package/dist/convert/schema.d.ts +7 -0
  6. package/dist/convert/schema.d.ts.map +1 -1
  7. package/dist/convert/schema.js +1 -1
  8. package/dist/convert/schema.js.map +1 -1
  9. package/dist/generated/ast.d.ts +134 -24
  10. package/dist/generated/ast.d.ts.map +1 -1
  11. package/dist/generated/ast.js +95 -3
  12. package/dist/generated/ast.js.map +1 -1
  13. package/dist/generated/grammar.d.ts.map +1 -1
  14. package/dist/generated/grammar.js +434 -148
  15. package/dist/generated/grammar.js.map +1 -1
  16. package/dist/i18n/codes.d.ts +1 -1
  17. package/dist/i18n/codes.d.ts.map +1 -1
  18. package/dist/i18n/codes.js +44 -1
  19. package/dist/i18n/codes.js.map +1 -1
  20. package/dist/i18n/index.d.ts +1 -0
  21. package/dist/i18n/index.d.ts.map +1 -1
  22. package/dist/i18n/index.js.map +1 -1
  23. package/dist/i18n/messages.en.d.ts +107 -0
  24. package/dist/i18n/messages.en.d.ts.map +1 -1
  25. package/dist/i18n/messages.en.js +220 -1
  26. package/dist/i18n/messages.en.js.map +1 -1
  27. package/dist/i18n/messages.fr.d.ts.map +1 -1
  28. package/dist/i18n/messages.fr.js +250 -1
  29. package/dist/i18n/messages.fr.js.map +1 -1
  30. package/dist/i18n/wave-message-types.d.ts +238 -0
  31. package/dist/i18n/wave-message-types.d.ts.map +1 -0
  32. package/dist/i18n/wave-message-types.js +11 -0
  33. package/dist/i18n/wave-message-types.js.map +1 -0
  34. package/dist/index.d.ts +6 -1
  35. package/dist/index.d.ts.map +1 -1
  36. package/dist/index.js +5 -1
  37. package/dist/index.js.map +1 -1
  38. package/dist/internal.d.ts +6 -0
  39. package/dist/internal.d.ts.map +1 -0
  40. package/dist/internal.js +9 -0
  41. package/dist/internal.js.map +1 -0
  42. package/dist/language/ast-walk.d.ts +31 -0
  43. package/dist/language/ast-walk.d.ts.map +1 -0
  44. package/dist/language/ast-walk.js +109 -0
  45. package/dist/language/ast-walk.js.map +1 -0
  46. package/dist/language/calendar-declarations.d.ts +31 -0
  47. package/dist/language/calendar-declarations.d.ts.map +1 -0
  48. package/dist/language/calendar-declarations.js +99 -0
  49. package/dist/language/calendar-declarations.js.map +1 -0
  50. package/dist/language/include-references.d.ts +11 -0
  51. package/dist/language/include-references.d.ts.map +1 -0
  52. package/dist/language/include-references.js +45 -0
  53. package/dist/language/include-references.js.map +1 -0
  54. package/dist/language/include-resolver.d.ts +78 -1
  55. package/dist/language/include-resolver.d.ts.map +1 -1
  56. package/dist/language/include-resolver.js +190 -12
  57. package/dist/language/include-resolver.js.map +1 -1
  58. package/dist/language/include-waves.d.ts +73 -0
  59. package/dist/language/include-waves.d.ts.map +1 -0
  60. package/dist/language/include-waves.js +319 -0
  61. package/dist/language/include-waves.js.map +1 -0
  62. package/dist/language/nowline-validator.d.ts +6 -1
  63. package/dist/language/nowline-validator.d.ts.map +1 -1
  64. package/dist/language/nowline-validator.js +95 -1589
  65. package/dist/language/nowline-validator.js.map +1 -1
  66. package/dist/language/references.d.ts +14 -0
  67. package/dist/language/references.d.ts.map +1 -0
  68. package/dist/language/references.js +36 -0
  69. package/dist/language/references.js.map +1 -0
  70. package/dist/language/style-chain.d.ts +37 -0
  71. package/dist/language/style-chain.d.ts.map +1 -0
  72. package/dist/language/style-chain.js +55 -0
  73. package/dist/language/style-chain.js.map +1 -0
  74. package/dist/language/validator/calendar.d.ts +9 -0
  75. package/dist/language/validator/calendar.d.ts.map +1 -0
  76. package/dist/language/validator/calendar.js +250 -0
  77. package/dist/language/validator/calendar.js.map +1 -0
  78. package/dist/language/validator/entities.d.ts +23 -0
  79. package/dist/language/validator/entities.d.ts.map +1 -0
  80. package/dist/language/validator/entities.js +261 -0
  81. package/dist/language/validator/entities.js.map +1 -0
  82. package/dist/language/validator/properties.d.ts +18 -0
  83. package/dist/language/validator/properties.d.ts.map +1 -0
  84. package/dist/language/validator/properties.js +356 -0
  85. package/dist/language/validator/properties.js.map +1 -0
  86. package/dist/language/validator/references.d.ts +7 -0
  87. package/dist/language/validator/references.d.ts.map +1 -0
  88. package/dist/language/validator/references.js +261 -0
  89. package/dist/language/validator/references.js.map +1 -0
  90. package/dist/language/validator/structure.d.ts +16 -0
  91. package/dist/language/validator/structure.d.ts.map +1 -0
  92. package/dist/language/validator/structure.js +166 -0
  93. package/dist/language/validator/structure.js.map +1 -0
  94. package/dist/language/validator/style.d.ts +5 -0
  95. package/dist/language/validator/style.d.ts.map +1 -0
  96. package/dist/language/validator/style.js +126 -0
  97. package/dist/language/validator/style.js.map +1 -0
  98. package/dist/language/validator/support.d.ts +35 -0
  99. package/dist/language/validator/support.d.ts.map +1 -0
  100. package/dist/language/validator/support.js +49 -0
  101. package/dist/language/validator/support.js.map +1 -0
  102. package/dist/language/validator/symbols.d.ts +6 -0
  103. package/dist/language/validator/symbols.d.ts.map +1 -0
  104. package/dist/language/validator/symbols.js +131 -0
  105. package/dist/language/validator/symbols.js.map +1 -0
  106. package/dist/language/validator/tables.d.ts +34 -0
  107. package/dist/language/validator/tables.d.ts.map +1 -0
  108. package/dist/language/validator/tables.js +120 -0
  109. package/dist/language/validator/tables.js.map +1 -0
  110. package/dist/language/validator-utils.d.ts +32 -0
  111. package/dist/language/validator-utils.d.ts.map +1 -0
  112. package/dist/language/validator-utils.js +118 -0
  113. package/dist/language/validator-utils.js.map +1 -0
  114. package/dist/language/value-tables.d.ts +107 -0
  115. package/dist/language/value-tables.d.ts.map +1 -0
  116. package/dist/language/value-tables.js +240 -0
  117. package/dist/language/value-tables.js.map +1 -0
  118. package/dist/language/waves-order.d.ts +51 -0
  119. package/dist/language/waves-order.d.ts.map +1 -0
  120. package/dist/language/waves-order.js +787 -0
  121. package/dist/language/waves-order.js.map +1 -0
  122. package/dist/language/waves-plan.d.ts +45 -0
  123. package/dist/language/waves-plan.d.ts.map +1 -0
  124. package/dist/language/waves-plan.js +64 -0
  125. package/dist/language/waves-plan.js.map +1 -0
  126. package/dist/language/waves.d.ts +96 -0
  127. package/dist/language/waves.d.ts.map +1 -0
  128. package/dist/language/waves.js +575 -0
  129. package/dist/language/waves.js.map +1 -0
  130. package/dist/util/props.d.ts +27 -0
  131. package/dist/util/props.d.ts.map +1 -0
  132. package/dist/util/props.js +49 -0
  133. package/dist/util/props.js.map +1 -0
  134. package/dist/util/single-line.d.ts +14 -0
  135. package/dist/util/single-line.d.ts.map +1 -0
  136. package/dist/util/single-line.js +16 -0
  137. package/dist/util/single-line.js.map +1 -0
  138. package/package.json +7 -3
  139. package/src/convert/printer.ts +20 -10
  140. package/src/convert/schema.ts +8 -1
  141. package/src/generated/ast.ts +159 -27
  142. package/src/generated/grammar.ts +434 -148
  143. package/src/i18n/codes.ts +95 -2
  144. package/src/i18n/index.ts +1 -0
  145. package/src/i18n/messages.en.ts +300 -1
  146. package/src/i18n/messages.fr.ts +335 -1
  147. package/src/i18n/wave-message-types.ts +206 -0
  148. package/src/index.ts +33 -0
  149. package/src/internal.ts +9 -0
  150. package/src/language/ast-walk.ts +158 -0
  151. package/src/language/calendar-declarations.ts +141 -0
  152. package/src/language/include-references.ts +49 -0
  153. package/src/language/include-resolver.ts +284 -10
  154. package/src/language/include-waves.ts +419 -0
  155. package/src/language/nowline-validator.ts +98 -1835
  156. package/src/language/nowline.langium +56 -22
  157. package/src/language/references.ts +40 -0
  158. package/src/language/style-chain.ts +95 -0
  159. package/src/language/validator/calendar.ts +319 -0
  160. package/src/language/validator/entities.ts +366 -0
  161. package/src/language/validator/properties.ts +425 -0
  162. package/src/language/validator/references.ts +295 -0
  163. package/src/language/validator/structure.ts +206 -0
  164. package/src/language/validator/style.ts +149 -0
  165. package/src/language/validator/support.ts +84 -0
  166. package/src/language/validator/symbols.ts +141 -0
  167. package/src/language/validator/tables.ts +171 -0
  168. package/src/language/validator-utils.ts +123 -0
  169. package/src/language/value-tables.ts +260 -0
  170. package/src/language/waves-order.ts +879 -0
  171. package/src/language/waves-plan.ts +101 -0
  172. package/src/language/waves.ts +731 -0
  173. package/src/util/props.ts +59 -0
  174. package/src/util/single-line.ts +15 -0
@@ -0,0 +1,260 @@
1
+ // The fixed vocabularies the validator checks keys and values against and
2
+ // the editor offers as completions (specs/core-ast-utilities.md §3.5). One
3
+ // definition for core, layout and the LSP, so the accepted spellings cannot
4
+ // drift between them. Exported only through `@nowline/core/internal`. A leaf module: it
5
+ // imports only `calendar-declarations.ts`, for the weekday names.
6
+
7
+ /**
8
+ * Built-in status vocabulary. `active` and `completed` are international-
9
+ * friendly aliases for `in-progress` and `done` respectively: they
10
+ * canonicalize at the layout boundary (see statusFromProp in layout.ts) so
11
+ * downstream consumers see a single normalized form. Both spellings remain
12
+ * valid input.
13
+ */
14
+ export const BUILTIN_STATUSES: readonly string[] = [
15
+ 'planned',
16
+ 'in-progress',
17
+ 'active',
18
+ 'done',
19
+ 'completed',
20
+ 'at-risk',
21
+ 'blocked',
22
+ ];
23
+
24
+ /**
25
+ * Built-in `capacity-icon:` vocabulary. Renderer-curated SVG glyphs, plus
26
+ * `multiplier` (drawn as the U+00D7 text character) and `none` (suppresses
27
+ * the glyph).
28
+ */
29
+ export const BUILTIN_CAPACITY_ICONS: readonly string[] = [
30
+ 'none',
31
+ 'multiplier',
32
+ 'person',
33
+ 'people',
34
+ 'points',
35
+ 'time',
36
+ ];
37
+
38
+ /**
39
+ * Built-in `icon:` vocabulary: the capacity-icon names plus the entity-
40
+ * decoration glyphs the renderer ships. `calendar` is the glyph the inline-
41
+ * date pin path (`after:DATE` / `before:DATE`) draws onto items, parallels
42
+ * and groups; reserving it keeps a `symbol calendar` declaration from
43
+ * shadowing it.
44
+ */
45
+ export const BUILTIN_ICON_NAMES: readonly string[] = [
46
+ ...BUILTIN_CAPACITY_ICONS,
47
+ 'shield',
48
+ 'warning',
49
+ 'lock',
50
+ 'calendar',
51
+ ];
52
+
53
+ /**
54
+ * Values of the `non-working:` display key on `default roadmap`
55
+ * (specs/working-calendar.md §4.2), in documentation order.
56
+ */
57
+ export const NON_WORKING_DISPLAYS = ['hide', 'show'] as const;
58
+
59
+ /** One of the `non-working:` display values. */
60
+ export type NonWorkingDisplay = (typeof NON_WORKING_DISPLAYS)[number];
61
+
62
+ /**
63
+ * Values of each enumerated style key (specs/dsl.md rule 19), in
64
+ * documentation order. `non-working:` is not here: it has its own table and
65
+ * its own error code. Colour keys (`bg`, `fg`, `text`) take `COLOR_NAMES` or
66
+ * a hex value instead.
67
+ */
68
+ export const STYLE_PROP_ENUMS: Readonly<Record<string, readonly string[]>> = {
69
+ border: ['solid', 'dashed', 'dotted'],
70
+ shadow: ['none', 'subtle', 'soft', 'hard'],
71
+ font: ['sans', 'serif', 'mono'],
72
+ weight: ['thin', 'light', 'normal', 'bold'],
73
+ italic: ['true', 'false'],
74
+ 'text-size': ['none', 'xs', 'sm', 'md', 'lg', 'xl'],
75
+ padding: ['none', 'xs', 'sm', 'md', 'lg', 'xl'],
76
+ spacing: ['none', 'xs', 'sm', 'md', 'lg', 'xl'],
77
+ 'header-height': ['none', 'xs', 'sm', 'md', 'lg', 'xl'],
78
+ 'corner-radius': ['none', 'xs', 'sm', 'md', 'lg', 'xl', 'full'],
79
+ bracket: ['none', 'solid', 'dashed'],
80
+ 'header-position': ['beside', 'above'],
81
+ 'timeline-position': ['top', 'bottom', 'both'],
82
+ 'minor-grid': ['true', 'false'],
83
+ };
84
+
85
+ /**
86
+ * Built-in colour vocabulary for `bg`, `fg` and `text`. `grey` and `violet`
87
+ * are international-friendly aliases for `gray` and `purple`: they
88
+ * canonicalize at the theme boundary (resolveColor in
89
+ * packages/layout/src/themes/index.ts) so themes don't grow new fields. Both
90
+ * spellings remain valid input.
91
+ */
92
+ export const COLOR_NAMES: readonly string[] = [
93
+ 'red',
94
+ 'blue',
95
+ 'yellow',
96
+ 'green',
97
+ 'orange',
98
+ 'purple',
99
+ 'violet',
100
+ 'gray',
101
+ 'grey',
102
+ 'navy',
103
+ 'white',
104
+ 'none',
105
+ ];
106
+
107
+ /** Values of `calendar:` on the `roadmap` line. */
108
+ export const CALENDAR_MODES: readonly string[] = ['business', 'full', 'custom'];
109
+
110
+ /** Values of `config:` and `roadmap:` on an `include` line. */
111
+ export const INCLUDE_MODES: readonly string[] = ['merge', 'ignore', 'isolate'];
112
+
113
+ /**
114
+ * Keys a style block or `default` line may set (specs/dsl.md style table).
115
+ * The enumerated ones take `STYLE_PROP_ENUMS`; `bg`, `fg` and `text` take a
116
+ * colour.
117
+ */
118
+ export const STYLE_PROP_KEYS: readonly string[] = [
119
+ 'bg',
120
+ 'fg',
121
+ 'text',
122
+ 'border',
123
+ 'icon',
124
+ 'shadow',
125
+ 'font',
126
+ 'weight',
127
+ 'italic',
128
+ 'text-size',
129
+ 'padding',
130
+ 'spacing',
131
+ 'header-height',
132
+ 'corner-radius',
133
+ 'bracket',
134
+ 'header-position',
135
+ 'capacity-icon',
136
+ 'timeline-position',
137
+ 'minor-grid',
138
+ 'non-working',
139
+ ];
140
+
141
+ /**
142
+ * Style keys only the roadmap reads (specs/dsl.md style table). On another
143
+ * entity's `default` line they are a silent no-op, so they warn (NL.W0703).
144
+ * Style blocks are not checked: one block can be referenced by the roadmap
145
+ * and by other entities alike, so the key there is not necessarily wrong.
146
+ */
147
+ export const ROADMAP_ONLY_STYLE_KEYS: readonly string[] = [
148
+ 'header-height',
149
+ 'header-position',
150
+ 'timeline-position',
151
+ 'minor-grid',
152
+ 'non-working',
153
+ ];
154
+
155
+ /**
156
+ * `utilization-warn-at:` / `utilization-over-at:` accept the literal `none`
157
+ * to opt out of that color band (per specs/dsl.md rule 17d). Numeric forms
158
+ * (positive percent, decimal, integer) are validated separately.
159
+ */
160
+ export const UTILIZATION_NONE = 'none';
161
+
162
+ /** Keys of a `calendar` block. */
163
+ export const CALENDAR_FIELDS: readonly string[] = [
164
+ 'days-per-week',
165
+ 'days-per-month',
166
+ 'days-per-quarter',
167
+ 'days-per-year',
168
+ ];
169
+
170
+ /** Keys of a `scale` block. */
171
+ export const SCALE_FIELDS: readonly string[] = ['name', 'label-every', 'label'];
172
+
173
+ /** Entity types a `default <entity>` line may name. */
174
+ export const DEFAULT_ENTITY_TYPES: readonly string[] = [
175
+ 'item',
176
+ 'label',
177
+ 'swimlane',
178
+ 'roadmap',
179
+ 'milestone',
180
+ 'footnote',
181
+ 'anchor',
182
+ 'parallel',
183
+ 'group',
184
+ ];
185
+
186
+ /**
187
+ * Properties every entity declaration may carry (`specs/dsl.md` § Universal
188
+ * Properties). `description` is technically a sub-directive (`description
189
+ * "text"` indented under the entity), not an EntityProperty, but we accept it
190
+ * here too: authors who type `description:"text"` as a property aren't doing
191
+ * anything meaningful, but the typo is common enough that warning on it adds
192
+ * noise rather than signal — the value is at least carried into the AST and
193
+ * could be surfaced later if we choose to.
194
+ */
195
+ export const UNIVERSAL_ENTITY_PROPS: readonly string[] = ['labels', 'link', 'style', 'description'];
196
+
197
+ /**
198
+ * Properties each entity declaration's `properties: EntityProperty[]` bag
199
+ * actually consumes downstream, keyed by the declaration's AST `$type`.
200
+ * Sourced from (a) the property tables in `specs/dsl.md` and (b) every
201
+ * `propValue(...)`/`propValues(...)` call site in `packages/layout/`. Keys
202
+ * outside this table + `UNIVERSAL_ENTITY_PROPS` are silently dropped by the
203
+ * layout — `checkUnknownEntityProperties` warns on them so authors notice
204
+ * typos like `now:2026-01-25` on a `roadmap` line.
205
+ *
206
+ * Raw style props (`bg`, `fg`, ...) intentionally stay OUT of this map — they
207
+ * are rejected as errors by `checkNoRawStyleProperties` and the unknown-
208
+ * property check short-circuits on them so authors don't see a duplicate
209
+ * diagnostic.
210
+ */
211
+ export const ENTITY_KNOWN_PROPS: Readonly<Record<string, readonly string[]>> = {
212
+ RoadmapDeclaration: ['author', 'start', 'length', 'scale', 'calendar', 'logo', 'logo-size'],
213
+ AnchorDeclaration: ['date'],
214
+ SwimlaneDeclaration: [
215
+ 'owner',
216
+ 'capacity',
217
+ 'utilization-warn-at',
218
+ 'utilization-over-at',
219
+ 'status',
220
+ 'after',
221
+ 'before',
222
+ ],
223
+ // An item has no `date:` or `start:`: it cannot be pinned to a fixed start
224
+ // date (`specs/dsl.md` § Item Properties, "Pinning is not supported"), so
225
+ // both keys draw the unknown-property warning with an `after:<date>` hint.
226
+ ItemDeclaration: [
227
+ 'size',
228
+ 'duration',
229
+ 'status',
230
+ 'owner',
231
+ 'after',
232
+ 'before',
233
+ 'remaining',
234
+ 'capacity',
235
+ ],
236
+ // size/duration/remaining/capacity on parallel/group are already errors via
237
+ // `checkNoComputedProperties`, so we don't list them here.
238
+ ParallelBlock: ['owner', 'after', 'before', 'status'],
239
+ GroupBlock: ['owner', 'after', 'before', 'status'],
240
+ MilestoneDeclaration: ['date', 'after'],
241
+ FootnoteDeclaration: ['on'],
242
+ PersonDeclaration: [],
243
+ TeamDeclaration: [],
244
+ LabelDeclaration: [],
245
+ SizeDeclaration: ['effort'],
246
+ StatusDeclaration: [],
247
+ // The other keys a wave takes are universal; the keys it may not take
248
+ // are NL.E1105 (`isWaveBannedProperty`), owned by the wave rules.
249
+ WaveDeclaration: ['after'],
250
+ };
251
+
252
+ /**
253
+ * Allow-listed property keys on the `nowline` directive line. The directive
254
+ * existed historically as `nowline v1` only; properties are a forward-
255
+ * extension point but stay restrictive so authors get an early error instead
256
+ * of typos rendering silently.
257
+ */
258
+ export const DIRECTIVE_FIELDS: readonly string[] = ['locale'];
259
+
260
+ export { WEEKDAYS } from './calendar-declarations.js';