@istar-ts/core 0.15.0-beta.8 → 0.15.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/dist/index.d.cts CHANGED
@@ -173,6 +173,10 @@ export interface KindTextBox {
173
173
  readonly bottom: number;
174
174
  readonly left: number;
175
175
  }
176
+ /** piStar-ext's line kinds. */
177
+ export type LineDashKind = "continuous" | "dashed" | "dotted";
178
+ /** piStar-ext's line kinds, as SVG dash arrays (`KindLine.dash`); `continuous` has none. */
179
+ export declare const LINE_DASHES: Readonly<Record<LineDashKind, string | undefined>>;
176
180
  export interface KindLine {
177
181
  readonly dash?: string;
178
182
  readonly marker?: string | false;
@@ -202,6 +206,13 @@ export interface ElementKindDefinition<K extends string = string> {
202
206
  readonly role?: "hub";
203
207
  /** For a hub kind: the n-ary link kind it was generated for. */
204
208
  readonly of?: string;
209
+ /**
210
+ * What the kind means and when to use it, in 1-3 sentences: its definition, a hint for
211
+ * choosing it over a neighbouring kind, and (for built-in kinds) a cited source. Rendered by
212
+ * `@istar-ts/actions`' `metamodelContext` when present; optional so existing declarations and
213
+ * extensions keep compiling.
214
+ */
215
+ readonly description?: string;
205
216
  }
206
217
  /** The kinds generated for an n-ary link kind: its hub element kind, leg and end link kinds. */
207
218
  export interface HubLinkParts {
@@ -267,6 +278,8 @@ export interface LinkKindDefinition<K extends string = string> {
267
278
  readonly role?: "leg" | "end";
268
279
  /** For a generated kind: the n-ary link kind it was generated for. */
269
280
  readonly of?: string;
281
+ /** See `ElementKindDefinition.description`. */
282
+ readonly description?: string;
270
283
  }
271
284
  /**
272
285
  * How a root metamodel's files look, for models that don't come from a file (`createEmptyModel`)
@@ -332,6 +345,8 @@ export interface ElementKindDeclaration<K extends string = string> {
332
345
  /** Presentation hints, kept as data for renderers (`@istar-ts/react` draws them). */
333
346
  readonly shape?: KindShape;
334
347
  readonly textBox?: KindTextBox;
348
+ /** See `ElementKindDefinition.description`. */
349
+ readonly description?: string;
335
350
  }
336
351
  export interface LinkKindDeclaration<K extends string = string> {
337
352
  readonly kind: K;
@@ -364,6 +379,8 @@ export interface LinkKindDeclaration<K extends string = string> {
364
379
  readonly parts?: Partial<HubLinkParts>;
365
380
  /** The hub's size. Default 20×20, as in DSM3-goals. */
366
381
  readonly hubSize?: Size;
382
+ /** See `ElementKindDefinition.description`. */
383
+ readonly description?: string;
367
384
  }
368
385
  /** A whole modelling language, turned into a `Metamodel` by `defineMetamodel`. */
369
386
  export interface RootMetamodelDeclaration<EK extends string = string, LK extends string = string> {
package/dist/index.d.ts CHANGED
@@ -173,6 +173,10 @@ export interface KindTextBox {
173
173
  readonly bottom: number;
174
174
  readonly left: number;
175
175
  }
176
+ /** piStar-ext's line kinds. */
177
+ export type LineDashKind = "continuous" | "dashed" | "dotted";
178
+ /** piStar-ext's line kinds, as SVG dash arrays (`KindLine.dash`); `continuous` has none. */
179
+ export declare const LINE_DASHES: Readonly<Record<LineDashKind, string | undefined>>;
176
180
  export interface KindLine {
177
181
  readonly dash?: string;
178
182
  readonly marker?: string | false;
@@ -202,6 +206,13 @@ export interface ElementKindDefinition<K extends string = string> {
202
206
  readonly role?: "hub";
203
207
  /** For a hub kind: the n-ary link kind it was generated for. */
204
208
  readonly of?: string;
209
+ /**
210
+ * What the kind means and when to use it, in 1-3 sentences: its definition, a hint for
211
+ * choosing it over a neighbouring kind, and (for built-in kinds) a cited source. Rendered by
212
+ * `@istar-ts/actions`' `metamodelContext` when present; optional so existing declarations and
213
+ * extensions keep compiling.
214
+ */
215
+ readonly description?: string;
205
216
  }
206
217
  /** The kinds generated for an n-ary link kind: its hub element kind, leg and end link kinds. */
207
218
  export interface HubLinkParts {
@@ -267,6 +278,8 @@ export interface LinkKindDefinition<K extends string = string> {
267
278
  readonly role?: "leg" | "end";
268
279
  /** For a generated kind: the n-ary link kind it was generated for. */
269
280
  readonly of?: string;
281
+ /** See `ElementKindDefinition.description`. */
282
+ readonly description?: string;
270
283
  }
271
284
  /**
272
285
  * How a root metamodel's files look, for models that don't come from a file (`createEmptyModel`)
@@ -332,6 +345,8 @@ export interface ElementKindDeclaration<K extends string = string> {
332
345
  /** Presentation hints, kept as data for renderers (`@istar-ts/react` draws them). */
333
346
  readonly shape?: KindShape;
334
347
  readonly textBox?: KindTextBox;
348
+ /** See `ElementKindDefinition.description`. */
349
+ readonly description?: string;
335
350
  }
336
351
  export interface LinkKindDeclaration<K extends string = string> {
337
352
  readonly kind: K;
@@ -364,6 +379,8 @@ export interface LinkKindDeclaration<K extends string = string> {
364
379
  readonly parts?: Partial<HubLinkParts>;
365
380
  /** The hub's size. Default 20×20, as in DSM3-goals. */
366
381
  readonly hubSize?: Size;
382
+ /** See `ElementKindDefinition.description`. */
383
+ readonly description?: string;
367
384
  }
368
385
  /** A whole modelling language, turned into a `Metamodel` by `defineMetamodel`. */
369
386
  export interface RootMetamodelDeclaration<EK extends string = string, LK extends string = string> {
package/dist/index.js CHANGED
@@ -138,6 +138,12 @@ function shortKindName(kind) {
138
138
  }
139
139
  //#endregion
140
140
  //#region src/metamodels.ts
141
+ /** piStar-ext's line kinds, as SVG dash arrays (`KindLine.dash`); `continuous` has none. */
142
+ const LINE_DASHES = {
143
+ continuous: void 0,
144
+ dashed: "10,5",
145
+ dotted: "1,3"
146
+ };
141
147
  var MetamodelError = class extends Error {
142
148
  name = "MetamodelError";
143
149
  };
@@ -232,7 +238,8 @@ function addElementKind(table, declaration) {
232
238
  pistarType: type,
233
239
  ...table.extension !== void 0 ? { extension: table.extension } : {},
234
240
  ...declaration.shape ? { shape: declaration.shape } : {},
235
- ...declaration.textBox ? { textBox: declaration.textBox } : {}
241
+ ...declaration.textBox ? { textBox: declaration.textBox } : {},
242
+ ...declaration.description !== void 0 ? { description: declaration.description } : {}
236
243
  };
237
244
  table.elements.set(kind, definition);
238
245
  table.elementsByType.set(type, kind);
@@ -273,7 +280,8 @@ function addLinkKind(table, declaration) {
273
280
  ...declaration.check ? { check: declaration.check } : {},
274
281
  pistarType: type,
275
282
  ...table.extension !== void 0 ? { extension: table.extension } : {},
276
- ...declaration.line ? { line: declaration.line } : {}
283
+ ...declaration.line ? { line: declaration.line } : {},
284
+ ...declaration.description !== void 0 ? { description: declaration.description } : {}
277
285
  };
278
286
  if (declaration.arity !== "n") {
279
287
  table.links.set(kind, definition);
@@ -324,7 +332,8 @@ function addHubKinds(table, base, parts, hubSize) {
324
332
  ...owner,
325
333
  shape: HUB_SHAPE,
326
334
  role: "hub",
327
- of: base.kind
335
+ of: base.kind,
336
+ description: `The point where ${base.label}'s sources join on their way to its target, drawn as a small circle; not an intentional element in its own right.`
328
337
  });
329
338
  table.elementsByType.set(`${base.pistarType}Hub`, parts.hub);
330
339
  const common = {
@@ -346,7 +355,8 @@ function addHubKinds(table, base, parts, hubSize) {
346
355
  unique: "kind"
347
356
  },
348
357
  pistarType: `${base.pistarType}Start`,
349
- role: "leg"
358
+ role: "leg",
359
+ description: `One source's leg of a ${base.label} link, drawn from the source to the shared hub.`
350
360
  });
351
361
  table.linksByType.set(`${base.pistarType}Start`, parts.leg);
352
362
  claim(parts.end, `${base.pistarType}End`, "link");
@@ -364,7 +374,8 @@ function addHubKinds(table, base, parts, hubSize) {
364
374
  },
365
375
  pistarType: `${base.pistarType}End`,
366
376
  ...base.line ? { line: base.line } : {},
367
- role: "end"
377
+ role: "end",
378
+ description: `The ${base.label} link's hub-to-target leg, carrying the link's own meaning.`
368
379
  });
369
380
  table.linksByType.set(`${base.pistarType}End`, parts.end);
370
381
  }
@@ -412,12 +423,40 @@ const ISTAR_LINK_LABELS = {
412
423
  "istar.QualificationLink": "Qualification",
413
424
  "istar.ContributionLink": "Contribution"
414
425
  };
426
+ /**
427
+ * Base descriptions of iStar 2.0's kinds, written in our own words from the **iStar 2.0 Language
428
+ * Guide** (Dalpiaz, Franch & Horkoff, arXiv:1605.07767, 2016, CC BY 4.0): actors and intentional
429
+ * elements (§§2 and 4), actor links (§3), dependencies (§5) and intentional-element links (§6).
430
+ */
431
+ const ISTAR_ELEMENT_DESCRIPTIONS = {
432
+ "istar.Actor": "An intentional, autonomous entity that has strategic goals and exercises know-how to pursue them, alone or with other actors (iStar 2.0 Language Guide §2). Use plain Actor when neither Agent nor Role fits better.",
433
+ "istar.Agent": "An actor with a concrete, physical manifestation — a specific person, organisation or software system (iStar 2.0 Language Guide §2). Use it instead of Role for a named, identifiable participant rather than an abstract part anyone could play.",
434
+ "istar.Role": "An abstract characterisation of an actor's behaviour within some context, independent of who plays it (iStar 2.0 Language Guide §2). Use it instead of Agent when several concrete actors could fill the same part.",
435
+ "istar.Goal": "A state of affairs an actor wants achieved, with a clear-cut criterion for whether it is met (iStar 2.0 Language Guide §4). Unlike a Quality, a Goal is either achieved or not; unlike a Task, it says what to achieve, not how.",
436
+ "istar.Quality": "An attribute an actor wants some degree of, with no binary success criterion — it is satisficed rather than achieved outright (iStar 2.0 Language Guide §4). Use it instead of Goal for non-functional concerns (e.g. performance, usability) that admit degrees.",
437
+ "istar.Task": "A course of action an actor wants carried out, usually to achieve a Goal, satisfice a Quality, or produce or consume a Resource (iStar 2.0 Language Guide §4). Unlike a Goal, it specifies how, not just what.",
438
+ "istar.Resource": "A physical or informational entity an actor needs available to perform a Task (iStar 2.0 Language Guide §4). Its mere availability, not its satisfaction, is what matters — it has no intentional content of its own."
439
+ };
440
+ /**
441
+ * Base descriptions of iStar 2.0's link kinds (see `ISTAR_ELEMENT_DESCRIPTIONS` for the source).
442
+ */
443
+ const ISTAR_LINK_DESCRIPTIONS = {
444
+ "istar.IsALink": "Generalisation/specialisation between two actors of the same category — two Roles, or two general Actors (iStar 2.0 Language Guide §3): the specific actor inherits the general one's properties.",
445
+ "istar.ParticipatesInLink": "Any association between two actors other than generalisation/specialisation, e.g. an Agent playing a Role (iStar 2.0 Language Guide §3). Unlike Is-A, it places no restriction on the actors' categories.",
446
+ "istar.DependencyLink": "A social relationship in which a depender actor relies on a dependee actor for a dependum (a Goal, Quality, Task or Resource) it cannot, or prefers not to, provide for itself (iStar 2.0 Language Guide §5).",
447
+ "istar.AndRefinementLink": "Decomposes an intentional element into sub-elements that must *all* be satisfied for the parent to be satisfied (iStar 2.0 Language Guide §6.1). Contrast with Or-Refinement, where any one alternative suffices.",
448
+ "istar.OrRefinementLink": "Decomposes an intentional element into alternative sub-elements, any *one* of which satisfies the parent (iStar 2.0 Language Guide §6.1). Contrast with And-Refinement, which needs every child.",
449
+ "istar.NeededByLink": "Links a Task to the Resource it requires in order to be performed (iStar 2.0 Language Guide §6.2).",
450
+ "istar.QualificationLink": "Links a Quality to the Goal, Task or Resource it qualifies, expressing a desired attribute of that element's achievement, execution or provision (iStar 2.0 Language Guide §6.4).",
451
+ "istar.ContributionLink": "Expresses how satisfying one intentional element affects another, with a strength from 'make' (sufficient positive evidence) through 'help' (partial positive) and 'hurt' (partial negative) to 'break' (sufficient negative evidence) (iStar 2.0 Language Guide §6.3). Unlike a Refinement, it is a weaker, quantifiable influence rather than a decomposition."
452
+ };
415
453
  function istarLinks(kinds, category) {
416
454
  return kinds.map((kind) => ({
417
455
  kind,
418
456
  category,
419
457
  label: ISTAR_LINK_LABELS[kind],
420
- info: LINK_KIND_INFO[kind]
458
+ info: LINK_KIND_INFO[kind],
459
+ description: ISTAR_LINK_DESCRIPTIONS[kind]
421
460
  }));
422
461
  }
423
462
  /** iStar 2.0's declaration, built from the constants in `metamodel.ts`. */
@@ -427,12 +466,14 @@ const ISTAR_2_0_DECLARATION = {
427
466
  elements: [...ACTOR_KINDS.map((kind) => ({
428
467
  kind,
429
468
  category: "actor",
430
- size: DEFAULT_ELEMENT_SIZE[kind]
469
+ size: DEFAULT_ELEMENT_SIZE[kind],
470
+ description: ISTAR_ELEMENT_DESCRIPTIONS[kind]
431
471
  })), ...NODE_KINDS.map((kind) => ({
432
472
  kind,
433
473
  category: "node",
434
474
  size: DEFAULT_ELEMENT_SIZE[kind],
435
- info: NODE_KIND_INFO[kind]
475
+ info: NODE_KIND_INFO[kind],
476
+ description: ISTAR_ELEMENT_DESCRIPTIONS[kind]
436
477
  }))],
437
478
  links: [
438
479
  ...istarLinks(ACTOR_LINK_KINDS, "actor"),
@@ -1398,6 +1439,7 @@ function validateFileMetamodel(value, path = FILE_METAMODEL_KEY) {
1398
1439
  optionalString(entry, "label", at);
1399
1440
  optionalString(entry, "behavesLike", at);
1400
1441
  optionalString(entry, "pistarType", at);
1442
+ optionalString(entry, "description", at);
1401
1443
  if (kind === "element") {
1402
1444
  if (entry.category !== void 0 && entry.category !== "node" && entry.category !== "actor") fail(`${at}.category`, "must be \"node\" or \"actor\"");
1403
1445
  checkSize(entry.size, `${at}.size`);
@@ -3293,6 +3335,6 @@ function buildDefaultPalette() {
3293
3335
  /** The palette data of iStar 2.0, as piStar's toolbar presents it. */
3294
3336
  const DEFAULT_PALETTE = buildDefaultPalette();
3295
3337
  //#endregion
3296
- export { ACTOR_KINDS, ACTOR_LINK_KINDS, ACTOR_PADDING, CONTRIBUTION_LABELS, DEFAULT_DIAGRAM, DEFAULT_ELEMENT_SIZE, DEFAULT_PALETTE, DEPENDENCY_LINK_KINDS, DIAGNOSTIC_SEVERITIES, DIAGRAM_LAYOUT_KEY, DSM3_FILE_KEYS, DSM3_TOOL, ELEMENT_KINDS, FILE_METAMODEL_KEY, HUB_ENTRY_KEY, ISTAR_2_0, ISTAR_2_0_DECLARATION, ISTAR_PREFIX, ISTAR_VERSION, LINK_KINDS, LINK_KIND_INFO, LINK_SELECTOR, METAMODEL_VERSION, MetamodelError, ModelOperationError, NODE_KINDS, NODE_KIND_INFO, NODE_LINK_KINDS, PISTAR_TOOL, PistarParseError, PistarWriteError, SUGGEST_MARGIN, TOP_LEVEL_KEYS, actorBounds, addDependency, addElement, addLeg, boolean, canLink, childrenOf, compareSeverity, connect, connectResultToDiagnostic, createDiagnosticsStore, createEmptyModel, createModelStore, defaultHubPosition, defaultIdGenerator, defineMetamodel, defineMetamodelExtension, defineProperties, dependencyEnds, dependencyLinksOf, detectFramework, detectPrefix, disconnect, effectiveElementKind, effectiveLinkKind, elementBehavesLike, elementCenter, elementKindDefinition, enumOf, extendMetamodel, fileMetamodelExtension, fileMetamodelOf, fromLspDiagnostic, fromLspDiagnostics, fromNodeIdDiagnostic, fromNodeIdDiagnostics, getSourceLayout, groupDiagnostics, hostMetamodelOf, hubEntryLayoutKey, hubLinkOf, hubOfLink, inheritMetamodel, inheritSourceLayout, isActor, isActorIn, isActorKind, isActorKindIn, isActorLinkKind, isContributionLabel, isDependencyLinkKind, isElementKind, isHubElement, isLinkKind, isLinkRef, isNode, isNodeIn, isNodeKind, isNodeKindIn, isNodeLinkKind, linkBehavesLike, linkKindDefinition, linkTargetOf, linksOf, mergeDiagnostics, metamodelOf, moveElement, nestElement, number, parsePistar, prop, reference, removeElement, removeElements, removeLeg, setHostMetamodel, shortKindName, string, suggestPosition, targetsLinks, toPistar, toPistarObject, updateDiagram, updateElement, updateLink, validateFileMetamodel, validateModel, validateModelProperties, withFileMetamodel, withMetamodel, worstDiagnosticSeverity };
3338
+ export { ACTOR_KINDS, ACTOR_LINK_KINDS, ACTOR_PADDING, CONTRIBUTION_LABELS, DEFAULT_DIAGRAM, DEFAULT_ELEMENT_SIZE, DEFAULT_PALETTE, DEPENDENCY_LINK_KINDS, DIAGNOSTIC_SEVERITIES, DIAGRAM_LAYOUT_KEY, DSM3_FILE_KEYS, DSM3_TOOL, ELEMENT_KINDS, FILE_METAMODEL_KEY, HUB_ENTRY_KEY, ISTAR_2_0, ISTAR_2_0_DECLARATION, ISTAR_PREFIX, ISTAR_VERSION, LINE_DASHES, LINK_KINDS, LINK_KIND_INFO, LINK_SELECTOR, METAMODEL_VERSION, MetamodelError, ModelOperationError, NODE_KINDS, NODE_KIND_INFO, NODE_LINK_KINDS, PISTAR_TOOL, PistarParseError, PistarWriteError, SUGGEST_MARGIN, TOP_LEVEL_KEYS, actorBounds, addDependency, addElement, addLeg, boolean, canLink, childrenOf, compareSeverity, connect, connectResultToDiagnostic, createDiagnosticsStore, createEmptyModel, createModelStore, defaultHubPosition, defaultIdGenerator, defineMetamodel, defineMetamodelExtension, defineProperties, dependencyEnds, dependencyLinksOf, detectFramework, detectPrefix, disconnect, effectiveElementKind, effectiveLinkKind, elementBehavesLike, elementCenter, elementKindDefinition, enumOf, extendMetamodel, fileMetamodelExtension, fileMetamodelOf, fromLspDiagnostic, fromLspDiagnostics, fromNodeIdDiagnostic, fromNodeIdDiagnostics, getSourceLayout, groupDiagnostics, hostMetamodelOf, hubEntryLayoutKey, hubLinkOf, hubOfLink, inheritMetamodel, inheritSourceLayout, isActor, isActorIn, isActorKind, isActorKindIn, isActorLinkKind, isContributionLabel, isDependencyLinkKind, isElementKind, isHubElement, isLinkKind, isLinkRef, isNode, isNodeIn, isNodeKind, isNodeKindIn, isNodeLinkKind, linkBehavesLike, linkKindDefinition, linkTargetOf, linksOf, mergeDiagnostics, metamodelOf, moveElement, nestElement, number, parsePistar, prop, reference, removeElement, removeElements, removeLeg, setHostMetamodel, shortKindName, string, suggestPosition, targetsLinks, toPistar, toPistarObject, updateDiagram, updateElement, updateLink, validateFileMetamodel, validateModel, validateModelProperties, withFileMetamodel, withMetamodel, worstDiagnosticSeverity };
3297
3339
 
3298
3340
  //# sourceMappingURL=index.js.map