oasis-editor 0.0.389 → 0.0.390

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.
@@ -1,8 +1,14 @@
1
1
  import { PageNumberFormat } from '../model.js';
2
+ import { TemporalFormattingOptions } from '../format/temporalFieldFormat.js';
2
3
  import { FieldStorySpan } from './fieldStoryGraph.js';
3
4
  export type NumericFieldCommand = "PAGE" | "NUMPAGES" | "SECTION" | "SECTIONPAGES";
4
5
  export type ReferenceFieldCommand = "REF" | "PAGEREF";
6
+ export type TemporalFieldCommand = "DATE" | "TIME" | "CREATEDATE" | "SAVEDATE" | "PRINTDATE";
5
7
  export type EvaluatableField = {
8
+ type: TemporalFieldCommand;
9
+ temporal: true;
10
+ picture?: string;
11
+ } | {
6
12
  type: NumericFieldCommand;
7
13
  format?: PageNumberFormat;
8
14
  } | {
@@ -15,12 +21,15 @@ export type FieldDependency = {
15
21
  } | {
16
22
  kind: "bookmark-text" | "bookmark-page";
17
23
  name: string;
24
+ } | {
25
+ kind: "clock" | "created" | "saved" | "printed";
18
26
  };
19
27
  /** All numbers are the caller's one-based display values, not array indexes.
20
28
  * No DOM, clock, mutable editor state or layout service is consulted here.
21
29
  * An absent value is unresolved; a bookmark resolver may return null only
22
30
  * when it has positively established that the target does not exist. */
23
31
  export interface FieldEvaluationContext {
32
+ temporal?: TemporalFieldContext;
24
33
  pageNumber?: number;
25
34
  totalPages?: number;
26
35
  sectionNumber?: number;
@@ -28,6 +37,12 @@ export interface FieldEvaluationContext {
28
37
  bookmarkText?: (name: string) => string | null | undefined;
29
38
  bookmarkPage?: (name: string) => number | null | undefined;
30
39
  }
40
+ export interface TemporalFieldContext extends TemporalFormattingOptions {
41
+ now?: number;
42
+ created?: number;
43
+ saved?: number;
44
+ printed?: number;
45
+ }
31
46
  export type FieldEvaluation = {
32
47
  status: "resolved";
33
48
  text: string;
@@ -0,0 +1,6 @@
1
+ export declare function supportsTemporalPicture(picture: string): boolean;
2
+ export interface TemporalFormattingOptions {
3
+ locale?: "en-US" | "pt-BR";
4
+ timeZone?: string;
5
+ }
6
+ export declare function formatTemporalPicture(epochMs: number, picture: string, options?: TemporalFormattingOptions): string | undefined;