@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.
- package/README.md +9 -0
- package/dist/convert/printer.d.ts.map +1 -1
- package/dist/convert/printer.js +20 -9
- package/dist/convert/printer.js.map +1 -1
- package/dist/convert/schema.d.ts +7 -0
- package/dist/convert/schema.d.ts.map +1 -1
- package/dist/convert/schema.js +1 -1
- package/dist/convert/schema.js.map +1 -1
- package/dist/generated/ast.d.ts +134 -24
- package/dist/generated/ast.d.ts.map +1 -1
- package/dist/generated/ast.js +95 -3
- package/dist/generated/ast.js.map +1 -1
- package/dist/generated/grammar.d.ts.map +1 -1
- package/dist/generated/grammar.js +434 -148
- package/dist/generated/grammar.js.map +1 -1
- package/dist/i18n/codes.d.ts +1 -1
- package/dist/i18n/codes.d.ts.map +1 -1
- package/dist/i18n/codes.js +44 -1
- package/dist/i18n/codes.js.map +1 -1
- package/dist/i18n/index.d.ts +1 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/messages.en.d.ts +107 -0
- package/dist/i18n/messages.en.d.ts.map +1 -1
- package/dist/i18n/messages.en.js +220 -1
- package/dist/i18n/messages.en.js.map +1 -1
- package/dist/i18n/messages.fr.d.ts.map +1 -1
- package/dist/i18n/messages.fr.js +250 -1
- package/dist/i18n/messages.fr.js.map +1 -1
- package/dist/i18n/wave-message-types.d.ts +238 -0
- package/dist/i18n/wave-message-types.d.ts.map +1 -0
- package/dist/i18n/wave-message-types.js +11 -0
- package/dist/i18n/wave-message-types.js.map +1 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +6 -0
- package/dist/internal.d.ts.map +1 -0
- package/dist/internal.js +9 -0
- package/dist/internal.js.map +1 -0
- package/dist/language/ast-walk.d.ts +31 -0
- package/dist/language/ast-walk.d.ts.map +1 -0
- package/dist/language/ast-walk.js +109 -0
- package/dist/language/ast-walk.js.map +1 -0
- package/dist/language/calendar-declarations.d.ts +31 -0
- package/dist/language/calendar-declarations.d.ts.map +1 -0
- package/dist/language/calendar-declarations.js +99 -0
- package/dist/language/calendar-declarations.js.map +1 -0
- package/dist/language/include-references.d.ts +11 -0
- package/dist/language/include-references.d.ts.map +1 -0
- package/dist/language/include-references.js +45 -0
- package/dist/language/include-references.js.map +1 -0
- package/dist/language/include-resolver.d.ts +78 -1
- package/dist/language/include-resolver.d.ts.map +1 -1
- package/dist/language/include-resolver.js +190 -12
- package/dist/language/include-resolver.js.map +1 -1
- package/dist/language/include-waves.d.ts +73 -0
- package/dist/language/include-waves.d.ts.map +1 -0
- package/dist/language/include-waves.js +319 -0
- package/dist/language/include-waves.js.map +1 -0
- package/dist/language/nowline-validator.d.ts +6 -1
- package/dist/language/nowline-validator.d.ts.map +1 -1
- package/dist/language/nowline-validator.js +95 -1589
- package/dist/language/nowline-validator.js.map +1 -1
- package/dist/language/references.d.ts +14 -0
- package/dist/language/references.d.ts.map +1 -0
- package/dist/language/references.js +36 -0
- package/dist/language/references.js.map +1 -0
- package/dist/language/style-chain.d.ts +37 -0
- package/dist/language/style-chain.d.ts.map +1 -0
- package/dist/language/style-chain.js +55 -0
- package/dist/language/style-chain.js.map +1 -0
- package/dist/language/validator/calendar.d.ts +9 -0
- package/dist/language/validator/calendar.d.ts.map +1 -0
- package/dist/language/validator/calendar.js +250 -0
- package/dist/language/validator/calendar.js.map +1 -0
- package/dist/language/validator/entities.d.ts +23 -0
- package/dist/language/validator/entities.d.ts.map +1 -0
- package/dist/language/validator/entities.js +261 -0
- package/dist/language/validator/entities.js.map +1 -0
- package/dist/language/validator/properties.d.ts +18 -0
- package/dist/language/validator/properties.d.ts.map +1 -0
- package/dist/language/validator/properties.js +356 -0
- package/dist/language/validator/properties.js.map +1 -0
- package/dist/language/validator/references.d.ts +7 -0
- package/dist/language/validator/references.d.ts.map +1 -0
- package/dist/language/validator/references.js +261 -0
- package/dist/language/validator/references.js.map +1 -0
- package/dist/language/validator/structure.d.ts +16 -0
- package/dist/language/validator/structure.d.ts.map +1 -0
- package/dist/language/validator/structure.js +166 -0
- package/dist/language/validator/structure.js.map +1 -0
- package/dist/language/validator/style.d.ts +5 -0
- package/dist/language/validator/style.d.ts.map +1 -0
- package/dist/language/validator/style.js +126 -0
- package/dist/language/validator/style.js.map +1 -0
- package/dist/language/validator/support.d.ts +35 -0
- package/dist/language/validator/support.d.ts.map +1 -0
- package/dist/language/validator/support.js +49 -0
- package/dist/language/validator/support.js.map +1 -0
- package/dist/language/validator/symbols.d.ts +6 -0
- package/dist/language/validator/symbols.d.ts.map +1 -0
- package/dist/language/validator/symbols.js +131 -0
- package/dist/language/validator/symbols.js.map +1 -0
- package/dist/language/validator/tables.d.ts +34 -0
- package/dist/language/validator/tables.d.ts.map +1 -0
- package/dist/language/validator/tables.js +120 -0
- package/dist/language/validator/tables.js.map +1 -0
- package/dist/language/validator-utils.d.ts +32 -0
- package/dist/language/validator-utils.d.ts.map +1 -0
- package/dist/language/validator-utils.js +118 -0
- package/dist/language/validator-utils.js.map +1 -0
- package/dist/language/value-tables.d.ts +107 -0
- package/dist/language/value-tables.d.ts.map +1 -0
- package/dist/language/value-tables.js +240 -0
- package/dist/language/value-tables.js.map +1 -0
- package/dist/language/waves-order.d.ts +51 -0
- package/dist/language/waves-order.d.ts.map +1 -0
- package/dist/language/waves-order.js +787 -0
- package/dist/language/waves-order.js.map +1 -0
- package/dist/language/waves-plan.d.ts +45 -0
- package/dist/language/waves-plan.d.ts.map +1 -0
- package/dist/language/waves-plan.js +64 -0
- package/dist/language/waves-plan.js.map +1 -0
- package/dist/language/waves.d.ts +96 -0
- package/dist/language/waves.d.ts.map +1 -0
- package/dist/language/waves.js +575 -0
- package/dist/language/waves.js.map +1 -0
- package/dist/util/props.d.ts +27 -0
- package/dist/util/props.d.ts.map +1 -0
- package/dist/util/props.js +49 -0
- package/dist/util/props.js.map +1 -0
- package/dist/util/single-line.d.ts +14 -0
- package/dist/util/single-line.d.ts.map +1 -0
- package/dist/util/single-line.js +16 -0
- package/dist/util/single-line.js.map +1 -0
- package/package.json +7 -3
- package/src/convert/printer.ts +20 -10
- package/src/convert/schema.ts +8 -1
- package/src/generated/ast.ts +159 -27
- package/src/generated/grammar.ts +434 -148
- package/src/i18n/codes.ts +95 -2
- package/src/i18n/index.ts +1 -0
- package/src/i18n/messages.en.ts +300 -1
- package/src/i18n/messages.fr.ts +335 -1
- package/src/i18n/wave-message-types.ts +206 -0
- package/src/index.ts +33 -0
- package/src/internal.ts +9 -0
- package/src/language/ast-walk.ts +158 -0
- package/src/language/calendar-declarations.ts +141 -0
- package/src/language/include-references.ts +49 -0
- package/src/language/include-resolver.ts +284 -10
- package/src/language/include-waves.ts +419 -0
- package/src/language/nowline-validator.ts +98 -1835
- package/src/language/nowline.langium +56 -22
- package/src/language/references.ts +40 -0
- package/src/language/style-chain.ts +95 -0
- package/src/language/validator/calendar.ts +319 -0
- package/src/language/validator/entities.ts +366 -0
- package/src/language/validator/properties.ts +425 -0
- package/src/language/validator/references.ts +295 -0
- package/src/language/validator/structure.ts +206 -0
- package/src/language/validator/style.ts +149 -0
- package/src/language/validator/support.ts +84 -0
- package/src/language/validator/symbols.ts +141 -0
- package/src/language/validator/tables.ts +171 -0
- package/src/language/validator-utils.ts +123 -0
- package/src/language/value-tables.ts +260 -0
- package/src/language/waves-order.ts +879 -0
- package/src/language/waves-plan.ts +101 -0
- package/src/language/waves.ts +731 -0
- package/src/util/props.ts +59 -0
- package/src/util/single-line.ts +15 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { DefaultEntityType } from '../../generated/ast.js';
|
|
2
|
+
export { UTILIZATION_NONE } from '../value-tables.js';
|
|
3
|
+
export declare const SUPPORTED_VERSION = "v1";
|
|
4
|
+
export declare const BUILTIN_STATUS_SET: ReadonlySet<string>;
|
|
5
|
+
export declare const BUILTIN_CAPACITY_ICON_SET: ReadonlySet<string>;
|
|
6
|
+
export declare const BUILTIN_ICON_NAME_SET: ReadonlySet<string>;
|
|
7
|
+
export declare const STYLE_PROP_KEYS: ReadonlySet<string>;
|
|
8
|
+
export declare const NON_WORKING_VALUES: ReadonlySet<string>;
|
|
9
|
+
export declare const ROADMAP_ONLY_STYLE_KEYS: ReadonlySet<string>;
|
|
10
|
+
export declare const STYLE_PROP_ENUMS: Record<string, ReadonlySet<string>>;
|
|
11
|
+
export declare const COLOR_NAMES: ReadonlySet<string>;
|
|
12
|
+
export declare const CALENDAR_MODES: ReadonlySet<string>;
|
|
13
|
+
export declare const CALENDAR_FIELDS: ReadonlySet<string>;
|
|
14
|
+
export declare const SCALE_FIELDS: ReadonlySet<string>;
|
|
15
|
+
export declare const DEFAULT_ENTITY_TYPES: ReadonlySet<string>;
|
|
16
|
+
export declare const DEFAULT_BANNED: Record<DefaultEntityType, Set<string>>;
|
|
17
|
+
export declare const UNIVERSAL_ENTITY_PROPS: ReadonlySet<string>;
|
|
18
|
+
export declare const ENTITY_KNOWN_PROPS: Record<string, ReadonlySet<string>>;
|
|
19
|
+
export declare function suggestConcept(key: string, known: ReadonlySet<string>, entityType?: string): string | undefined;
|
|
20
|
+
export declare const DURATION_RE: RegExp;
|
|
21
|
+
export declare const PERCENTAGE_RE: RegExp;
|
|
22
|
+
export declare const HEX_COLOR_RE: RegExp;
|
|
23
|
+
export declare const VERSION_RE: RegExp;
|
|
24
|
+
export declare const INTEGER_RE: RegExp;
|
|
25
|
+
export declare const BARE_DURATION_SUFFIX_RE: RegExp;
|
|
26
|
+
export declare const POSITIVE_NUMBER_RE: RegExp;
|
|
27
|
+
export declare const POSITIVE_PERCENT_RE: RegExp;
|
|
28
|
+
export declare const POSITIVE_DECIMAL_FRACTION_RE: RegExp;
|
|
29
|
+
export declare const POSITIVE_INTEGER_RE: RegExp;
|
|
30
|
+
export declare const ASCII_FALLBACK_RE: RegExp;
|
|
31
|
+
export declare const BCP47_RE: RegExp;
|
|
32
|
+
export declare const INCLUDE_MODES: ReadonlySet<string>;
|
|
33
|
+
export declare const DIRECTIVE_FIELDS: ReadonlySet<string>;
|
|
34
|
+
//# sourceMappingURL=tables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tables.d.ts","sourceRoot":"","sources":["../../../src/language/validator/tables.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAoBhE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,eAAO,MAAM,iBAAiB,OAAO,CAAC;AAItC,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAA6B,CAAC;AACjF,eAAO,MAAM,yBAAyB,EAAE,WAAW,CAAC,MAAM,CAAmC,CAAC;AAC9F,eAAO,MAAM,qBAAqB,EAAE,WAAW,CAAC,MAAM,CAA+B,CAAC;AAGtF,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,MAAM,CAAgC,CAAC;AAKjF,eAAO,MAAM,kBAAkB,EAAE,WAAW,CAAC,MAAM,CAAiC,CAAC;AAErF,eAAO,MAAM,uBAAuB,EAAE,WAAW,CAAC,MAAM,CAAwC,CAAC;AAIjG,eAAO,MAAM,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAEhE,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,WAAW,CAAC,MAAM,CAA4B,CAAC;AAEzE,eAAO,MAAM,cAAc,EAAE,WAAW,CAAC,MAAM,CAA+B,CAAC;AAE/E,eAAO,MAAM,eAAe,EAAE,WAAW,CAAC,MAAM,CAAgC,CAAC;AAEjF,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,MAAM,CAA6B,CAAC;AAE3E,eAAO,MAAM,oBAAoB,EAAE,WAAW,CAAC,MAAM,CAAqC,CAAC;AAM3F,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,iBAAiB,EAAE,GAAG,CAAC,MAAM,CAAC,CAmBjE,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,WAAW,CAAC,MAAM,CAAuC,CAAC;AAE/F,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAElE,CAAC;AAmCF,wBAAgB,cAAc,CAC1B,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,WAAW,CAAC,MAAM,CAAC,EAC1B,UAAU,CAAC,EAAE,MAAM,GACpB,MAAM,GAAG,SAAS,CAUpB;AAGD,eAAO,MAAM,WAAW,QAA2B,CAAC;AACpD,eAAO,MAAM,aAAa,QAAW,CAAC;AACtC,eAAO,MAAM,YAAY,QAAwB,CAAC;AAClD,eAAO,MAAM,UAAU,QAAW,CAAC;AACnC,eAAO,MAAM,UAAU,QAAU,CAAC;AAClC,eAAO,MAAM,uBAAuB,QAAc,CAAC;AAInD,eAAO,MAAM,kBAAkB,QAAkB,CAAC;AAClD,eAAO,MAAM,mBAAmB,QAAmB,CAAC;AAKpD,eAAO,MAAM,4BAA4B,QAAe,CAAC;AACzD,eAAO,MAAM,mBAAmB,QAAU,CAAC;AAG3C,eAAO,MAAM,iBAAiB,QAAuB,CAAC;AAMtD,eAAO,MAAM,QAAQ,QAA0C,CAAC;AAGhE,eAAO,MAAM,aAAa,EAAE,WAAW,CAAC,MAAM,CAA8B,CAAC;AAE7E,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAiC,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
// Constants, vocabularies and regexes the validator's checks share
|
|
2
|
+
// (specs/core-ast-utilities.md §3.6). Moved out of nowline-validator.ts as-is.
|
|
3
|
+
import { BUILTIN_CAPACITY_ICONS, BUILTIN_ICON_NAMES, BUILTIN_STATUSES, CALENDAR_FIELDS as CALENDAR_FIELD_LIST, CALENDAR_MODES as CALENDAR_MODE_LIST, COLOR_NAMES as COLOR_NAME_LIST, DEFAULT_ENTITY_TYPES as DEFAULT_ENTITY_TYPE_LIST, DIRECTIVE_FIELDS as DIRECTIVE_FIELD_LIST, ENTITY_KNOWN_PROPS as ENTITY_KNOWN_PROP_LISTS, INCLUDE_MODES as INCLUDE_MODE_LIST, NON_WORKING_DISPLAYS, ROADMAP_ONLY_STYLE_KEYS as ROADMAP_ONLY_STYLE_KEY_LIST, SCALE_FIELDS as SCALE_FIELD_LIST, STYLE_PROP_ENUMS as STYLE_PROP_ENUM_LISTS, STYLE_PROP_KEYS as STYLE_PROP_KEY_LIST, UNIVERSAL_ENTITY_PROPS as UNIVERSAL_ENTITY_PROP_LIST, } from '../value-tables.js';
|
|
4
|
+
export { UTILIZATION_NONE } from '../value-tables.js';
|
|
5
|
+
export const SUPPORTED_VERSION = 'v1';
|
|
6
|
+
// Built-in vocabularies come from value-tables.ts; the validator checks
|
|
7
|
+
// membership, so it holds them as sets.
|
|
8
|
+
export const BUILTIN_STATUS_SET = new Set(BUILTIN_STATUSES);
|
|
9
|
+
export const BUILTIN_CAPACITY_ICON_SET = new Set(BUILTIN_CAPACITY_ICONS);
|
|
10
|
+
export const BUILTIN_ICON_NAME_SET = new Set(BUILTIN_ICON_NAMES);
|
|
11
|
+
// Key vocabularies come from value-tables.ts too, held here as sets.
|
|
12
|
+
export const STYLE_PROP_KEYS = new Set(STYLE_PROP_KEY_LIST);
|
|
13
|
+
// `non-working:` values (specs/working-calendar.md §4.2). Kept out of
|
|
14
|
+
// `STYLE_PROP_ENUMS` on purpose: the key reports its own coded NL.E0800,
|
|
15
|
+
// and the generic enum check would add a second error (NL.E0802).
|
|
16
|
+
export const NON_WORKING_VALUES = new Set(NON_WORKING_DISPLAYS);
|
|
17
|
+
export const ROADMAP_ONLY_STYLE_KEYS = new Set(ROADMAP_ONLY_STYLE_KEY_LIST);
|
|
18
|
+
// Style enums, colour names and calendar modes come from value-tables.ts,
|
|
19
|
+
// held here as sets for the membership checks.
|
|
20
|
+
export const STYLE_PROP_ENUMS = Object.fromEntries(Object.entries(STYLE_PROP_ENUM_LISTS).map(([key, values]) => [key, new Set(values)]));
|
|
21
|
+
export const COLOR_NAMES = new Set(COLOR_NAME_LIST);
|
|
22
|
+
export const CALENDAR_MODES = new Set(CALENDAR_MODE_LIST);
|
|
23
|
+
export const CALENDAR_FIELDS = new Set(CALENDAR_FIELD_LIST);
|
|
24
|
+
export const SCALE_FIELDS = new Set(SCALE_FIELD_LIST);
|
|
25
|
+
export const DEFAULT_ENTITY_TYPES = new Set(DEFAULT_ENTITY_TYPE_LIST);
|
|
26
|
+
// Banned properties per entity type on `default <entity>` lines.
|
|
27
|
+
// `capacity` on `default swimlane` is banned because each lane's budget must be
|
|
28
|
+
// explicit at its declaration site (per dsl.md). `capacity` on `default item` is
|
|
29
|
+
// allowed (and a useful "every item consumes 1 unit by default" lever).
|
|
30
|
+
export const DEFAULT_BANNED = {
|
|
31
|
+
item: new Set([
|
|
32
|
+
'size',
|
|
33
|
+
'duration',
|
|
34
|
+
'after',
|
|
35
|
+
'before',
|
|
36
|
+
'remaining',
|
|
37
|
+
'link',
|
|
38
|
+
'description',
|
|
39
|
+
'owner',
|
|
40
|
+
]),
|
|
41
|
+
milestone: new Set(['date', 'after', 'link', 'description']),
|
|
42
|
+
anchor: new Set(['date', 'link', 'description']),
|
|
43
|
+
footnote: new Set(['on', 'link', 'description']),
|
|
44
|
+
label: new Set(['link', 'description']),
|
|
45
|
+
swimlane: new Set(['capacity']),
|
|
46
|
+
roadmap: new Set(),
|
|
47
|
+
parallel: new Set(),
|
|
48
|
+
group: new Set(),
|
|
49
|
+
};
|
|
50
|
+
export const UNIVERSAL_ENTITY_PROPS = new Set(UNIVERSAL_ENTITY_PROP_LIST);
|
|
51
|
+
export const ENTITY_KNOWN_PROPS = Object.fromEntries(Object.entries(ENTITY_KNOWN_PROP_LISTS).map(([type, keys]) => [type, new Set(keys)]));
|
|
52
|
+
// Conceptual mistakes that aren't typos of a real key — e.g. `progress:60` is a
|
|
53
|
+
// reasonable guess for "60% done", but Nowline models completion as
|
|
54
|
+
// `status:` + `remaining:` (work *left*). Levenshtein can't bridge that gap, so
|
|
55
|
+
// we map the concept directly. `requires` names a key the entity must support,
|
|
56
|
+
// so the hint only fires where it's actionable (e.g. on an `item`, which has
|
|
57
|
+
// `remaining`, not on a `roadmap` line). `entities`, when set, narrows it
|
|
58
|
+
// further to the declarations where the suggested form is valid.
|
|
59
|
+
const CONCEPT_ALIASES = [
|
|
60
|
+
{
|
|
61
|
+
keys: new Set(['progress', 'percent', 'percentage', 'pct', 'complete', 'completion']),
|
|
62
|
+
requires: 'remaining',
|
|
63
|
+
suggest: 'status: + remaining:',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
// A fixed start date is not supported on work (`specs/dsl.md` §
|
|
67
|
+
// Item Properties); `after:<date>` is "not before". An inline date
|
|
68
|
+
// in `after:` is valid on an item, parallel and group only
|
|
69
|
+
// (Validation Rule 24a), so a swimlane gets no hint.
|
|
70
|
+
keys: new Set(['date', 'start']),
|
|
71
|
+
requires: 'after',
|
|
72
|
+
entities: new Set(['ItemDeclaration', 'ParallelBlock', 'GroupBlock']),
|
|
73
|
+
suggest: 'after:<date>',
|
|
74
|
+
},
|
|
75
|
+
];
|
|
76
|
+
// Suggest the canonical property (or combination) for a known conceptual
|
|
77
|
+
// mistake, gated to entities that actually support the target key. Returns
|
|
78
|
+
// undefined when no concept matches so callers fall back to `suggestKey`.
|
|
79
|
+
export function suggestConcept(key, known, entityType) {
|
|
80
|
+
const lower = key.toLowerCase();
|
|
81
|
+
for (const alias of CONCEPT_ALIASES) {
|
|
82
|
+
if (!alias.keys.has(lower) || !known.has(alias.requires))
|
|
83
|
+
continue;
|
|
84
|
+
if (alias.entities && (entityType === undefined || !alias.entities.has(entityType))) {
|
|
85
|
+
continue;
|
|
86
|
+
}
|
|
87
|
+
return alias.suggest;
|
|
88
|
+
}
|
|
89
|
+
return undefined;
|
|
90
|
+
}
|
|
91
|
+
// Matches duration literals including decimals, e.g. `2w`, `0.5d`, `1.5m`.
|
|
92
|
+
export const DURATION_RE = /^\d+(?:\.\d+)?[dwmqy]$/;
|
|
93
|
+
export const PERCENTAGE_RE = /^\d+%$/;
|
|
94
|
+
export const HEX_COLOR_RE = /^#[0-9a-fA-F]{3,8}$/;
|
|
95
|
+
export const VERSION_RE = /^v\d+$/;
|
|
96
|
+
export const INTEGER_RE = /^\d+$/;
|
|
97
|
+
export const BARE_DURATION_SUFFIX_RE = /^[dwmqy]$/;
|
|
98
|
+
// Capacity numeric forms — the grammar already separates DECIMAL/INTEGER/PERCENTAGE
|
|
99
|
+
// terminals, but the validator needs to enforce the spec's "positive number" rule
|
|
100
|
+
// and to differentiate where percent is allowed (item) vs. banned (swimlane).
|
|
101
|
+
export const POSITIVE_NUMBER_RE = /^\d+(\.\d+)?$/;
|
|
102
|
+
export const POSITIVE_PERCENT_RE = /^\d+(\.\d+)?%$/;
|
|
103
|
+
// Disambiguated forms used by `utilization-warn-at:` / `utilization-over-at:`.
|
|
104
|
+
// A decimal-fraction MUST include the dot so its meaning is unambiguous; a
|
|
105
|
+
// bare integer matches the integer regex and is rejected by the validator
|
|
106
|
+
// with a hint to switch to either the percent or decimal-fraction form.
|
|
107
|
+
export const POSITIVE_DECIMAL_FRACTION_RE = /^\d+\.\d+$/;
|
|
108
|
+
export const POSITIVE_INTEGER_RE = /^\d+$/;
|
|
109
|
+
// ASCII printable, length 1-3 — used by the glyph declaration validator for the
|
|
110
|
+
// `ascii:"..."` fallback property after Langium has stripped the surrounding quotes.
|
|
111
|
+
export const ASCII_FALLBACK_RE = /^[\x20-\x7E]{1,3}$/;
|
|
112
|
+
// BCP-47 language tag, simplified to the subset Nowline cares about: a 2- or 3-letter
|
|
113
|
+
// primary language subtag followed by an optional region subtag (2 letters or 3 digits).
|
|
114
|
+
// Permissive enough for `fr`, `fr-CA`, `zh-CN`, `es-419` while rejecting obvious typos.
|
|
115
|
+
// The runtime resolver does the actual fallback work; this regex just gates input shape.
|
|
116
|
+
export const BCP47_RE = /^[a-zA-Z]{2,3}(-[a-zA-Z]{2}|-\d{3})?$/;
|
|
117
|
+
// From value-tables.ts, held as a set for the membership check.
|
|
118
|
+
export const INCLUDE_MODES = new Set(INCLUDE_MODE_LIST);
|
|
119
|
+
export const DIRECTIVE_FIELDS = new Set(DIRECTIVE_FIELD_LIST);
|
|
120
|
+
//# sourceMappingURL=tables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tables.js","sourceRoot":"","sources":["../../../src/language/validator/tables.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,+EAA+E;AAG/E,OAAO,EACH,sBAAsB,EACtB,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,IAAI,mBAAmB,EACtC,cAAc,IAAI,kBAAkB,EACpC,WAAW,IAAI,eAAe,EAC9B,oBAAoB,IAAI,wBAAwB,EAChD,gBAAgB,IAAI,oBAAoB,EACxC,kBAAkB,IAAI,uBAAuB,EAC7C,aAAa,IAAI,iBAAiB,EAClC,oBAAoB,EACpB,uBAAuB,IAAI,2BAA2B,EACtD,YAAY,IAAI,gBAAgB,EAChC,gBAAgB,IAAI,qBAAqB,EACzC,eAAe,IAAI,mBAAmB,EACtC,sBAAsB,IAAI,0BAA0B,GACvD,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AAEtC,wEAAwE;AACxE,wCAAwC;AACxC,MAAM,CAAC,MAAM,kBAAkB,GAAwB,IAAI,GAAG,CAAC,gBAAgB,CAAC,CAAC;AACjF,MAAM,CAAC,MAAM,yBAAyB,GAAwB,IAAI,GAAG,CAAC,sBAAsB,CAAC,CAAC;AAC9F,MAAM,CAAC,MAAM,qBAAqB,GAAwB,IAAI,GAAG,CAAC,kBAAkB,CAAC,CAAC;AAEtF,qEAAqE;AACrE,MAAM,CAAC,MA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,0EAA0E;AAC1E,wEAAwE;AACxE,MAAM,CAAC,MAAM,4BAA4B,GAAG,YAAY,CAAC;AACzD,MAAM,CAAC,MAAM,mBAAmB,GAAG,OAAO,CAAC;AAC3C,gFAAgF;AAChF,qFAAqF;AACrF,MAAM,CAAC,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;AAEtD,sFAAsF;AACtF,yFAAyF;AACzF,wFAAwF;AACxF,yFAAyF;AACzF,MAAM,CAAC,MAAM,QAAQ,GAAG,uCAAuC,CAAC;AAEhE,gEAAgE;AAChE,MAAM,CAAC,MAAM,aAAa,GAAwB,IAAI,GAAG,CAAC,iBAAiB,CAAC,CAAC;AAE7E,MAAM,CAAC,MAAM,gBAAgB,GAAwB,IAAI,GAAG,CAAC,oBAAoB,CAAC,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { AstNode } from 'langium';
|
|
2
|
+
export declare function levenshteinCapped(a: string, b: string, cap: number): number;
|
|
3
|
+
export declare function suggestKey(key: string, candidates: Iterable<string>, cap?: number): string | undefined;
|
|
4
|
+
export declare function suggestUniqueKey(key: string, candidates: Iterable<string>, cap?: number): string | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* The name a diagnostic echoes for an entity: its id, else its title. A
|
|
7
|
+
* title can carry explicit line breaks, but a diagnostic is one line of
|
|
8
|
+
* text, so breaks collapse to a single space (`singleLine`).
|
|
9
|
+
*/
|
|
10
|
+
export declare function displayName(node: {
|
|
11
|
+
name?: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
}): string;
|
|
14
|
+
/**
|
|
15
|
+
* Returns the lowercase entity-type label for an AST node, suitable for
|
|
16
|
+
* embedding inside a validator message (e.g. `"item"`, `"milestone"`,
|
|
17
|
+
* `"swimlane"`). Mirrors `describeNode`'s normalization (strip
|
|
18
|
+
* `Declaration` / `Block` suffix, lowercase) but returns just the type so
|
|
19
|
+
* callers can compose their own message.
|
|
20
|
+
*/
|
|
21
|
+
export declare function entityTypeLabel(node: {
|
|
22
|
+
$type: string;
|
|
23
|
+
}): string;
|
|
24
|
+
export declare function describeNode(node: {
|
|
25
|
+
$type: string;
|
|
26
|
+
name?: string;
|
|
27
|
+
title?: string;
|
|
28
|
+
}): string;
|
|
29
|
+
/** 1-based source line of a node, or 0 when it has no CST node. */
|
|
30
|
+
export declare function lineOf(node: AstNode): number;
|
|
31
|
+
export declare function defaultBannedMessage(key: string, entityType: string): string;
|
|
32
|
+
//# sourceMappingURL=validator-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator-utils.d.ts","sourceRoot":"","sources":["../../src/language/validator-utils.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAOvC,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CA4B3E;AAKD,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,SAAI,GAAG,MAAM,GAAG,SAAS,CAYjG;AAID,wBAAgB,gBAAgB,CAC5B,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,QAAQ,CAAC,MAAM,CAAC,EAC5B,GAAG,SAAI,GACR,MAAM,GAAG,SAAS,CAepB;AAED;;;;GAIG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAE3E;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAI/D;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,CAI3F;AAED,mEAAmE;AACnE,wBAAgB,MAAM,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAG5C;AAMD,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAE5E"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// Small helpers shared by the validator (`nowline-validator.ts`) and the
|
|
2
|
+
// wave rules (`waves.ts`). Kept free of Langium services so both the
|
|
3
|
+
// validator and the include resolver can call the wave rules as pure
|
|
4
|
+
// functions.
|
|
5
|
+
import { singleLine } from '../util/single-line.js';
|
|
6
|
+
// Levenshtein distance with an early-exit cap: returns `cap + 1` once the running
|
|
7
|
+
// minimum exceeds the cap so we can short-circuit the matcher in the common case
|
|
8
|
+
// where the typo is much further than 2 edits from any valid key. Used for the
|
|
9
|
+
// "did you mean?" suggestions on unknown property keys and wave ids.
|
|
10
|
+
export function levenshteinCapped(a, b, cap) {
|
|
11
|
+
if (a === b)
|
|
12
|
+
return 0;
|
|
13
|
+
const an = a.length;
|
|
14
|
+
const bn = b.length;
|
|
15
|
+
if (Math.abs(an - bn) > cap)
|
|
16
|
+
return cap + 1;
|
|
17
|
+
if (an === 0)
|
|
18
|
+
return bn;
|
|
19
|
+
if (bn === 0)
|
|
20
|
+
return an;
|
|
21
|
+
let prev = new Array(bn + 1);
|
|
22
|
+
let curr = new Array(bn + 1);
|
|
23
|
+
for (let j = 0; j <= bn; j++)
|
|
24
|
+
prev[j] = j;
|
|
25
|
+
for (let i = 1; i <= an; i++) {
|
|
26
|
+
curr[0] = i;
|
|
27
|
+
let rowMin = i;
|
|
28
|
+
for (let j = 1; j <= bn; j++) {
|
|
29
|
+
const cost = a.charCodeAt(i - 1) === b.charCodeAt(j - 1) ? 0 : 1;
|
|
30
|
+
curr[j] = Math.min(prev[j] + 1, // deletion
|
|
31
|
+
curr[j - 1] + 1, // insertion
|
|
32
|
+
prev[j - 1] + cost);
|
|
33
|
+
if (curr[j] < rowMin)
|
|
34
|
+
rowMin = curr[j];
|
|
35
|
+
}
|
|
36
|
+
if (rowMin > cap)
|
|
37
|
+
return cap + 1;
|
|
38
|
+
const tmp = prev;
|
|
39
|
+
prev = curr;
|
|
40
|
+
curr = tmp;
|
|
41
|
+
}
|
|
42
|
+
return prev[bn];
|
|
43
|
+
}
|
|
44
|
+
// Pick the closest known key within `cap` edits of `key`, or undefined. Ties are
|
|
45
|
+
// broken by the order of `candidates`, so callers should pass entity-specific keys
|
|
46
|
+
// first when both lists are searched.
|
|
47
|
+
export function suggestKey(key, candidates, cap = 2) {
|
|
48
|
+
let best;
|
|
49
|
+
let bestDist = cap + 1;
|
|
50
|
+
for (const c of candidates) {
|
|
51
|
+
const d = levenshteinCapped(key, c, cap);
|
|
52
|
+
if (d < bestDist) {
|
|
53
|
+
best = c;
|
|
54
|
+
bestDist = d;
|
|
55
|
+
if (d === 0)
|
|
56
|
+
break;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return best;
|
|
60
|
+
}
|
|
61
|
+
// Like `suggestKey`, but returns undefined when the best distance is shared by
|
|
62
|
+
// more than one candidate, so a suggestion is only made when it is unambiguous.
|
|
63
|
+
export function suggestUniqueKey(key, candidates, cap = 2) {
|
|
64
|
+
let best;
|
|
65
|
+
let bestDist = cap + 1;
|
|
66
|
+
let tied = false;
|
|
67
|
+
for (const c of candidates) {
|
|
68
|
+
const d = levenshteinCapped(key, c, cap);
|
|
69
|
+
if (d < bestDist) {
|
|
70
|
+
best = c;
|
|
71
|
+
bestDist = d;
|
|
72
|
+
tied = false;
|
|
73
|
+
}
|
|
74
|
+
else if (d === bestDist && d <= cap && c !== best) {
|
|
75
|
+
tied = true;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
return tied ? undefined : best;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* The name a diagnostic echoes for an entity: its id, else its title. A
|
|
82
|
+
* title can carry explicit line breaks, but a diagnostic is one line of
|
|
83
|
+
* text, so breaks collapse to a single space (`singleLine`).
|
|
84
|
+
*/
|
|
85
|
+
export function displayName(node) {
|
|
86
|
+
return node.name ?? (node.title === undefined ? '<unnamed>' : singleLine(node.title));
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Returns the lowercase entity-type label for an AST node, suitable for
|
|
90
|
+
* embedding inside a validator message (e.g. `"item"`, `"milestone"`,
|
|
91
|
+
* `"swimlane"`). Mirrors `describeNode`'s normalization (strip
|
|
92
|
+
* `Declaration` / `Block` suffix, lowercase) but returns just the type so
|
|
93
|
+
* callers can compose their own message.
|
|
94
|
+
*/
|
|
95
|
+
export function entityTypeLabel(node) {
|
|
96
|
+
// `NonWorkingDeclaration` would lowercase to `nonworking`; the keyword is hyphenated.
|
|
97
|
+
if (node.$type === 'NonWorkingDeclaration')
|
|
98
|
+
return 'non-working';
|
|
99
|
+
return node.$type.replace(/Declaration$|Block$/, '').toLowerCase();
|
|
100
|
+
}
|
|
101
|
+
export function describeNode(node) {
|
|
102
|
+
const kind = entityTypeLabel(node);
|
|
103
|
+
const label = node.name ?? (node.title === undefined ? undefined : singleLine(node.title));
|
|
104
|
+
return label ? `${kind} "${label}"` : kind;
|
|
105
|
+
}
|
|
106
|
+
/** 1-based source line of a node, or 0 when it has no CST node. */
|
|
107
|
+
export function lineOf(node) {
|
|
108
|
+
const cst = node.$cstNode;
|
|
109
|
+
return cst ? cst.range.start.line + 1 : 0;
|
|
110
|
+
}
|
|
111
|
+
// Defaults rule 23: the message for a property that cannot be set on a
|
|
112
|
+
// `default <entity>` line. Shared by `checkDefaultDeclaration` (static
|
|
113
|
+
// `DEFAULT_BANNED` table) and the wave rules (`wave` on a default line in a
|
|
114
|
+
// roadmap with waves), so both read the same.
|
|
115
|
+
export function defaultBannedMessage(key, entityType) {
|
|
116
|
+
return `"${key}" cannot be set on "default ${entityType}". Identity-defining, sizing, sequencing, reference, and prose properties must be explicit on each entity.`;
|
|
117
|
+
}
|
|
118
|
+
//# sourceMappingURL=validator-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validator-utils.js","sourceRoot":"","sources":["../../src/language/validator-utils.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,qEAAqE;AACrE,qEAAqE;AACrE,aAAa;AAGb,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpD,kFAAkF;AAClF,iFAAiF;AACjF,+EAA+E;AAC/E,qEAAqE;AACrE,MAAM,UAAU,iBAAiB,CAAC,CAAS,EAAE,CAAS,EAAE,GAAW;IAC/D,IAAI,CAAC,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IACtB,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC;IACpB,MAAM,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC;IACpB,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,GAAG;QAAE,OAAO,GAAG,GAAG,CAAC,CAAC;IAC5C,IAAI,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACxB,IAAI,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACxB,IAAI,IAAI,GAAG,IAAI,KAAK,CAAS,EAAE,GAAG,CAAC,CAAC,CAAC;IACrC,IAAI,IAAI,GAAG,IAAI,KAAK,CAAS,EAAE,GAAG,CAAC,CAAC,CAAC;IACrC,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE;QAAE,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;IAC1C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC;QAC3B,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC;QACZ,IAAI,MAAM,GAAG,CAAC,CAAC;QACf,KAAK,IAAI,C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C,OAAO,CAAC,qBAAqB,EAAE,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;AACvE,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,IAAsD;IAC/E,MAAM,IAAI,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IACnC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IAC3F,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,KAAK,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;AAC/C,CAAC;AAED,mEAAmE;AACnE,MAAM,UAAU,MAAM,CAAC,IAAa;IAChC,MAAM,GAAG,GAAG,IAAI,CAAC,QAAQ,CAAC;IAC1B,OAAO,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC9C,CAAC;AAED,uEAAuE;AACvE,uEAAuE;AACvE,4EAA4E;AAC5E,8CAA8C;AAC9C,MAAM,UAAU,oBAAoB,CAAC,GAAW,EAAE,UAAkB;IAChE,OAAO,IAAI,GAAG,+BAA+B,UAAU,4GAA4G,CAAC;AACxK,CAAC"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Built-in status vocabulary. `active` and `completed` are international-
|
|
3
|
+
* friendly aliases for `in-progress` and `done` respectively: they
|
|
4
|
+
* canonicalize at the layout boundary (see statusFromProp in layout.ts) so
|
|
5
|
+
* downstream consumers see a single normalized form. Both spellings remain
|
|
6
|
+
* valid input.
|
|
7
|
+
*/
|
|
8
|
+
export declare const BUILTIN_STATUSES: readonly string[];
|
|
9
|
+
/**
|
|
10
|
+
* Built-in `capacity-icon:` vocabulary. Renderer-curated SVG glyphs, plus
|
|
11
|
+
* `multiplier` (drawn as the U+00D7 text character) and `none` (suppresses
|
|
12
|
+
* the glyph).
|
|
13
|
+
*/
|
|
14
|
+
export declare const BUILTIN_CAPACITY_ICONS: readonly string[];
|
|
15
|
+
/**
|
|
16
|
+
* Built-in `icon:` vocabulary: the capacity-icon names plus the entity-
|
|
17
|
+
* decoration glyphs the renderer ships. `calendar` is the glyph the inline-
|
|
18
|
+
* date pin path (`after:DATE` / `before:DATE`) draws onto items, parallels
|
|
19
|
+
* and groups; reserving it keeps a `symbol calendar` declaration from
|
|
20
|
+
* shadowing it.
|
|
21
|
+
*/
|
|
22
|
+
export declare const BUILTIN_ICON_NAMES: readonly string[];
|
|
23
|
+
/**
|
|
24
|
+
* Values of the `non-working:` display key on `default roadmap`
|
|
25
|
+
* (specs/working-calendar.md §4.2), in documentation order.
|
|
26
|
+
*/
|
|
27
|
+
export declare const NON_WORKING_DISPLAYS: readonly ['hide', 'show'];
|
|
28
|
+
/** One of the `non-working:` display values. */
|
|
29
|
+
export type NonWorkingDisplay = (typeof NON_WORKING_DISPLAYS)[number];
|
|
30
|
+
/**
|
|
31
|
+
* Values of each enumerated style key (specs/dsl.md rule 19), in
|
|
32
|
+
* documentation order. `non-working:` is not here: it has its own table and
|
|
33
|
+
* its own error code. Colour keys (`bg`, `fg`, `text`) take `COLOR_NAMES` or
|
|
34
|
+
* a hex value instead.
|
|
35
|
+
*/
|
|
36
|
+
export declare const STYLE_PROP_ENUMS: Readonly<Record<string, readonly string[]>>;
|
|
37
|
+
/**
|
|
38
|
+
* Built-in colour vocabulary for `bg`, `fg` and `text`. `grey` and `violet`
|
|
39
|
+
* are international-friendly aliases for `gray` and `purple`: they
|
|
40
|
+
* canonicalize at the theme boundary (resolveColor in
|
|
41
|
+
* packages/layout/src/themes/index.ts) so themes don't grow new fields. Both
|
|
42
|
+
* spellings remain valid input.
|
|
43
|
+
*/
|
|
44
|
+
export declare const COLOR_NAMES: readonly string[];
|
|
45
|
+
/** Values of `calendar:` on the `roadmap` line. */
|
|
46
|
+
export declare const CALENDAR_MODES: readonly string[];
|
|
47
|
+
/** Values of `config:` and `roadmap:` on an `include` line. */
|
|
48
|
+
export declare const INCLUDE_MODES: readonly string[];
|
|
49
|
+
/**
|
|
50
|
+
* Keys a style block or `default` line may set (specs/dsl.md style table).
|
|
51
|
+
* The enumerated ones take `STYLE_PROP_ENUMS`; `bg`, `fg` and `text` take a
|
|
52
|
+
* colour.
|
|
53
|
+
*/
|
|
54
|
+
export declare const STYLE_PROP_KEYS: readonly string[];
|
|
55
|
+
/**
|
|
56
|
+
* Style keys only the roadmap reads (specs/dsl.md style table). On another
|
|
57
|
+
* entity's `default` line they are a silent no-op, so they warn (NL.W0703).
|
|
58
|
+
* Style blocks are not checked: one block can be referenced by the roadmap
|
|
59
|
+
* and by other entities alike, so the key there is not necessarily wrong.
|
|
60
|
+
*/
|
|
61
|
+
export declare const ROADMAP_ONLY_STYLE_KEYS: readonly string[];
|
|
62
|
+
/**
|
|
63
|
+
* `utilization-warn-at:` / `utilization-over-at:` accept the literal `none`
|
|
64
|
+
* to opt out of that color band (per specs/dsl.md rule 17d). Numeric forms
|
|
65
|
+
* (positive percent, decimal, integer) are validated separately.
|
|
66
|
+
*/
|
|
67
|
+
export declare const UTILIZATION_NONE = "none";
|
|
68
|
+
/** Keys of a `calendar` block. */
|
|
69
|
+
export declare const CALENDAR_FIELDS: readonly string[];
|
|
70
|
+
/** Keys of a `scale` block. */
|
|
71
|
+
export declare const SCALE_FIELDS: readonly string[];
|
|
72
|
+
/** Entity types a `default <entity>` line may name. */
|
|
73
|
+
export declare const DEFAULT_ENTITY_TYPES: readonly string[];
|
|
74
|
+
/**
|
|
75
|
+
* Properties every entity declaration may carry (`specs/dsl.md` § Universal
|
|
76
|
+
* Properties). `description` is technically a sub-directive (`description
|
|
77
|
+
* "text"` indented under the entity), not an EntityProperty, but we accept it
|
|
78
|
+
* here too: authors who type `description:"text"` as a property aren't doing
|
|
79
|
+
* anything meaningful, but the typo is common enough that warning on it adds
|
|
80
|
+
* noise rather than signal — the value is at least carried into the AST and
|
|
81
|
+
* could be surfaced later if we choose to.
|
|
82
|
+
*/
|
|
83
|
+
export declare const UNIVERSAL_ENTITY_PROPS: readonly string[];
|
|
84
|
+
/**
|
|
85
|
+
* Properties each entity declaration's `properties: EntityProperty[]` bag
|
|
86
|
+
* actually consumes downstream, keyed by the declaration's AST `$type`.
|
|
87
|
+
* Sourced from (a) the property tables in `specs/dsl.md` and (b) every
|
|
88
|
+
* `propValue(...)`/`propValues(...)` call site in `packages/layout/`. Keys
|
|
89
|
+
* outside this table + `UNIVERSAL_ENTITY_PROPS` are silently dropped by the
|
|
90
|
+
* layout — `checkUnknownEntityProperties` warns on them so authors notice
|
|
91
|
+
* typos like `now:2026-01-25` on a `roadmap` line.
|
|
92
|
+
*
|
|
93
|
+
* Raw style props (`bg`, `fg`, ...) intentionally stay OUT of this map — they
|
|
94
|
+
* are rejected as errors by `checkNoRawStyleProperties` and the unknown-
|
|
95
|
+
* property check short-circuits on them so authors don't see a duplicate
|
|
96
|
+
* diagnostic.
|
|
97
|
+
*/
|
|
98
|
+
export declare const ENTITY_KNOWN_PROPS: Readonly<Record<string, readonly string[]>>;
|
|
99
|
+
/**
|
|
100
|
+
* Allow-listed property keys on the `nowline` directive line. The directive
|
|
101
|
+
* existed historically as `nowline v1` only; properties are a forward-
|
|
102
|
+
* extension point but stay restrictive so authors get an early error instead
|
|
103
|
+
* of typos rendering silently.
|
|
104
|
+
*/
|
|
105
|
+
export declare const DIRECTIVE_FIELDS: readonly string[];
|
|
106
|
+
export { WEEKDAYS } from './calendar-declarations.js';
|
|
107
|
+
//# sourceMappingURL=value-tables.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"value-tables.d.ts","sourceRoot":"","sources":["../../src/language/value-tables.ts"],"names":[],"mappings":"AAMA;;;;;;GAMG;AACH,eAAO,MAAM,gBAAgB,EAAE,SAAS,MAAM,EAQ7C,CAAC;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