@nowline/embed 0.5.0 → 0.6.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.
@@ -2,7 +2,24 @@ import { type ParseResult } from '@nowline/browser';
2
2
  import type { ThemeName } from '@nowline/layout';
3
3
  export interface EmbedRenderOptions {
4
4
  theme?: ThemeName;
5
- today?: Date;
5
+ /**
6
+ * "Today" override for the now-line.
7
+ *
8
+ * - `Date` — explicit UTC-midnight date; drawn as-is.
9
+ * - `string` — raw date string (YYYY-MM-DD or ISO 8601 instant with Z/offset).
10
+ * - `null` — suppress the now-line (mirrors `--now -`).
11
+ * - `undefined` — default to local today (or `timezone` if set).
12
+ *
13
+ * Previously accepted only `Date`; strings and null are new as of the
14
+ * timezone-aware now-line release.
15
+ */
16
+ today?: Date | string | null;
17
+ /**
18
+ * Timezone for the clock-based "today" default. Only consulted when
19
+ * `today` is `undefined`. Accepts `"local"` (default), `"UTC"`, ISO 8601
20
+ * offsets (`"Z"`, `"+05:30"`), or IANA names (`"America/Los_Angeles"`).
21
+ */
22
+ timezone?: string;
6
23
  locale?: string;
7
24
  width?: number;
8
25
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline.d.ts","sourceRoot":"","sources":["../src/pipeline.ts"],"names":[],"mappings":"AAcA,OAAO,EAMH,KAAK,WAAW,EACnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAIjD,MAAM,WAAW,kBAAkB;IAC/B,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,KAAK,CAAC,EAAE,IAAI,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC7B,GAAG,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;IACxB,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,MAAM,CAAC,CAyBjB;AAED,qBAAa,gBAAiB,SAAQ,KAAK;aAGnB,OAAO,EAAE,MAAM,EAAE;gBADjC,OAAO,EAAE,MAAM,EACC,OAAO,EAAE,MAAM,EAAE;CAKxC;AAKD,wBAAgB,4BAA4B,IAAI,IAAI,CAGnD"}
package/dist/pipeline.js CHANGED
@@ -30,6 +30,7 @@ export async function renderSource(source, options = {}) {
30
30
  filePath: EMBED_SOURCE_PATH,
31
31
  theme: options.theme,
32
32
  today: options.today,
33
+ timezone: options.timezone,
33
34
  locale: options.locale,
34
35
  width: options.width,
35
36
  idPrefix: options.idPrefix,
@@ -1 +1 @@
1
- {"version":3,"file":"pipeline.js","sourceRoot":"","sources":["../src/pipeline.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,uEAAuE;AACvE,oCAAoC;AACpC,EAAE;AACF,iEAAiE;AACjE,0EAA0E;AAC1E,mEAAmE;AACnE,sEAAsE;AACtE,aAAa;AACb,mEAAmE;AACnE,sEAAsE;AACtE,uEAAuE;AACvE,2CAA2C;AAE3C,OAAO,EACH,8BAA8B,EAE9B,WAAW,IAAI,kBAAkB,EACjC,YAAY,IAAI,mBAAmB,GAGtC,MAAM,kBAAkB,CAAC;AAG1B,MAAM,iBAAiB,GAAG,gBAAgB,CAAC;AAsB3C,IAAI,qBAAqB,GAAG,KAAK,CAAC;AAElC,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,MAAc;IAC5C,MAAM,EAAE,GAAG,EAAE,WAAW,EAAE,GAAG,MAAM,kBAAkB,CAAC,MAAM,EAAE;QAC1D,QAAQ,EAAE,iBAAiB;KAC9B,CAAC,CAAC;IACH,OAAO;QACH,GAAG;QACH,MAAM,EAAE,WAAW;aACd,MAAM,CAAC,CAAC,CAAgB,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC;aACpD,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;KAC7B,CA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Browser embed bundle for Nowline. Drop a <script> tag and ```nowline``` blocks render in place.",
5
5
  "license": "Apache-2.0",
6
6
  "engines": {
@@ -41,10 +41,10 @@
41
41
  "dependencies": {
42
42
  "fflate": "^0.8.3",
43
43
  "langium": "~4.2.4",
44
- "@nowline/browser": "0.5.0",
45
- "@nowline/core": "0.5.0",
46
- "@nowline/layout": "0.5.0",
47
- "@nowline/renderer": "0.5.0"
44
+ "@nowline/layout": "0.6.0",
45
+ "@nowline/core": "0.6.0",
46
+ "@nowline/browser": "0.6.0",
47
+ "@nowline/renderer": "0.6.0"
48
48
  },
49
49
  "devDependencies": {
50
50
  "@types/node": "^25.9.1",
package/src/auto-scan.ts CHANGED
@@ -12,7 +12,10 @@ export interface AutoScanInputs {
12
12
  theme?: ThemeName;
13
13
  locale?: string;
14
14
  width?: number;
15
- today?: Date;
15
+ /** See {@link EmbedRenderOptions.today} — accepts Date, string, null, or undefined. */
16
+ today?: Date | string | null;
17
+ /** See {@link EmbedRenderOptions.timezone}. */
18
+ timezone?: string;
16
19
  /**
17
20
  * Controls the "Share on Nowline" anchor appended after each rendered
18
21
  * SVG. Defaults to `true` when omitted (mirrors the config default).
@@ -68,6 +71,7 @@ export async function runAutoScan(inputs: AutoScanInputs): Promise<AutoScanResul
68
71
  locale: inputs.locale,
69
72
  width: inputs.width,
70
73
  today: inputs.today,
74
+ timezone: inputs.timezone,
71
75
  idPrefix,
72
76
  };
73
77
 
package/src/index.ts CHANGED
@@ -73,8 +73,18 @@ export interface InitializeOptions {
73
73
  locale?: string;
74
74
  /** Layout canvas width in pixels. Layout's default is 1280. */
75
75
  width?: number;
76
- /** Pin a `today` for deterministic snapshots; defaults to live `new Date()` per render. */
77
- today?: Date;
76
+ /**
77
+ * "Today" override for the now-line. Accepts a `Date`, a YYYY-MM-DD string,
78
+ * a full ISO 8601 instant (with Z or ±offset), or `null` to suppress the
79
+ * now-line. Defaults to the local civil date when omitted.
80
+ */
81
+ today?: Date | string | null;
82
+ /**
83
+ * Timezone for the clock-based "today" default. Only consulted when `today`
84
+ * is omitted. Accepts `"local"` (default), `"UTC"`, ISO 8601 offsets, or
85
+ * IANA timezone names (e.g. `"America/Los_Angeles"`).
86
+ */
87
+ timezone?: string;
78
88
  /**
79
89
  * Controls the "Share on Nowline" anchor appended after each rendered SVG.
80
90
  * - `true` (default) — link to the Free app open route
@@ -99,7 +109,8 @@ interface ResolvedConfig {
99
109
  selector: string;
100
110
  locale?: string;
101
111
  width?: number;
102
- today?: Date;
112
+ today?: Date | string | null;
113
+ timezone?: string;
103
114
  /** System theme captured at init; not reactive to OS theme flips mid-session. */
104
115
  systemTheme: 'light' | 'dark';
105
116
  /** Controls the "Share on Nowline" anchor. Defaults to `true`. */
@@ -126,7 +137,8 @@ export function initialize(options: InitializeOptions = {}): void {
126
137
  selector: options.selector ?? config.selector,
127
138
  locale: options.locale ?? config.locale,
128
139
  width: options.width ?? config.width,
129
- today: options.today ?? config.today,
140
+ today: options.today !== undefined ? options.today : config.today,
141
+ timezone: options.timezone ?? config.timezone,
130
142
  share: options.share ?? config.share,
131
143
  sourceUrl: options.sourceUrl ?? config.sourceUrl,
132
144
  // Re-read `prefers-color-scheme` on every initialize() so callers
@@ -144,6 +156,7 @@ function renderOptionsFromConfig(): EmbedRenderOptions {
144
156
  locale: config.locale,
145
157
  width: config.width,
146
158
  today: config.today,
159
+ timezone: config.timezone,
147
160
  };
148
161
  }
149
162
 
@@ -180,7 +193,8 @@ export async function init(overrides?: Partial<AutoScanInputs>): Promise<AutoSca
180
193
  theme: overrides?.theme ?? renderOptionsFromConfig().theme,
181
194
  locale: overrides?.locale ?? config.locale,
182
195
  width: overrides?.width ?? config.width,
183
- today: overrides?.today ?? config.today,
196
+ today: overrides?.today !== undefined ? overrides.today : config.today,
197
+ timezone: overrides?.timezone ?? config.timezone,
184
198
  share: overrides?.share ?? config.share,
185
199
  sourceUrl: overrides?.sourceUrl ?? config.sourceUrl,
186
200
  document: overrides?.document,
package/src/pipeline.ts CHANGED
@@ -26,7 +26,24 @@ const EMBED_SOURCE_PATH = '/embed.nowline';
26
26
 
27
27
  export interface EmbedRenderOptions {
28
28
  theme?: ThemeName;
29
- today?: Date;
29
+ /**
30
+ * "Today" override for the now-line.
31
+ *
32
+ * - `Date` — explicit UTC-midnight date; drawn as-is.
33
+ * - `string` — raw date string (YYYY-MM-DD or ISO 8601 instant with Z/offset).
34
+ * - `null` — suppress the now-line (mirrors `--now -`).
35
+ * - `undefined` — default to local today (or `timezone` if set).
36
+ *
37
+ * Previously accepted only `Date`; strings and null are new as of the
38
+ * timezone-aware now-line release.
39
+ */
40
+ today?: Date | string | null;
41
+ /**
42
+ * Timezone for the clock-based "today" default. Only consulted when
43
+ * `today` is `undefined`. Accepts `"local"` (default), `"UTC"`, ISO 8601
44
+ * offsets (`"Z"`, `"+05:30"`), or IANA names (`"America/Los_Angeles"`).
45
+ */
46
+ timezone?: string;
30
47
  locale?: string;
31
48
  width?: number;
32
49
  /**
@@ -66,6 +83,7 @@ export async function renderSource(
66
83
  filePath: EMBED_SOURCE_PATH,
67
84
  theme: options.theme,
68
85
  today: options.today,
86
+ timezone: options.timezone,
69
87
  locale: options.locale,
70
88
  width: options.width,
71
89
  idPrefix: options.idPrefix,