@serene-pub/sdk 0.6.0-pr-8 β 0.6.0-pr-9
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/announce.d.ts +36 -3
- package/dist/announce.js +59 -4
- package/dist/builder.d.ts +5 -7
- package/dist/cadences.d.ts +1 -3
- package/dist/componentWire.js +28 -0
- package/dist/conditions.d.ts +5 -1
- package/dist/conditions.js +7 -0
- package/dist/declarations.d.ts +63 -1
- package/dist/declarations.js +172 -7
- package/dist/descriptors.d.ts +86 -12
- package/dist/descriptors.js +83 -5
- package/dist/document.d.ts +1 -1
- package/dist/events.d.ts +68 -25
- package/dist/events.js +35 -2
- package/dist/executor.d.ts +27 -0
- package/dist/executor.js +6 -3
- package/dist/exposure.d.ts +35 -1
- package/dist/exposure.js +64 -2
- package/dist/extension.d.ts +13 -2
- package/dist/extension.js +3 -1
- package/dist/genres.d.ts +61 -3
- package/dist/genres.js +131 -10
- package/dist/hostElements.d.ts +3 -3
- package/dist/hostElements.js +12 -4
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/participants.d.ts +30 -0
- package/dist/provisos.d.ts +92 -0
- package/dist/provisos.js +273 -0
- package/dist/receiverRules.js +1 -1
- package/dist/registrations.d.ts +154 -14
- package/dist/registrations.js +293 -23
- package/dist/repertoires.d.ts +13 -1
- package/dist/repertoires.js +5 -1
- package/dist/rulesetDocument.d.ts +11 -0
- package/dist/rulesetDocument.js +17 -0
- package/dist/rulesetSections.d.ts +12 -0
- package/dist/rulesetSections.js +8 -0
- package/dist/rulesets.js +6 -0
- package/dist/sceneSettings.d.ts +3 -1
- package/dist/sceneSettings.js +3 -1
- package/dist/sessionDossier.d.ts +102 -2
- package/dist/sessionSettings.d.ts +18 -0
- package/dist/shapes.d.ts +9 -0
- package/dist/shapes.js +9 -0
- package/dist/speech.d.ts +14 -3
- package/dist/storyTime.d.ts +77 -1
- package/dist/storyTime.js +111 -4
- package/dist/surfaces.d.ts +38 -1
- package/dist/surfaces.js +3 -0
- package/dist/template.d.ts +13 -1
- package/dist/templateCheck.js +175 -12
- package/dist/templateFit.js +4 -1
- package/dist/validate.js +69 -0
- package/dist/variableLayouts.d.ts +19 -0
- package/dist/variableLayouts.js +19 -0
- package/dist/variables.d.ts +202 -13
- package/dist/variables.js +258 -32
- package/dist/widgets.d.ts +68 -9
- package/dist/widgets.js +10 -2
- package/host-elements.d.ts +4 -2
- package/package.json +1 -1
package/dist/variables.d.ts
CHANGED
|
@@ -247,13 +247,54 @@ export declare const varWorldLore: VariableDecl & {
|
|
|
247
247
|
};
|
|
248
248
|
};
|
|
249
249
|
};
|
|
250
|
+
/**
|
|
251
|
+
* π§ The date value every dated row and the current date carry (`StoryDateValue`).
|
|
252
|
+
* An object field constant, not a `VarType`. Names come only from the lorebook's
|
|
253
|
+
* calendar and are absent for a free-form book.
|
|
254
|
+
* @experimental
|
|
255
|
+
*/
|
|
256
|
+
export declare const STORY_DATE_FIELD: VarField;
|
|
257
|
+
/**
|
|
258
|
+
* π§ The date delta every dated row may carry (`StoryDateDelta`): the row's date
|
|
259
|
+
* minus the session's current date. An object field constant, not a `VarType`.
|
|
260
|
+
* @experimental
|
|
261
|
+
*/
|
|
262
|
+
export declare const STORY_DATE_DELTA_FIELD: VarField;
|
|
250
263
|
/** @experimental */
|
|
251
264
|
export declare const varHistory: VariableDecl & {
|
|
252
265
|
scope: {
|
|
253
266
|
history: {
|
|
254
|
-
type: "
|
|
267
|
+
type: "list";
|
|
255
268
|
of: {
|
|
256
|
-
type: "
|
|
269
|
+
type: "object";
|
|
270
|
+
fields: {
|
|
271
|
+
date: {
|
|
272
|
+
optional: true;
|
|
273
|
+
description: {
|
|
274
|
+
en: string;
|
|
275
|
+
};
|
|
276
|
+
type: import("./template.js").VarType;
|
|
277
|
+
fields?: Record<string, VarField>;
|
|
278
|
+
of?: VarField;
|
|
279
|
+
laidOutBy?: string;
|
|
280
|
+
};
|
|
281
|
+
dateDelta: {
|
|
282
|
+
optional: true;
|
|
283
|
+
description: {
|
|
284
|
+
en: string;
|
|
285
|
+
};
|
|
286
|
+
type: import("./template.js").VarType;
|
|
287
|
+
fields?: Record<string, VarField>;
|
|
288
|
+
of?: VarField;
|
|
289
|
+
laidOutBy?: string;
|
|
290
|
+
};
|
|
291
|
+
content: {
|
|
292
|
+
type: "string";
|
|
293
|
+
description: {
|
|
294
|
+
en: string;
|
|
295
|
+
};
|
|
296
|
+
};
|
|
297
|
+
};
|
|
257
298
|
};
|
|
258
299
|
};
|
|
259
300
|
};
|
|
@@ -278,6 +319,26 @@ export declare const varEarlierScenes: VariableDecl & {
|
|
|
278
319
|
en: string;
|
|
279
320
|
};
|
|
280
321
|
};
|
|
322
|
+
date: {
|
|
323
|
+
optional: true;
|
|
324
|
+
description: {
|
|
325
|
+
en: string;
|
|
326
|
+
};
|
|
327
|
+
type: import("./template.js").VarType;
|
|
328
|
+
fields?: Record<string, VarField>;
|
|
329
|
+
of?: VarField;
|
|
330
|
+
laidOutBy?: string;
|
|
331
|
+
};
|
|
332
|
+
dateDelta: {
|
|
333
|
+
optional: true;
|
|
334
|
+
description: {
|
|
335
|
+
en: string;
|
|
336
|
+
};
|
|
337
|
+
type: import("./template.js").VarType;
|
|
338
|
+
fields?: Record<string, VarField>;
|
|
339
|
+
of?: VarField;
|
|
340
|
+
laidOutBy?: string;
|
|
341
|
+
};
|
|
281
342
|
};
|
|
282
343
|
};
|
|
283
344
|
};
|
|
@@ -483,48 +544,176 @@ export declare const varRelationshipsKnown: VariableDecl & {
|
|
|
483
544
|
export declare const varCurrentDate: VariableDecl & {
|
|
484
545
|
scope: {
|
|
485
546
|
currentDate: {
|
|
547
|
+
description: {
|
|
548
|
+
en: string;
|
|
549
|
+
};
|
|
550
|
+
type: import("./template.js").VarType;
|
|
551
|
+
fields?: Record<string, VarField>;
|
|
552
|
+
of?: VarField;
|
|
553
|
+
optional?: boolean;
|
|
554
|
+
laidOutBy?: string;
|
|
555
|
+
};
|
|
556
|
+
};
|
|
557
|
+
};
|
|
558
|
+
/**
|
|
559
|
+
* π§ The session's lorebook calendar, for a template that wants to tell the
|
|
560
|
+
* model how the calendar runs. Absent for a free-form book. The day's periods
|
|
561
|
+
* and the seasons are not declared here: their labels are `I18n`, which a
|
|
562
|
+
* `VarField` cannot type.
|
|
563
|
+
* @experimental
|
|
564
|
+
*/
|
|
565
|
+
export declare const varStoryCalendar: VariableDecl & {
|
|
566
|
+
scope: {
|
|
567
|
+
storyCalendar: {
|
|
486
568
|
type: "object";
|
|
487
569
|
fields: {
|
|
488
|
-
|
|
489
|
-
type: "
|
|
570
|
+
months: {
|
|
571
|
+
type: "list";
|
|
490
572
|
description: {
|
|
491
573
|
en: string;
|
|
492
574
|
};
|
|
575
|
+
of: {
|
|
576
|
+
type: "object";
|
|
577
|
+
fields: {
|
|
578
|
+
name: {
|
|
579
|
+
type: "string";
|
|
580
|
+
description: {
|
|
581
|
+
en: string;
|
|
582
|
+
};
|
|
583
|
+
};
|
|
584
|
+
days: {
|
|
585
|
+
type: "number";
|
|
586
|
+
description: {
|
|
587
|
+
en: string;
|
|
588
|
+
};
|
|
589
|
+
};
|
|
590
|
+
};
|
|
591
|
+
};
|
|
493
592
|
};
|
|
494
|
-
|
|
495
|
-
type: "
|
|
593
|
+
weekdays: {
|
|
594
|
+
type: "list";
|
|
496
595
|
optional: true;
|
|
497
596
|
description: {
|
|
498
597
|
en: string;
|
|
499
598
|
};
|
|
599
|
+
of: {
|
|
600
|
+
type: "string";
|
|
601
|
+
};
|
|
500
602
|
};
|
|
501
|
-
|
|
603
|
+
firstWeekday: {
|
|
502
604
|
type: "number";
|
|
503
605
|
optional: true;
|
|
504
606
|
description: {
|
|
505
607
|
en: string;
|
|
506
608
|
};
|
|
507
609
|
};
|
|
508
|
-
|
|
509
|
-
type: "
|
|
610
|
+
yearLabel: {
|
|
611
|
+
type: "string";
|
|
510
612
|
optional: true;
|
|
511
613
|
description: {
|
|
512
614
|
en: string;
|
|
513
615
|
};
|
|
514
616
|
};
|
|
515
|
-
|
|
516
|
-
type: "
|
|
617
|
+
leap: {
|
|
618
|
+
type: "object";
|
|
517
619
|
optional: true;
|
|
518
620
|
description: {
|
|
519
621
|
en: string;
|
|
520
622
|
};
|
|
623
|
+
fields: {
|
|
624
|
+
every: {
|
|
625
|
+
type: "number";
|
|
626
|
+
description: {
|
|
627
|
+
en: string;
|
|
628
|
+
};
|
|
629
|
+
};
|
|
630
|
+
month: {
|
|
631
|
+
type: "number";
|
|
632
|
+
description: {
|
|
633
|
+
en: string;
|
|
634
|
+
};
|
|
635
|
+
};
|
|
636
|
+
skipEvery: {
|
|
637
|
+
type: "number";
|
|
638
|
+
optional: true;
|
|
639
|
+
description: {
|
|
640
|
+
en: string;
|
|
641
|
+
};
|
|
642
|
+
};
|
|
643
|
+
keepEvery: {
|
|
644
|
+
type: "number";
|
|
645
|
+
optional: true;
|
|
646
|
+
description: {
|
|
647
|
+
en: string;
|
|
648
|
+
};
|
|
649
|
+
};
|
|
650
|
+
more: {
|
|
651
|
+
type: "list";
|
|
652
|
+
optional: true;
|
|
653
|
+
description: {
|
|
654
|
+
en: string;
|
|
655
|
+
};
|
|
656
|
+
of: {
|
|
657
|
+
type: "number";
|
|
658
|
+
};
|
|
659
|
+
};
|
|
660
|
+
furtherLevels: {
|
|
661
|
+
type: "list";
|
|
662
|
+
optional: true;
|
|
663
|
+
description: {
|
|
664
|
+
en: string;
|
|
665
|
+
};
|
|
666
|
+
of: {
|
|
667
|
+
type: "object";
|
|
668
|
+
fields: {
|
|
669
|
+
every: {
|
|
670
|
+
type: "number";
|
|
671
|
+
description: {
|
|
672
|
+
en: string;
|
|
673
|
+
};
|
|
674
|
+
};
|
|
675
|
+
addsLeapDay: {
|
|
676
|
+
type: "boolean";
|
|
677
|
+
description: {
|
|
678
|
+
en: string;
|
|
679
|
+
};
|
|
680
|
+
};
|
|
681
|
+
};
|
|
682
|
+
};
|
|
683
|
+
};
|
|
684
|
+
};
|
|
521
685
|
};
|
|
522
|
-
|
|
523
|
-
type: "
|
|
686
|
+
eras: {
|
|
687
|
+
type: "list";
|
|
524
688
|
optional: true;
|
|
525
689
|
description: {
|
|
526
690
|
en: string;
|
|
527
691
|
};
|
|
692
|
+
of: {
|
|
693
|
+
type: "object";
|
|
694
|
+
fields: {
|
|
695
|
+
name: {
|
|
696
|
+
type: "string";
|
|
697
|
+
description: {
|
|
698
|
+
en: string;
|
|
699
|
+
};
|
|
700
|
+
};
|
|
701
|
+
start: {
|
|
702
|
+
type: "number";
|
|
703
|
+
optional: true;
|
|
704
|
+
description: {
|
|
705
|
+
en: string;
|
|
706
|
+
};
|
|
707
|
+
};
|
|
708
|
+
backwards: {
|
|
709
|
+
type: "boolean";
|
|
710
|
+
optional: true;
|
|
711
|
+
description: {
|
|
712
|
+
en: string;
|
|
713
|
+
};
|
|
714
|
+
};
|
|
715
|
+
};
|
|
716
|
+
};
|
|
528
717
|
};
|
|
529
718
|
};
|
|
530
719
|
};
|
package/dist/variables.js
CHANGED
|
@@ -384,6 +384,98 @@ export const varWorldLore = defineVariable({
|
|
|
384
384
|
'The Long Winter': 'Nine years without a thaw.',
|
|
385
385
|
},
|
|
386
386
|
});
|
|
387
|
+
const D = (en) => ({ en });
|
|
388
|
+
/**
|
|
389
|
+
* π§ The date value every dated row and the current date carry (`StoryDateValue`).
|
|
390
|
+
* An object field constant, not a `VarType`. Names come only from the lorebook's
|
|
391
|
+
* calendar and are absent for a free-form book.
|
|
392
|
+
* @experimental
|
|
393
|
+
*/
|
|
394
|
+
export const STORY_DATE_FIELD = {
|
|
395
|
+
type: 'object',
|
|
396
|
+
description: D('A story date: year, and month, day and time of day where the date has them.'),
|
|
397
|
+
fields: {
|
|
398
|
+
year: {
|
|
399
|
+
type: 'object',
|
|
400
|
+
description: D('The story year.'),
|
|
401
|
+
fields: {
|
|
402
|
+
number: { type: 'number', description: D('The year number.') },
|
|
403
|
+
name: {
|
|
404
|
+
type: 'string',
|
|
405
|
+
optional: true,
|
|
406
|
+
description: D('The year spelled in the calendarβs era (`Year 412 AR`); absent for a free-form book.'),
|
|
407
|
+
},
|
|
408
|
+
},
|
|
409
|
+
},
|
|
410
|
+
month: {
|
|
411
|
+
type: 'object',
|
|
412
|
+
optional: true,
|
|
413
|
+
description: D('The month; absent when the date is only to a year.'),
|
|
414
|
+
fields: {
|
|
415
|
+
number: { type: 'number', description: D('The month number, from 1.') },
|
|
416
|
+
name: {
|
|
417
|
+
type: 'string',
|
|
418
|
+
optional: true,
|
|
419
|
+
description: D('The calendarβs name for the month; absent for a free-form book.'),
|
|
420
|
+
},
|
|
421
|
+
},
|
|
422
|
+
},
|
|
423
|
+
day: {
|
|
424
|
+
type: 'object',
|
|
425
|
+
optional: true,
|
|
426
|
+
description: D('The day of the month; absent when the date is only to a month or a year.'),
|
|
427
|
+
fields: {
|
|
428
|
+
number: { type: 'number', description: D('The day number, from 1.') },
|
|
429
|
+
name: {
|
|
430
|
+
type: 'string',
|
|
431
|
+
optional: true,
|
|
432
|
+
description: D('The weekday name; absent when the calendar has no week or the book is free-form.'),
|
|
433
|
+
},
|
|
434
|
+
},
|
|
435
|
+
},
|
|
436
|
+
time: {
|
|
437
|
+
type: 'object',
|
|
438
|
+
optional: true,
|
|
439
|
+
description: D('The time of day; absent when the date has none.'),
|
|
440
|
+
fields: {
|
|
441
|
+
hour: { type: 'number', description: D('The hour, 0β23.') },
|
|
442
|
+
minute: { type: 'number', description: D('The minute, 0β59.') },
|
|
443
|
+
},
|
|
444
|
+
},
|
|
445
|
+
},
|
|
446
|
+
};
|
|
447
|
+
/**
|
|
448
|
+
* π§ The date delta every dated row may carry (`StoryDateDelta`): the row's date
|
|
449
|
+
* minus the session's current date. An object field constant, not a `VarType`.
|
|
450
|
+
* @experimental
|
|
451
|
+
*/
|
|
452
|
+
export const STORY_DATE_DELTA_FIELD = {
|
|
453
|
+
type: 'object',
|
|
454
|
+
description: D('How far the rowβs date is from the storyβs current date: row minus now.'),
|
|
455
|
+
fields: {
|
|
456
|
+
sign: { type: 'number', description: D('-1 when the row is before the current date, 1 after, 0 when equal.') },
|
|
457
|
+
year: { type: 'number', description: D('Whole years apart, never negative.') },
|
|
458
|
+
month: {
|
|
459
|
+
type: 'number',
|
|
460
|
+
optional: true,
|
|
461
|
+
description: D('Months apart; absent where months were not compared or cannot be known.'),
|
|
462
|
+
},
|
|
463
|
+
day: {
|
|
464
|
+
type: 'number',
|
|
465
|
+
optional: true,
|
|
466
|
+
description: D('Days apart; absent where days were not compared or cannot be known.'),
|
|
467
|
+
},
|
|
468
|
+
time: {
|
|
469
|
+
type: 'object',
|
|
470
|
+
optional: true,
|
|
471
|
+
description: D('Hours and minutes apart; absent when a time of day was not compared.'),
|
|
472
|
+
fields: {
|
|
473
|
+
hour: { type: 'number', description: D('Hours apart.') },
|
|
474
|
+
minute: { type: 'number', description: D('Minutes apart.') },
|
|
475
|
+
},
|
|
476
|
+
},
|
|
477
|
+
},
|
|
478
|
+
};
|
|
387
479
|
/** @experimental */
|
|
388
480
|
export const varHistory = defineVariable({
|
|
389
481
|
id: 'core:var/history@1',
|
|
@@ -392,13 +484,41 @@ export const varHistory = defineVariable({
|
|
|
392
484
|
// the chat so far, which is a different feature that does not exist here.
|
|
393
485
|
i18n: { name: { en: 'History entries' } },
|
|
394
486
|
description: {
|
|
395
|
-
en:
|
|
487
|
+
en: "Earlier events from the story that fit the budget, newest first, each with its date and its distance from the story's current date.",
|
|
396
488
|
},
|
|
397
|
-
scope: {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
489
|
+
scope: {
|
|
490
|
+
history: {
|
|
491
|
+
type: 'list',
|
|
492
|
+
of: {
|
|
493
|
+
type: 'object',
|
|
494
|
+
fields: {
|
|
495
|
+
date: {
|
|
496
|
+
...STORY_DATE_FIELD,
|
|
497
|
+
optional: true,
|
|
498
|
+
description: D('When the entry happened. History rows carry no time of day.'),
|
|
499
|
+
},
|
|
500
|
+
dateDelta: {
|
|
501
|
+
...STORY_DATE_DELTA_FIELD,
|
|
502
|
+
optional: true,
|
|
503
|
+
description: D('The entryβs distance from the storyβs current date. Absent with no current date set, with the Timeline off, or when the present is only the newest history entry.'),
|
|
504
|
+
},
|
|
505
|
+
content: { type: 'string', description: D('What happened.') },
|
|
506
|
+
},
|
|
507
|
+
},
|
|
508
|
+
},
|
|
401
509
|
},
|
|
510
|
+
sample: [
|
|
511
|
+
{
|
|
512
|
+
date: { year: { number: 412 }, month: { number: 3 }, day: null, time: null },
|
|
513
|
+
dateDelta: { sign: -1, year: 0, month: 2, day: null, time: null },
|
|
514
|
+
content: 'The caravan reached the wastes.',
|
|
515
|
+
},
|
|
516
|
+
{
|
|
517
|
+
date: { year: { number: 412 }, month: { number: 1 }, day: null, time: null },
|
|
518
|
+
dateDelta: null,
|
|
519
|
+
content: 'Ash left the Ashguard.',
|
|
520
|
+
},
|
|
521
|
+
],
|
|
402
522
|
});
|
|
403
523
|
// π§ Provisional. Not `history` (compiled, dated entries): these are the
|
|
404
524
|
// session's own scene summaries, oldest first, for scenes whose lines have left
|
|
@@ -418,6 +538,16 @@ export const varEarlierScenes = defineVariable({
|
|
|
418
538
|
fields: {
|
|
419
539
|
name: { type: 'string', description: { en: "The scene's name, as shown." } },
|
|
420
540
|
summary: { type: 'string', description: { en: "The scene's summary." } },
|
|
541
|
+
date: {
|
|
542
|
+
...STORY_DATE_FIELD,
|
|
543
|
+
optional: true,
|
|
544
|
+
description: D('The story clock, day and time when the scene opened; absent when it opened with no clock.'),
|
|
545
|
+
},
|
|
546
|
+
dateDelta: {
|
|
547
|
+
...STORY_DATE_DELTA_FIELD,
|
|
548
|
+
optional: true,
|
|
549
|
+
description: D('The sceneβs distance from the storyβs current date. Absent with no current date set, with the Timeline off, when the present is only the newest history entry, or when the scene has no date.'),
|
|
550
|
+
},
|
|
421
551
|
},
|
|
422
552
|
},
|
|
423
553
|
},
|
|
@@ -426,10 +556,14 @@ export const varEarlierScenes = defineVariable({
|
|
|
426
556
|
{
|
|
427
557
|
name: 'Scene 1 Β· The ferry',
|
|
428
558
|
summary: 'Ash and Rell crossed the river at dusk and lost the mule to the current.',
|
|
559
|
+
date: { year: { number: 412 }, month: { number: 3 }, day: { number: 2 }, time: { hour: 18, minute: 30 } },
|
|
560
|
+
dateDelta: { sign: -1, year: 0, month: 0, day: 3, time: { hour: 1, minute: 0 } },
|
|
429
561
|
},
|
|
430
562
|
{
|
|
431
563
|
name: 'Scene 2 Β· Greyford',
|
|
432
564
|
summary: 'In Greyford the reeve refused them lodging until Rell paid in salt.',
|
|
565
|
+
date: { year: { number: 412 }, month: { number: 3 }, day: { number: 4 }, time: { hour: 9, minute: 0 } },
|
|
566
|
+
dateDelta: { sign: -1, year: 0, month: 0, day: 1, time: { hour: 10, minute: 30 } },
|
|
433
567
|
},
|
|
434
568
|
],
|
|
435
569
|
});
|
|
@@ -689,54 +823,146 @@ export const varCurrentDate = defineVariable({
|
|
|
689
823
|
en: "The story's present date: the session's clock when it is set, else the present of the session's line, else the most recent history entry.",
|
|
690
824
|
},
|
|
691
825
|
/**
|
|
692
|
-
* β
|
|
693
|
-
* `
|
|
694
|
-
*
|
|
695
|
-
*
|
|
696
|
-
*
|
|
697
|
-
*
|
|
826
|
+
* β The value is the same date value every dated row carries
|
|
827
|
+
* (`StoryDateValue`), so a layout prints all of them one way. The calendar's
|
|
828
|
+
* spelling is reached through the `name` of each part; there are no
|
|
829
|
+
* pre-formatted fields. An earlier shape handed down a finished string and
|
|
830
|
+
* its sample disagreed with the prompt, which is the failure a sample exists
|
|
831
|
+
* to prevent.
|
|
698
832
|
*
|
|
699
|
-
*
|
|
700
|
-
*
|
|
701
|
-
*
|
|
702
|
-
*
|
|
833
|
+
* π§ It may be absent, so a template guards it (`{{#if currentDate}}`). The
|
|
834
|
+
* settings document's `timeline` (`SessionSettingsV1.timeline`) says whether
|
|
835
|
+
* the session's lorebook keeps a timeline, and promises no date either way:
|
|
836
|
+
* `true` with no story clock and no dated history entry on the line has
|
|
837
|
+
* none; with `false` it is always absent: on a lorebook that keeps no
|
|
838
|
+
* timeline, every story-time value a run can read is `null`, whatever is
|
|
839
|
+
* stored.
|
|
703
840
|
*/
|
|
704
841
|
scope: {
|
|
705
842
|
currentDate: {
|
|
843
|
+
...STORY_DATE_FIELD,
|
|
844
|
+
description: D('The storyβs present date.'),
|
|
845
|
+
},
|
|
846
|
+
},
|
|
847
|
+
sample: { year: { number: 412 }, month: { number: 3 }, day: { number: 5 }, time: null },
|
|
848
|
+
});
|
|
849
|
+
/**
|
|
850
|
+
* π§ The session's lorebook calendar, for a template that wants to tell the
|
|
851
|
+
* model how the calendar runs. Absent for a free-form book. The day's periods
|
|
852
|
+
* and the seasons are not declared here: their labels are `I18n`, which a
|
|
853
|
+
* `VarField` cannot type.
|
|
854
|
+
* @experimental
|
|
855
|
+
*/
|
|
856
|
+
export const varStoryCalendar = defineVariable({
|
|
857
|
+
id: 'core:var/story-calendar@1',
|
|
858
|
+
i18n: { name: { en: 'Story calendar' } },
|
|
859
|
+
description: {
|
|
860
|
+
en: "The session's lorebook calendar, for a template that wants to tell the model how the calendar runs; absent for a free-form book.",
|
|
861
|
+
},
|
|
862
|
+
scope: {
|
|
863
|
+
storyCalendar: {
|
|
706
864
|
type: 'object',
|
|
707
865
|
fields: {
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
866
|
+
months: {
|
|
867
|
+
type: 'list',
|
|
868
|
+
description: D('The months in order.'),
|
|
869
|
+
of: {
|
|
870
|
+
type: 'object',
|
|
871
|
+
fields: {
|
|
872
|
+
name: { type: 'string', description: D('The monthβs name.') },
|
|
873
|
+
days: { type: 'number', description: D('How many days it has.') },
|
|
874
|
+
},
|
|
875
|
+
},
|
|
876
|
+
},
|
|
877
|
+
weekdays: {
|
|
878
|
+
type: 'list',
|
|
711
879
|
optional: true,
|
|
712
|
-
description:
|
|
880
|
+
description: D('Weekday names in order; absent when the calendar has no week.'),
|
|
881
|
+
of: { type: 'string' },
|
|
713
882
|
},
|
|
714
|
-
|
|
883
|
+
firstWeekday: {
|
|
715
884
|
type: 'number',
|
|
716
885
|
optional: true,
|
|
717
|
-
description:
|
|
886
|
+
description: D('Which weekday (0-based) the first day of year 1 falls on.'),
|
|
718
887
|
},
|
|
719
|
-
|
|
720
|
-
type: '
|
|
888
|
+
yearLabel: {
|
|
889
|
+
type: 'string',
|
|
721
890
|
optional: true,
|
|
722
|
-
description:
|
|
891
|
+
description: D('The word before a year number.'),
|
|
723
892
|
},
|
|
724
|
-
|
|
725
|
-
type: '
|
|
893
|
+
leap: {
|
|
894
|
+
type: 'object',
|
|
726
895
|
optional: true,
|
|
727
|
-
description:
|
|
896
|
+
description: D('The leap rule: one extra day in one month.'),
|
|
897
|
+
fields: {
|
|
898
|
+
every: { type: 'number', description: D('Every this many years.') },
|
|
899
|
+
month: { type: 'number', description: D('The month that gains the day, from 1.') },
|
|
900
|
+
skipEvery: {
|
|
901
|
+
type: 'number',
|
|
902
|
+
optional: true,
|
|
903
|
+
description: D('Years divisible by this are not leap years, unless a later level says otherwise.'),
|
|
904
|
+
},
|
|
905
|
+
keepEvery: {
|
|
906
|
+
type: 'number',
|
|
907
|
+
optional: true,
|
|
908
|
+
description: D('Years divisible by this are leap years again.'),
|
|
909
|
+
},
|
|
910
|
+
more: {
|
|
911
|
+
type: 'list',
|
|
912
|
+
optional: true,
|
|
913
|
+
description: D('The further levels, in order, each a multiple of the one before.'),
|
|
914
|
+
of: { type: 'number' },
|
|
915
|
+
},
|
|
916
|
+
// π§ provisional field name and shape.
|
|
917
|
+
furtherLevels: {
|
|
918
|
+
type: 'list',
|
|
919
|
+
optional: true,
|
|
920
|
+
description: D('Every level after the first, in order: its years, and whether it adds the leap day back (true) or takes it away (false). Laid out by the host.'),
|
|
921
|
+
of: {
|
|
922
|
+
type: 'object',
|
|
923
|
+
fields: {
|
|
924
|
+
every: { type: 'number', description: D('Every this many years.') },
|
|
925
|
+
addsLeapDay: { type: 'boolean', description: D('True when it adds the leap day, false when it takes it away.') },
|
|
926
|
+
},
|
|
927
|
+
},
|
|
928
|
+
},
|
|
929
|
+
},
|
|
728
930
|
},
|
|
729
|
-
|
|
730
|
-
type: '
|
|
931
|
+
eras: {
|
|
932
|
+
type: 'list',
|
|
731
933
|
optional: true,
|
|
732
|
-
description:
|
|
733
|
-
|
|
934
|
+
description: D('The eras that spell the year count, in order.'),
|
|
935
|
+
of: {
|
|
936
|
+
type: 'object',
|
|
937
|
+
fields: {
|
|
938
|
+
name: { type: 'string', description: D('The eraβs name.') },
|
|
939
|
+
start: {
|
|
940
|
+
type: 'number',
|
|
941
|
+
optional: true,
|
|
942
|
+
description: D('The first year it spells; absent for the first era.'),
|
|
943
|
+
},
|
|
944
|
+
backwards: {
|
|
945
|
+
type: 'boolean',
|
|
946
|
+
optional: true,
|
|
947
|
+
description: D('True when its year numbers count down.'),
|
|
948
|
+
},
|
|
949
|
+
},
|
|
734
950
|
},
|
|
735
951
|
},
|
|
736
952
|
},
|
|
737
953
|
},
|
|
738
954
|
},
|
|
739
|
-
sample: {
|
|
955
|
+
sample: {
|
|
956
|
+
months: [
|
|
957
|
+
{ name: 'Frostmoot', days: 30 },
|
|
958
|
+
{ name: 'Seedfall', days: 30 },
|
|
959
|
+
{ name: 'Highsun', days: 31 },
|
|
960
|
+
],
|
|
961
|
+
weekdays: ['Moonday', 'Toilday', 'Restday'],
|
|
962
|
+
firstWeekday: 0,
|
|
963
|
+
yearLabel: 'Year',
|
|
964
|
+
eras: [{ name: 'AR', start: null }],
|
|
965
|
+
},
|
|
740
966
|
});
|
|
741
967
|
// ββ Samples βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
742
968
|
/**
|