@nowline/core 0.8.5 → 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 (180) 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 +251 -141
  10. package/dist/generated/ast.d.ts.map +1 -1
  11. package/dist/generated/ast.js +96 -4
  12. package/dist/generated/ast.js.map +1 -1
  13. package/dist/generated/grammar.d.ts +1 -1
  14. package/dist/generated/grammar.d.ts.map +1 -1
  15. package/dist/generated/grammar.js +435 -149
  16. package/dist/generated/grammar.js.map +1 -1
  17. package/dist/generated/module.d.ts +3 -3
  18. package/dist/generated/module.d.ts.map +1 -1
  19. package/dist/generated/module.js +1 -1
  20. package/dist/i18n/codes.d.ts +1 -1
  21. package/dist/i18n/codes.d.ts.map +1 -1
  22. package/dist/i18n/codes.js +44 -1
  23. package/dist/i18n/codes.js.map +1 -1
  24. package/dist/i18n/index.d.ts +1 -0
  25. package/dist/i18n/index.d.ts.map +1 -1
  26. package/dist/i18n/index.js.map +1 -1
  27. package/dist/i18n/messages.en.d.ts +107 -0
  28. package/dist/i18n/messages.en.d.ts.map +1 -1
  29. package/dist/i18n/messages.en.js +220 -1
  30. package/dist/i18n/messages.en.js.map +1 -1
  31. package/dist/i18n/messages.fr.d.ts.map +1 -1
  32. package/dist/i18n/messages.fr.js +250 -1
  33. package/dist/i18n/messages.fr.js.map +1 -1
  34. package/dist/i18n/wave-message-types.d.ts +238 -0
  35. package/dist/i18n/wave-message-types.d.ts.map +1 -0
  36. package/dist/i18n/wave-message-types.js +11 -0
  37. package/dist/i18n/wave-message-types.js.map +1 -0
  38. package/dist/index.d.ts +6 -1
  39. package/dist/index.d.ts.map +1 -1
  40. package/dist/index.js +5 -1
  41. package/dist/index.js.map +1 -1
  42. package/dist/internal.d.ts +6 -0
  43. package/dist/internal.d.ts.map +1 -0
  44. package/dist/internal.js +9 -0
  45. package/dist/internal.js.map +1 -0
  46. package/dist/language/ast-walk.d.ts +31 -0
  47. package/dist/language/ast-walk.d.ts.map +1 -0
  48. package/dist/language/ast-walk.js +109 -0
  49. package/dist/language/ast-walk.js.map +1 -0
  50. package/dist/language/calendar-declarations.d.ts +31 -0
  51. package/dist/language/calendar-declarations.d.ts.map +1 -0
  52. package/dist/language/calendar-declarations.js +99 -0
  53. package/dist/language/calendar-declarations.js.map +1 -0
  54. package/dist/language/include-references.d.ts +11 -0
  55. package/dist/language/include-references.d.ts.map +1 -0
  56. package/dist/language/include-references.js +45 -0
  57. package/dist/language/include-references.js.map +1 -0
  58. package/dist/language/include-resolver.d.ts +78 -1
  59. package/dist/language/include-resolver.d.ts.map +1 -1
  60. package/dist/language/include-resolver.js +190 -12
  61. package/dist/language/include-resolver.js.map +1 -1
  62. package/dist/language/include-waves.d.ts +73 -0
  63. package/dist/language/include-waves.d.ts.map +1 -0
  64. package/dist/language/include-waves.js +319 -0
  65. package/dist/language/include-waves.js.map +1 -0
  66. package/dist/language/nowline-module.js.map +1 -1
  67. package/dist/language/nowline-validator.d.ts +6 -1
  68. package/dist/language/nowline-validator.d.ts.map +1 -1
  69. package/dist/language/nowline-validator.js +95 -1589
  70. package/dist/language/nowline-validator.js.map +1 -1
  71. package/dist/language/references.d.ts +14 -0
  72. package/dist/language/references.d.ts.map +1 -0
  73. package/dist/language/references.js +36 -0
  74. package/dist/language/references.js.map +1 -0
  75. package/dist/language/style-chain.d.ts +37 -0
  76. package/dist/language/style-chain.d.ts.map +1 -0
  77. package/dist/language/style-chain.js +55 -0
  78. package/dist/language/style-chain.js.map +1 -0
  79. package/dist/language/validator/calendar.d.ts +9 -0
  80. package/dist/language/validator/calendar.d.ts.map +1 -0
  81. package/dist/language/validator/calendar.js +250 -0
  82. package/dist/language/validator/calendar.js.map +1 -0
  83. package/dist/language/validator/entities.d.ts +23 -0
  84. package/dist/language/validator/entities.d.ts.map +1 -0
  85. package/dist/language/validator/entities.js +261 -0
  86. package/dist/language/validator/entities.js.map +1 -0
  87. package/dist/language/validator/properties.d.ts +18 -0
  88. package/dist/language/validator/properties.d.ts.map +1 -0
  89. package/dist/language/validator/properties.js +356 -0
  90. package/dist/language/validator/properties.js.map +1 -0
  91. package/dist/language/validator/references.d.ts +7 -0
  92. package/dist/language/validator/references.d.ts.map +1 -0
  93. package/dist/language/validator/references.js +261 -0
  94. package/dist/language/validator/references.js.map +1 -0
  95. package/dist/language/validator/structure.d.ts +16 -0
  96. package/dist/language/validator/structure.d.ts.map +1 -0
  97. package/dist/language/validator/structure.js +166 -0
  98. package/dist/language/validator/structure.js.map +1 -0
  99. package/dist/language/validator/style.d.ts +5 -0
  100. package/dist/language/validator/style.d.ts.map +1 -0
  101. package/dist/language/validator/style.js +126 -0
  102. package/dist/language/validator/style.js.map +1 -0
  103. package/dist/language/validator/support.d.ts +35 -0
  104. package/dist/language/validator/support.d.ts.map +1 -0
  105. package/dist/language/validator/support.js +49 -0
  106. package/dist/language/validator/support.js.map +1 -0
  107. package/dist/language/validator/symbols.d.ts +6 -0
  108. package/dist/language/validator/symbols.d.ts.map +1 -0
  109. package/dist/language/validator/symbols.js +131 -0
  110. package/dist/language/validator/symbols.js.map +1 -0
  111. package/dist/language/validator/tables.d.ts +34 -0
  112. package/dist/language/validator/tables.d.ts.map +1 -0
  113. package/dist/language/validator/tables.js +120 -0
  114. package/dist/language/validator/tables.js.map +1 -0
  115. package/dist/language/validator-utils.d.ts +32 -0
  116. package/dist/language/validator-utils.d.ts.map +1 -0
  117. package/dist/language/validator-utils.js +118 -0
  118. package/dist/language/validator-utils.js.map +1 -0
  119. package/dist/language/value-tables.d.ts +107 -0
  120. package/dist/language/value-tables.d.ts.map +1 -0
  121. package/dist/language/value-tables.js +240 -0
  122. package/dist/language/value-tables.js.map +1 -0
  123. package/dist/language/waves-order.d.ts +51 -0
  124. package/dist/language/waves-order.d.ts.map +1 -0
  125. package/dist/language/waves-order.js +787 -0
  126. package/dist/language/waves-order.js.map +1 -0
  127. package/dist/language/waves-plan.d.ts +45 -0
  128. package/dist/language/waves-plan.d.ts.map +1 -0
  129. package/dist/language/waves-plan.js +64 -0
  130. package/dist/language/waves-plan.js.map +1 -0
  131. package/dist/language/waves.d.ts +96 -0
  132. package/dist/language/waves.d.ts.map +1 -0
  133. package/dist/language/waves.js +575 -0
  134. package/dist/language/waves.js.map +1 -0
  135. package/dist/util/props.d.ts +27 -0
  136. package/dist/util/props.d.ts.map +1 -0
  137. package/dist/util/props.js +49 -0
  138. package/dist/util/props.js.map +1 -0
  139. package/dist/util/single-line.d.ts +14 -0
  140. package/dist/util/single-line.d.ts.map +1 -0
  141. package/dist/util/single-line.js +16 -0
  142. package/dist/util/single-line.js.map +1 -0
  143. package/package.json +10 -6
  144. package/src/convert/printer.ts +20 -10
  145. package/src/convert/schema.ts +8 -1
  146. package/src/generated/ast.ts +160 -28
  147. package/src/generated/grammar.ts +435 -149
  148. package/src/generated/module.ts +1 -1
  149. package/src/i18n/codes.ts +95 -2
  150. package/src/i18n/index.ts +1 -0
  151. package/src/i18n/messages.en.ts +300 -1
  152. package/src/i18n/messages.fr.ts +335 -1
  153. package/src/i18n/wave-message-types.ts +206 -0
  154. package/src/index.ts +33 -0
  155. package/src/internal.ts +9 -0
  156. package/src/language/ast-walk.ts +158 -0
  157. package/src/language/calendar-declarations.ts +141 -0
  158. package/src/language/include-references.ts +49 -0
  159. package/src/language/include-resolver.ts +284 -10
  160. package/src/language/include-waves.ts +419 -0
  161. package/src/language/nowline-validator.ts +98 -1835
  162. package/src/language/nowline.langium +56 -22
  163. package/src/language/references.ts +40 -0
  164. package/src/language/style-chain.ts +95 -0
  165. package/src/language/validator/calendar.ts +319 -0
  166. package/src/language/validator/entities.ts +366 -0
  167. package/src/language/validator/properties.ts +425 -0
  168. package/src/language/validator/references.ts +295 -0
  169. package/src/language/validator/structure.ts +206 -0
  170. package/src/language/validator/style.ts +149 -0
  171. package/src/language/validator/support.ts +84 -0
  172. package/src/language/validator/symbols.ts +141 -0
  173. package/src/language/validator/tables.ts +171 -0
  174. package/src/language/validator-utils.ts +123 -0
  175. package/src/language/value-tables.ts +260 -0
  176. package/src/language/waves-order.ts +879 -0
  177. package/src/language/waves-plan.ts +101 -0
  178. package/src/language/waves.ts +731 -0
  179. package/src/util/props.ts +59 -0
  180. package/src/util/single-line.ts +15 -0
@@ -0,0 +1,49 @@
1
+ // Property lookup and ISO date helpers shared by every `@nowline/*` package
2
+ // (specs/core-ast-utilities.md §3.5). Exported only through
3
+ // `@nowline/core/internal`. A leaf module: it imports nothing but the
4
+ // generated AST types.
5
+ /**
6
+ * `prop.key` without a trailing `:`. Keys from the parser never carry one
7
+ * (the value converter strips it); hand-built ASTs and JSON may.
8
+ */
9
+ export function propKey(prop) {
10
+ return prop.key.endsWith(':') ? prop.key.slice(0, -1) : prop.key;
11
+ }
12
+ /** The first property with `key` (compared without a trailing `:`), or undefined. */
13
+ export function findProp(props, key) {
14
+ return props.find((prop) => propKey(prop) === key);
15
+ }
16
+ /** The scalar value of the first property with `key`; undefined for a bracket list. */
17
+ export function propValue(props, key) {
18
+ return findProp(props, key)?.value;
19
+ }
20
+ /** The first property with `key` as a list: its scalar as one element, or its bracket list. */
21
+ export function propValues(props, key) {
22
+ const prop = findProp(props, key);
23
+ if (!prop)
24
+ return [];
25
+ return prop.value !== undefined ? [prop.value] : [...prop.values];
26
+ }
27
+ /** `YYYY-MM-DD`, without checking that it names a real day. */
28
+ export const ISO_DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
29
+ /**
30
+ * UTC midnight of a `YYYY-MM-DD` that names a real calendar day, or null.
31
+ * Strict: `2026-02-30` is null rather than rolling over to March 2, and a
32
+ * year below 100 is read as written (`Date.UTC` would add 1900).
33
+ */
34
+ export function parseIsoDate(raw) {
35
+ if (!raw || !ISO_DATE_RE.test(raw))
36
+ return null;
37
+ const [year, month, day] = raw.split('-').map((part) => Number.parseInt(part, 10));
38
+ const date = new Date(0);
39
+ date.setUTCFullYear(year, month - 1, day);
40
+ const isSameDay = date.getUTCFullYear() === year &&
41
+ date.getUTCMonth() === month - 1 &&
42
+ date.getUTCDate() === day;
43
+ return isSameDay ? date : null;
44
+ }
45
+ /** True for a `YYYY-MM-DD` that names a real calendar day (the validator's NL.E0405 check). */
46
+ export function isRealIsoDate(raw) {
47
+ return parseIsoDate(raw) !== null;
48
+ }
49
+ //# sourceMappingURL=props.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"props.js","sourceRoot":"","sources":["../../src/util/props.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,4DAA4D;AAC5D,sEAAsE;AACtE,uBAAuB;AAIvB;;;GAGG;AACH,MAAM,UAAU,OAAO,CAAC,IAAqB;IACzC,OAAO,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC;AACrE,CAAC;AAED,qFAAqF;AACrF,MAAM,UAAU,QAAQ,CACpB,KAAmB,EACnB,GAAW;IAEX,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC;AACvD,CAAC;AAED,uFAAuF;AACvF,MAAM,UAAU,SAAS,CAAC,KAAgC,EAAE,GAAW;IACnE,OAAO,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE,KAAK,CAAC;AACvC,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,UAAU,CAAC,KAAgC,EAAE,GAAW;IACpE,MAAM,IAAI,GAAG,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAClC,IAAI,CAAC,IAAI;QAAE,OAAO,EAAE,CAAC;IACrB,OAAO,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC;AACtE,CAAC;AAED,+DAA+D;AAC/D,MAAM,CAAC,MAAM,WAAW,GAAG,qBAAqB,CAAC;AAEjD;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,GAAuB;IAChD,IAAI,CAAC,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC;QAAE,OAAO,IAAI,CAAC;IAChD,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC;IACnF,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC;IACzB,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,KAAK,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IAC1C,MAAM,SAAS,GACX,IAAI,CAAC,cAAc,EAAE,KAAK,IAAI;QAC9B,IAAI,CAAC,WAAW,EAAE,KAAK,KAAK,GAAG,CAAC;QAChC,IAAI,CAAC,UAAU,EAAE,KAAK,GAAG,CAAC;IAC9B,OAAO,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AACnC,CAAC;AAED,+FAA+F;AAC/F,MAAM,UAAU,aAAa,CAAC,GAAW;IACrC,OAAO,YAAY,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;AACtC,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Collapse explicit line breaks to a single space.
3
+ *
4
+ * A quoted title can carry real line breaks (`"Technology\nSelection"`
5
+ * parses to a string with a newline in it, and the renderer paints it on
6
+ * two lines). Anything that echoes a title inside ONE line of text, such
7
+ * as a validator message or an editor outline entry, shows it with each
8
+ * run of breaks (and the whitespace around it) replaced by one space, so
9
+ * the example reads `Technology Selection`.
10
+ *
11
+ * A string with no CR or LF is returned untouched.
12
+ */
13
+ export declare function singleLine(text: string): string;
14
+ //# sourceMappingURL=single-line.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"single-line.d.ts","sourceRoot":"","sources":["../../src/util/single-line.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Collapse explicit line breaks to a single space.
3
+ *
4
+ * A quoted title can carry real line breaks (`"Technology\nSelection"`
5
+ * parses to a string with a newline in it, and the renderer paints it on
6
+ * two lines). Anything that echoes a title inside ONE line of text, such
7
+ * as a validator message or an editor outline entry, shows it with each
8
+ * run of breaks (and the whitespace around it) replaced by one space, so
9
+ * the example reads `Technology Selection`.
10
+ *
11
+ * A string with no CR or LF is returned untouched.
12
+ */
13
+ export function singleLine(text) {
14
+ return /[\r\n]/.test(text) ? text.replace(/\s*[\r\n]+\s*/g, ' ').trim() : text;
15
+ }
16
+ //# sourceMappingURL=single-line.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"single-line.js","sourceRoot":"","sources":["../../src/util/single-line.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACnC,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC;AACnF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nowline/core",
3
- "version": "0.8.5",
3
+ "version": "0.9.0",
4
4
  "description": "Reads and checks the Nowline roadmap language — the parser and validator every Nowline tool builds on.",
5
5
  "license": "Apache-2.0",
6
6
  "engines": {
@@ -15,6 +15,10 @@
15
15
  ".": {
16
16
  "types": "./dist/index.d.ts",
17
17
  "import": "./dist/index.js"
18
+ },
19
+ "./internal": {
20
+ "types": "./dist/internal.d.ts",
21
+ "import": "./dist/internal.js"
18
22
  }
19
23
  },
20
24
  "files": [
@@ -22,13 +26,13 @@
22
26
  "src/"
23
27
  ],
24
28
  "dependencies": {
25
- "langium": "~4.3.0"
29
+ "langium": "~4.4.0"
26
30
  },
27
31
  "devDependencies": {
28
- "@types/node": "^25.9.3",
29
- "langium-cli": "~4.3.0",
30
- "typescript": "^6.0.3",
31
- "vitest": "^4.1.9"
32
+ "@types/node": "^26.6.5",
33
+ "langium-cli": "~4.4.0",
34
+ "typescript": "^7.0.2",
35
+ "vitest": "^5.0.5"
32
36
  },
33
37
  "scripts": {
34
38
  "langium:generate": "langium generate",
@@ -1,3 +1,4 @@
1
+ import { ISO_DATE_RE, propKey } from '../util/props.js';
1
2
  import type { JsonAstNode } from './schema.js';
2
3
 
3
4
  // Keyed-property canonical order. Keys not in this list sort alphabetically after.
@@ -9,19 +10,25 @@ const KEY_ORDER = [
9
10
  'duration',
10
11
  'status',
11
12
  'owner',
13
+ 'wave',
12
14
  'after',
13
15
  'before',
14
16
  'remaining',
15
17
  'labels',
16
18
  'style',
19
+ 'unicode',
20
+ 'ascii',
17
21
  'link',
18
22
  'author',
23
+ 'every',
19
24
  'start',
25
+ 'end',
20
26
  'scale',
21
27
  'calendar',
22
28
  'header-position',
23
29
  'timeline-position',
24
30
  'minor-grid',
31
+ 'non-working',
25
32
  ];
26
33
 
27
34
  const INDENT = ' ';
@@ -94,6 +101,12 @@ class Printer {
94
101
  return this.blockDecl('calendar', asArray(entry.properties));
95
102
  case 'StyleDeclaration':
96
103
  return this.styleDecl(entry);
104
+ case 'SymbolDeclaration':
105
+ return this.simpleEntity('symbol', entry, 0);
106
+ case 'NonWorkingDeclaration':
107
+ return this.simpleEntity('non-working', entry, 0);
108
+ case 'WorkingDeclaration':
109
+ return this.simpleEntity('working', entry, 0);
97
110
  case 'DefaultDeclaration':
98
111
  return this.defaultDecl(entry);
99
112
  default:
@@ -144,6 +157,8 @@ class Printer {
144
157
  return this.simpleEntity('status', entry, depth);
145
158
  case 'LabelDeclaration':
146
159
  return this.simpleEntity('label', entry, depth);
160
+ case 'WaveDeclaration':
161
+ return this.simpleEntity('wave', entry, depth);
147
162
  case 'MilestoneDeclaration':
148
163
  return this.simpleEntity('milestone', entry, depth);
149
164
  case 'FootnoteDeclaration':
@@ -263,8 +278,8 @@ function renderProperties(properties: JsonAstNode[]): string {
263
278
  function orderProperties(properties: JsonAstNode[]): JsonAstNode[] {
264
279
  const indexOf = new Map(KEY_ORDER.map((k, i) => [k, i] as const));
265
280
  return [...properties].sort((a, b) => {
266
- const ak = normalizeKey(getString(a, 'key'));
267
- const bk = normalizeKey(getString(b, 'key'));
281
+ const ak = propKey({ key: getString(a, 'key') });
282
+ const bk = propKey({ key: getString(b, 'key') });
268
283
  const ai = indexOf.get(ak);
269
284
  const bi = indexOf.get(bk);
270
285
  if (ai !== undefined && bi !== undefined) return ai - bi;
@@ -275,7 +290,7 @@ function orderProperties(properties: JsonAstNode[]): JsonAstNode[] {
275
290
  }
276
291
 
277
292
  function renderProperty(prop: JsonAstNode): string {
278
- const key = normalizeKey(getString(prop, 'key'));
293
+ const key = propKey({ key: getString(prop, 'key') });
279
294
  const values = asStringArray(prop.values);
280
295
  const value = prop.value as string | undefined;
281
296
  if (values.length >= 2) {
@@ -293,7 +308,7 @@ function renderProperty(prop: JsonAstNode): string {
293
308
  // Block-style property (one per line, rendered as `key: value`). Used inside
294
309
  // indented blocks like `scale`, `calendar`, and `style`.
295
310
  function renderBlockProperty(prop: JsonAstNode): string {
296
- const key = normalizeKey(getString(prop, 'key'));
311
+ const key = propKey({ key: getString(prop, 'key') });
297
312
  const values = asStringArray(prop.values);
298
313
  const value = prop.value as string | undefined;
299
314
  if (values.length >= 2) {
@@ -308,12 +323,7 @@ function renderBlockProperty(prop: JsonAstNode): string {
308
323
  return `${key}:`;
309
324
  }
310
325
 
311
- function normalizeKey(key: string): string {
312
- return key.endsWith(':') ? key.slice(0, -1) : key;
313
- }
314
-
315
326
  const URL_RE = /^https?:\/\//;
316
- const DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
317
327
  const DURATION_RE = /^\d+(?:\.\d+)?[dwmqy]$/;
318
328
  const PERCENTAGE_RE = /^\d+%$/;
319
329
  const HEX_COLOR_RE = /^#[0-9a-fA-F]{3,8}$/;
@@ -323,7 +333,7 @@ const ID_RE = /^[a-zA-Z_][a-zA-Z0-9_-]*$/;
323
333
  function formatAtom(atom: string): string {
324
334
  if (
325
335
  URL_RE.test(atom) ||
326
- DATE_RE.test(atom) ||
336
+ ISO_DATE_RE.test(atom) ||
327
337
  DURATION_RE.test(atom) ||
328
338
  PERCENTAGE_RE.test(atom) ||
329
339
  HEX_COLOR_RE.test(atom) ||
@@ -22,6 +22,13 @@ export interface JsonAstNode {
22
22
 
23
23
  export interface SerializeOptions {
24
24
  includePositions?: boolean;
25
+ /**
26
+ * Emitted verbatim as `file.uri` in place of `document.uri.toString()`.
27
+ * For callers that parse from a synthetic URI (e.g. `stageRoadmap`'s
28
+ * `memory:///stage-N.nowline`) but must report the real source path.
29
+ * No normalization or percent-encoding is applied.
30
+ */
31
+ uri?: string;
25
32
  }
26
33
 
27
34
  // Keys that Langium adds to AST nodes that we don't want in the JSON form.
@@ -38,7 +45,7 @@ export function serializeToJson(
38
45
  return {
39
46
  $nowlineSchema: NOWLINE_SCHEMA_VERSION,
40
47
  file: {
41
- uri: document.uri.toString(),
48
+ uri: options.uri ?? document.uri.toString(),
42
49
  source,
43
50
  },
44
51
  ast: serializeNode(document.parseResult.value, includePositions),
@@ -1,5 +1,5 @@
1
1
  /******************************************************************************
2
- * This file was generated by langium-cli 4.3.0.
2
+ * This file was generated by langium-cli 4.4.0.
3
3
  * DO NOT EDIT MANUALLY!
4
4
  ******************************************************************************/
5
5
 
@@ -44,6 +44,7 @@ export type NowlineKeywordNames =
44
44
  | "item"
45
45
  | "label"
46
46
  | "milestone"
47
+ | "non-working"
47
48
  | "nowline"
48
49
  | "parallel"
49
50
  | "person"
@@ -54,7 +55,9 @@ export type NowlineKeywordNames =
54
55
  | "style"
55
56
  | "swimlane"
56
57
  | "symbol"
57
- | "team";
58
+ | "team"
59
+ | "wave"
60
+ | "working";
58
61
 
59
62
  export type NowlineTokenNames = NowlineTerminalNames | NowlineKeywordNames;
60
63
 
@@ -62,7 +65,7 @@ export interface AnchorDeclaration extends langium.AstNode {
62
65
  readonly $container: NowlineFile;
63
66
  readonly $type: 'AnchorDeclaration';
64
67
  description?: DescriptionDirective;
65
- name?: string;
68
+ name?: EntityName;
66
69
  properties: Array<EntityProperty>;
67
70
  title?: string;
68
71
  }
@@ -96,10 +99,10 @@ export function isBlockProperty(item: unknown): item is BlockProperty {
96
99
  return reflection.isInstance(item, BlockProperty.$type);
97
100
  }
98
101
 
99
- export type BlockPropertyValue = string;
102
+ export type BlockPropertyValue = 'non-working' | 'wave' | 'working' | string;
100
103
 
101
104
  export function isBlockPropertyValue(item: unknown): item is BlockPropertyValue {
102
- return (typeof item === 'string' && (/[a-zA-Z_][a-zA-Z0-9_-]*/.test(item) || /\d+/.test(item) || /"([^"\\]|\\.)*"/.test(item) || /\d+(\.\d+)?[dwmqy]/.test(item)));
105
+ return item === 'wave' || item === 'non-working' || item === 'working' || (typeof item === 'string' && (/[a-zA-Z_][a-zA-Z0-9_-]*/.test(item) || /\d+/.test(item) || /"([^"\\]|\\.)*"/.test(item) || /\d+(\.\d+)?[dwmqy]/.test(item)));
103
106
  }
104
107
 
105
108
  export interface CalendarBlock extends langium.AstNode {
@@ -117,7 +120,7 @@ export function isCalendarBlock(item: unknown): item is CalendarBlock {
117
120
  return reflection.isInstance(item, CalendarBlock.$type);
118
121
  }
119
122
 
120
- export type ConfigEntry = CalendarBlock | DefaultDeclaration | ScaleBlock | StyleDeclaration | SymbolDeclaration;
123
+ export type ConfigEntry = CalendarBlock | DefaultDeclaration | NonWorkingDeclaration | ScaleBlock | StyleDeclaration | SymbolDeclaration | WorkingDeclaration;
121
124
 
122
125
  export const ConfigEntry = {
123
126
  $type: 'ConfigEntry'
@@ -151,7 +154,7 @@ export function isDefaultEntityType(item: unknown): item is DefaultEntityType {
151
154
  }
152
155
 
153
156
  export interface DescriptionDirective extends langium.AstNode {
154
- readonly $container: AnchorDeclaration | FootnoteDeclaration | GroupBlock | ItemDeclaration | LabelDeclaration | MilestoneDeclaration | ParallelBlock | PersonDeclaration | SizeDeclaration | StatusDeclaration | SwimlaneDeclaration | SymbolDeclaration | TeamDeclaration;
157
+ readonly $container: AnchorDeclaration | FootnoteDeclaration | GroupBlock | ItemDeclaration | LabelDeclaration | MilestoneDeclaration | ParallelBlock | PersonDeclaration | SizeDeclaration | StatusDeclaration | SwimlaneDeclaration | SymbolDeclaration | TeamDeclaration | WaveDeclaration;
155
158
  readonly $type: 'DescriptionDirective';
156
159
  text: string;
157
160
  }
@@ -165,8 +168,14 @@ export function isDescriptionDirective(item: unknown): item is DescriptionDirect
165
168
  return reflection.isInstance(item, DescriptionDirective.$type);
166
169
  }
167
170
 
171
+ export type EntityName = 'non-working' | 'wave' | 'working' | string;
172
+
173
+ export function isEntityName(item: unknown): item is EntityName {
174
+ return item === 'wave' || item === 'non-working' || item === 'working' || (typeof item === 'string' && (/[a-zA-Z_][a-zA-Z0-9_-]*/.test(item)));
175
+ }
176
+
168
177
  export interface EntityProperty extends langium.AstNode {
169
- readonly $container: AnchorDeclaration | DefaultDeclaration | FootnoteDeclaration | GroupBlock | ItemDeclaration | LabelDeclaration | MilestoneDeclaration | ParallelBlock | PersonDeclaration | RoadmapDeclaration | SizeDeclaration | StatusDeclaration | SwimlaneDeclaration | SymbolDeclaration | TeamDeclaration;
178
+ readonly $container: AnchorDeclaration | DefaultDeclaration | FootnoteDeclaration | GroupBlock | ItemDeclaration | LabelDeclaration | MilestoneDeclaration | NonWorkingDeclaration | ParallelBlock | PersonDeclaration | RoadmapDeclaration | SizeDeclaration | StatusDeclaration | SwimlaneDeclaration | SymbolDeclaration | TeamDeclaration | WaveDeclaration | WorkingDeclaration;
170
179
  readonly $type: 'EntityProperty';
171
180
  key: string;
172
181
  value?: PropertyAtom;
@@ -188,7 +197,7 @@ export interface FootnoteDeclaration extends langium.AstNode {
188
197
  readonly $container: NowlineFile;
189
198
  readonly $type: 'FootnoteDeclaration';
190
199
  description?: DescriptionDirective;
191
- name?: string;
200
+ name?: EntityName;
192
201
  properties: Array<EntityProperty>;
193
202
  title?: string;
194
203
  }
@@ -209,7 +218,7 @@ export interface GroupBlock extends langium.AstNode {
209
218
  readonly $container: GroupBlock | ParallelBlock | SwimlaneDeclaration;
210
219
  readonly $type: 'GroupBlock';
211
220
  content: Array<GroupContent>;
212
- name?: string;
221
+ name?: EntityName;
213
222
  properties: Array<EntityProperty>;
214
223
  title?: string;
215
224
  }
@@ -274,7 +283,7 @@ export interface ItemDeclaration extends langium.AstNode {
274
283
  readonly $container: GroupBlock | ParallelBlock | SwimlaneDeclaration;
275
284
  readonly $type: 'ItemDeclaration';
276
285
  description?: DescriptionDirective;
277
- name?: string;
286
+ name?: EntityName;
278
287
  properties: Array<EntityProperty>;
279
288
  title?: string;
280
289
  }
@@ -295,7 +304,7 @@ export interface LabelDeclaration extends langium.AstNode {
295
304
  readonly $container: NowlineFile;
296
305
  readonly $type: 'LabelDeclaration';
297
306
  description?: DescriptionDirective;
298
- name?: string;
307
+ name?: EntityName;
299
308
  properties: Array<EntityProperty>;
300
309
  title?: string;
301
310
  }
@@ -316,7 +325,7 @@ export interface MilestoneDeclaration extends langium.AstNode {
316
325
  readonly $container: NowlineFile;
317
326
  readonly $type: 'MilestoneDeclaration';
318
327
  description?: DescriptionDirective;
319
- name?: string;
328
+ name?: EntityName;
320
329
  properties: Array<EntityProperty>;
321
330
  title?: string;
322
331
  }
@@ -333,6 +342,25 @@ export function isMilestoneDeclaration(item: unknown): item is MilestoneDeclarat
333
342
  return reflection.isInstance(item, MilestoneDeclaration.$type);
334
343
  }
335
344
 
345
+ export interface NonWorkingDeclaration extends langium.AstNode {
346
+ readonly $container: NowlineFile;
347
+ readonly $type: 'NonWorkingDeclaration';
348
+ name?: EntityName;
349
+ properties: Array<EntityProperty>;
350
+ title?: string;
351
+ }
352
+
353
+ export const NonWorkingDeclaration = {
354
+ $type: 'NonWorkingDeclaration',
355
+ name: 'name',
356
+ properties: 'properties',
357
+ title: 'title'
358
+ } as const;
359
+
360
+ export function isNonWorkingDeclaration(item: unknown): item is NonWorkingDeclaration {
361
+ return reflection.isInstance(item, NonWorkingDeclaration.$type);
362
+ }
363
+
336
364
  export interface NowlineDirective extends langium.AstNode {
337
365
  readonly $container: NowlineFile;
338
366
  readonly $type: 'NowlineDirective';
@@ -378,7 +406,7 @@ export interface ParallelBlock extends langium.AstNode {
378
406
  readonly $container: GroupBlock | SwimlaneDeclaration;
379
407
  readonly $type: 'ParallelBlock';
380
408
  content: Array<ParallelContent>;
381
- name?: string;
409
+ name?: EntityName;
382
410
  properties: Array<EntityProperty>;
383
411
  title?: string;
384
412
  }
@@ -409,7 +437,7 @@ export interface PersonDeclaration extends langium.AstNode {
409
437
  readonly $container: NowlineFile;
410
438
  readonly $type: 'PersonDeclaration';
411
439
  description?: DescriptionDirective;
412
- name?: string;
440
+ name?: EntityName;
413
441
  properties: Array<EntityProperty>;
414
442
  title?: string;
415
443
  }
@@ -429,7 +457,7 @@ export function isPersonDeclaration(item: unknown): item is PersonDeclaration {
429
457
  export interface PersonMemberRef extends langium.AstNode {
430
458
  readonly $container: TeamDeclaration;
431
459
  readonly $type: 'PersonMemberRef';
432
- ref: string;
460
+ ref: EntityName;
433
461
  }
434
462
 
435
463
  export const PersonMemberRef = {
@@ -441,16 +469,16 @@ export function isPersonMemberRef(item: unknown): item is PersonMemberRef {
441
469
  return reflection.isInstance(item, PersonMemberRef.$type);
442
470
  }
443
471
 
444
- export type PropertyAtom = 'person' | string;
472
+ export type PropertyAtom = 'non-working' | 'person' | 'wave' | 'working' | string;
445
473
 
446
474
  export function isPropertyAtom(item: unknown): item is PropertyAtom {
447
- return item === 'person' || (typeof item === 'string' && (/[a-zA-Z_][a-zA-Z0-9_-]*/.test(item) || /"([^"\\]|\\.)*"/.test(item) || /\d+(\.\d+)?[dwmqy]/.test(item) || /\d+(\.\d+)?%/.test(item) || /https?:\/\/[^\s\[\],]+/.test(item) || /\d{4}-\d{2}-\d{2}/.test(item) || /#[0-9a-fA-F]{3,8}/.test(item) || /\d+\.\d+/.test(item) || /\d+/.test(item)));
475
+ return item === 'person' || item === 'wave' || item === 'non-working' || item === 'working' || (typeof item === 'string' && (/[a-zA-Z_][a-zA-Z0-9_-]*/.test(item) || /"([^"\\]|\\.)*"/.test(item) || /\d+(\.\d+)?[dwmqy]/.test(item) || /\d+(\.\d+)?%/.test(item) || /https?:\/\/[^\s\[\],]+/.test(item) || /\d{4}-\d{2}-\d{2}/.test(item) || /#[0-9a-fA-F]{3,8}/.test(item) || /\d+\.\d+/.test(item) || /\d+/.test(item)));
448
476
  }
449
477
 
450
478
  export interface RoadmapDeclaration extends langium.AstNode {
451
479
  readonly $container: NowlineFile;
452
480
  readonly $type: 'RoadmapDeclaration';
453
- name?: string;
481
+ name?: EntityName;
454
482
  properties: Array<EntityProperty>;
455
483
  title?: string;
456
484
  }
@@ -466,7 +494,7 @@ export function isRoadmapDeclaration(item: unknown): item is RoadmapDeclaration
466
494
  return reflection.isInstance(item, RoadmapDeclaration.$type);
467
495
  }
468
496
 
469
- export type RoadmapEntry = AnchorDeclaration | FootnoteDeclaration | LabelDeclaration | MilestoneDeclaration | PersonDeclaration | SizeDeclaration | StatusDeclaration | SwimlaneDeclaration | TeamDeclaration;
497
+ export type RoadmapEntry = AnchorDeclaration | FootnoteDeclaration | LabelDeclaration | MilestoneDeclaration | PersonDeclaration | SizeDeclaration | StatusDeclaration | SwimlaneDeclaration | TeamDeclaration | WaveDeclaration;
470
498
 
471
499
  export const RoadmapEntry = {
472
500
  $type: 'RoadmapEntry'
@@ -495,7 +523,7 @@ export interface SizeDeclaration extends langium.AstNode {
495
523
  readonly $container: NowlineFile;
496
524
  readonly $type: 'SizeDeclaration';
497
525
  description?: DescriptionDirective;
498
- name?: string;
526
+ name?: EntityName;
499
527
  properties: Array<EntityProperty>;
500
528
  title?: string;
501
529
  }
@@ -516,7 +544,7 @@ export interface StatusDeclaration extends langium.AstNode {
516
544
  readonly $container: NowlineFile;
517
545
  readonly $type: 'StatusDeclaration';
518
546
  description?: DescriptionDirective;
519
- name?: string;
547
+ name?: EntityName;
520
548
  properties: Array<EntityProperty>;
521
549
  title?: string;
522
550
  }
@@ -536,7 +564,7 @@ export function isStatusDeclaration(item: unknown): item is StatusDeclaration {
536
564
  export interface StyleDeclaration extends langium.AstNode {
537
565
  readonly $container: NowlineFile;
538
566
  readonly $type: 'StyleDeclaration';
539
- name?: string;
567
+ name?: EntityName;
540
568
  properties: Array<StyleProperty>;
541
569
  title?: string;
542
570
  }
@@ -569,10 +597,10 @@ export function isStyleProperty(item: unknown): item is StyleProperty {
569
597
  return reflection.isInstance(item, StyleProperty.$type);
570
598
  }
571
599
 
572
- export type StylePropertyValue = 'person' | string;
600
+ export type StylePropertyValue = 'non-working' | 'person' | 'wave' | 'working' | string;
573
601
 
574
602
  export function isStylePropertyValue(item: unknown): item is StylePropertyValue {
575
- return item === 'person' || (typeof item === 'string' && (/[a-zA-Z_][a-zA-Z0-9_-]*/.test(item) || /#[0-9a-fA-F]{3,8}/.test(item) || /"([^"\\]|\\.)*"/.test(item)));
603
+ return item === 'person' || item === 'wave' || item === 'non-working' || item === 'working' || (typeof item === 'string' && (/[a-zA-Z_][a-zA-Z0-9_-]*/.test(item) || /#[0-9a-fA-F]{3,8}/.test(item) || /"([^"\\]|\\.)*"/.test(item)));
576
604
  }
577
605
 
578
606
  export type SwimlaneContent = DescriptionDirective | GroupBlock | ItemDeclaration | ParallelBlock;
@@ -589,7 +617,7 @@ export interface SwimlaneDeclaration extends langium.AstNode {
589
617
  readonly $container: NowlineFile;
590
618
  readonly $type: 'SwimlaneDeclaration';
591
619
  content: Array<SwimlaneContent>;
592
- name?: string;
620
+ name?: EntityName;
593
621
  properties: Array<EntityProperty>;
594
622
  title?: string;
595
623
  }
@@ -610,7 +638,7 @@ export interface SymbolDeclaration extends langium.AstNode {
610
638
  readonly $container: NowlineFile;
611
639
  readonly $type: 'SymbolDeclaration';
612
640
  description?: DescriptionDirective;
613
- name?: string;
641
+ name?: EntityName;
614
642
  properties: Array<EntityProperty>;
615
643
  title?: string;
616
644
  }
@@ -641,7 +669,7 @@ export interface TeamDeclaration extends langium.AstNode {
641
669
  readonly $container: NowlineFile | TeamDeclaration;
642
670
  readonly $type: 'TeamDeclaration';
643
671
  content: Array<TeamContent>;
644
- name?: string;
672
+ name?: EntityName;
645
673
  properties: Array<EntityProperty>;
646
674
  title?: string;
647
675
  }
@@ -658,6 +686,46 @@ export function isTeamDeclaration(item: unknown): item is TeamDeclaration {
658
686
  return reflection.isInstance(item, TeamDeclaration.$type);
659
687
  }
660
688
 
689
+ export interface WaveDeclaration extends langium.AstNode {
690
+ readonly $container: NowlineFile;
691
+ readonly $type: 'WaveDeclaration';
692
+ description?: DescriptionDirective;
693
+ name?: EntityName;
694
+ properties: Array<EntityProperty>;
695
+ title?: string;
696
+ }
697
+
698
+ export const WaveDeclaration = {
699
+ $type: 'WaveDeclaration',
700
+ description: 'description',
701
+ name: 'name',
702
+ properties: 'properties',
703
+ title: 'title'
704
+ } as const;
705
+
706
+ export function isWaveDeclaration(item: unknown): item is WaveDeclaration {
707
+ return reflection.isInstance(item, WaveDeclaration.$type);
708
+ }
709
+
710
+ export interface WorkingDeclaration extends langium.AstNode {
711
+ readonly $container: NowlineFile;
712
+ readonly $type: 'WorkingDeclaration';
713
+ name?: EntityName;
714
+ properties: Array<EntityProperty>;
715
+ title?: string;
716
+ }
717
+
718
+ export const WorkingDeclaration = {
719
+ $type: 'WorkingDeclaration',
720
+ name: 'name',
721
+ properties: 'properties',
722
+ title: 'title'
723
+ } as const;
724
+
725
+ export function isWorkingDeclaration(item: unknown): item is WorkingDeclaration {
726
+ return reflection.isInstance(item, WorkingDeclaration.$type);
727
+ }
728
+
661
729
  export type NowlineAstType = {
662
730
  AnchorDeclaration: AnchorDeclaration
663
731
  BlockProperty: BlockProperty
@@ -674,6 +742,7 @@ export type NowlineAstType = {
674
742
  ItemDeclaration: ItemDeclaration
675
743
  LabelDeclaration: LabelDeclaration
676
744
  MilestoneDeclaration: MilestoneDeclaration
745
+ NonWorkingDeclaration: NonWorkingDeclaration
677
746
  NowlineDirective: NowlineDirective
678
747
  NowlineFile: NowlineFile
679
748
  ParallelBlock: ParallelBlock
@@ -692,6 +761,8 @@ export type NowlineAstType = {
692
761
  SymbolDeclaration: SymbolDeclaration
693
762
  TeamContent: TeamContent
694
763
  TeamDeclaration: TeamDeclaration
764
+ WaveDeclaration: WaveDeclaration
765
+ WorkingDeclaration: WorkingDeclaration
695
766
  }
696
767
 
697
768
  export class NowlineAstReflection extends langium.AbstractAstReflection {
@@ -936,6 +1007,25 @@ export class NowlineAstReflection extends langium.AbstractAstReflection {
936
1007
  },
937
1008
  superTypes: [RoadmapEntry.$type]
938
1009
  },
1010
+ NonWorkingDeclaration: {
1011
+ name: NonWorkingDeclaration.$type,
1012
+ properties: {
1013
+ name: {
1014
+ name: NonWorkingDeclaration.name,
1015
+ optional: true
1016
+ },
1017
+ properties: {
1018
+ name: NonWorkingDeclaration.properties,
1019
+ defaultValue: [],
1020
+ optional: true
1021
+ },
1022
+ title: {
1023
+ name: NonWorkingDeclaration.title,
1024
+ optional: true
1025
+ }
1026
+ },
1027
+ superTypes: [ConfigEntry.$type]
1028
+ },
939
1029
  NowlineDirective: {
940
1030
  name: NowlineDirective.$type,
941
1031
  properties: {
@@ -1240,6 +1330,48 @@ export class NowlineAstReflection extends langium.AbstractAstReflection {
1240
1330
  }
1241
1331
  },
1242
1332
  superTypes: [RoadmapEntry.$type, TeamContent.$type]
1333
+ },
1334
+ WaveDeclaration: {
1335
+ name: WaveDeclaration.$type,
1336
+ properties: {
1337
+ description: {
1338
+ name: WaveDeclaration.description,
1339
+ optional: true
1340
+ },
1341
+ name: {
1342
+ name: WaveDeclaration.name,
1343
+ optional: true
1344
+ },
1345
+ properties: {
1346
+ name: WaveDeclaration.properties,
1347
+ defaultValue: [],
1348
+ optional: true
1349
+ },
1350
+ title: {
1351
+ name: WaveDeclaration.title,
1352
+ optional: true
1353
+ }
1354
+ },
1355
+ superTypes: [RoadmapEntry.$type]
1356
+ },
1357
+ WorkingDeclaration: {
1358
+ name: WorkingDeclaration.$type,
1359
+ properties: {
1360
+ name: {
1361
+ name: WorkingDeclaration.name,
1362
+ optional: true
1363
+ },
1364
+ properties: {
1365
+ name: WorkingDeclaration.properties,
1366
+ defaultValue: [],
1367
+ optional: true
1368
+ },
1369
+ title: {
1370
+ name: WorkingDeclaration.title,
1371
+ optional: true
1372
+ }
1373
+ },
1374
+ superTypes: [ConfigEntry.$type]
1243
1375
  }
1244
1376
  } as const satisfies langium.AstMetaData
1245
1377
  }