@rohal12/spindle 0.64.30 → 0.64.32

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.
@@ -131,7 +131,7 @@ function nameSpan(rawArgs: string): [number, number] {
131
131
  */
132
132
  export function widgetDefinitions(
133
133
  passages: Iterable<WidgetPassage>,
134
- parametersOf: ParametersOf = registeredParameters,
134
+ parametersOf: ParametersOf = registeredParameters(),
135
135
  ): WidgetDefinition[] {
136
136
  const list = [...passages];
137
137
  const scan = (replacesDo: boolean): WidgetDefinition[] => {
@@ -244,7 +244,7 @@ export function effectiveWidgetDefinitions(
244
244
  */
245
245
  export function effectiveWidgets(
246
246
  passages: Iterable<WidgetPassage>,
247
- parametersOf: ParametersOf = registeredParameters,
247
+ parametersOf: ParametersOf = registeredParameters(),
248
248
  ): WidgetDefinition[] {
249
249
  return effectiveWidgetDefinitions(widgetDefinitions(passages, parametersOf));
250
250
  }
@@ -252,7 +252,7 @@ export function effectiveWidgets(
252
252
  /** The names of the block widgets among the effectiveWidgets. */
253
253
  export function blockWidgetNames(
254
254
  passages: Iterable<WidgetPassage>,
255
- parametersOf: ParametersOf = registeredParameters,
255
+ parametersOf: ParametersOf = registeredParameters(),
256
256
  ): string[] {
257
257
  return effectiveWidgets(passages, parametersOf)
258
258
  .filter((def) => def.block)
@@ -315,6 +315,18 @@ export declare function findCodeEnd(
315
315
  options?: FindCodeEndOptions,
316
316
  ): number;
317
317
 
318
+ /**
319
+ * Reusable strict expression-boundary queries for one immutable source.
320
+ * The returned function matches `findCodeEnd(src, start)` (default options),
321
+ * with UTF-16 offsets into `src`. Query just after each `{` to prune
322
+ * unmatched plain-code prefixes without rescanning their suffixes. Results
323
+ * are cached per start; a failed outer query does not hide an inner span.
324
+ * There is no lenient markup recovery or custom `goal`/`stop` option.
325
+ */
326
+ export declare function indexStrictCodeEnds(
327
+ src: string,
328
+ ): (start: number) => number;
329
+
318
330
  /**
319
331
  * Scan the `"…"` or `'…'` string literal opening at `start`: `end` is just
320
332
  * past its closing quote, or `src.length` when unterminated (`closed` false).
@@ -854,13 +866,14 @@ export interface PieceBase {
854
866
  * For the code or text of a quoted string with escapes (a `\"`), whose
855
867
  * characters are not where `offset` plus their index says: the offset of
856
868
  * each character in the source, and of the end of the text, so that
857
- * `sourceOffsets[i]` is where character `i` of `code` or `text` is. Absent
869
+ * `sourceOffsets[i]` is where character `i` of `code`, `text` or a passage
870
+ * `name` is. The final entry maps the end boundary. Absent
858
871
  * when `offset + i` is (see {@link pieceOffset}).
859
872
  */
860
873
  sourceOffsets?: readonly number[];
861
874
  }
862
875
 
863
- /** Where character `index` of the code or text of `piece` is in the source. */
876
+ /** Where boundary `index` of a piece's code, text or name is in the source. */
864
877
  export declare function pieceOffset(piece: PieceBase, index: number): number;
865
878
 
866
879
  /**
@@ -889,6 +902,12 @@ export interface CodePiece extends PieceBase {
889
902
  export interface PassagePiece extends PieceBase {
890
903
  kind: 'passage';
891
904
  name: string;
905
+ /**
906
+ * Decoded name boundaries in the original source, including the end before
907
+ * closing quotes. Quotes/escapes do not change the whole-argument offset
908
+ * and length. Both UTF-16 units of a code-point escape map to its start.
909
+ */
910
+ sourceOffsets?: readonly number[];
892
911
  /** A known navigation target, rather than included/dialog content. */
893
912
  navigation?: true;
894
913
  /** The markup it is in, for an error: `[[Go->Hall]]`. */