openalgo-charts 2.7.2 → 2.7.4

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.
Files changed (51) hide show
  1. package/README.md +29 -29
  2. package/dist/draw/index.d.ts +109 -8
  3. package/dist/index.d.ts +122 -10
  4. package/dist/indicators/index.d.ts +10 -2
  5. package/dist/openalgo-charts.draw.mjs +1 -1
  6. package/dist/openalgo-charts.draw.mjs.map +1 -1
  7. package/dist/openalgo-charts.draw.standalone.js +1 -1
  8. package/dist/openalgo-charts.indicators.mjs +1 -1
  9. package/dist/openalgo-charts.indicators.mjs.map +1 -1
  10. package/dist/openalgo-charts.indicators.standalone.js +1 -1
  11. package/dist/openalgo-charts.mjs +1 -1
  12. package/dist/openalgo-charts.mjs.map +1 -1
  13. package/dist/openalgo-charts.profile.mjs +1 -1
  14. package/dist/openalgo-charts.profile.mjs.map +1 -1
  15. package/dist/openalgo-charts.profile.standalone.js +1 -1
  16. package/dist/openalgo-charts.standalone.js +1 -1
  17. package/dist/openalgo-charts.standalone.js.map +1 -1
  18. package/dist/openalgo-charts.trade.mjs +1 -1
  19. package/dist/openalgo-charts.trade.mjs.map +1 -1
  20. package/dist/openalgo-charts.trade.standalone.js +1 -1
  21. package/dist/openalgo-charts.transform.mjs +1 -1
  22. package/dist/openalgo-charts.transform.mjs.map +1 -1
  23. package/dist/openalgo-charts.transform.standalone.js +1 -1
  24. package/dist/{openalgo-charts.widget.chart-data-export-dialog-CX6h5-cp.mjs → openalgo-charts.widget.chart-data-export-dialog-we0VDywF.mjs} +2 -2
  25. package/dist/{openalgo-charts.widget.chart-data-export-dialog-CX6h5-cp.mjs.map → openalgo-charts.widget.chart-data-export-dialog-we0VDywF.mjs.map} +1 -1
  26. package/dist/{openalgo-charts.widget.chart-type-settings-Bu7g-LFB.mjs → openalgo-charts.widget.chart-type-settings-DYCCD4Ax.mjs} +2 -2
  27. package/dist/{openalgo-charts.widget.chart-type-settings-Bu7g-LFB.mjs.map → openalgo-charts.widget.chart-type-settings-DYCCD4Ax.mjs.map} +1 -1
  28. package/dist/openalgo-charts.widget.grid-bar-CWfujvFQ.mjs +2 -0
  29. package/dist/openalgo-charts.widget.grid-bar-CWfujvFQ.mjs.map +1 -0
  30. package/dist/{openalgo-charts.widget.grid-menus-CPZWEiD3.mjs → openalgo-charts.widget.grid-menus-Ujc8dpxO.mjs} +2 -2
  31. package/dist/{openalgo-charts.widget.grid-menus-CPZWEiD3.mjs.map → openalgo-charts.widget.grid-menus-Ujc8dpxO.mjs.map} +1 -1
  32. package/dist/{openalgo-charts.widget.layouts-templates-menu-CFf0bR9J.mjs → openalgo-charts.widget.layouts-templates-menu-DPPa9Cn1.mjs} +2 -2
  33. package/dist/{openalgo-charts.widget.layouts-templates-menu-CFf0bR9J.mjs.map → openalgo-charts.widget.layouts-templates-menu-DPPa9Cn1.mjs.map} +1 -1
  34. package/dist/openalgo-charts.widget.mjs +1 -1
  35. package/dist/openalgo-charts.widget.mjs.map +1 -1
  36. package/dist/openalgo-charts.widget.standalone.js +1 -1
  37. package/dist/openalgo-charts.widget.storage-idb-JzCQh1Se.mjs +2 -0
  38. package/dist/openalgo-charts.widget.storage-idb-JzCQh1Se.mjs.map +1 -0
  39. package/dist/openalgo-charts.workspace.mjs +1 -1
  40. package/dist/openalgo-charts.workspace.mjs.map +1 -1
  41. package/dist/openalgo-charts.workspace.standalone.js +1 -1
  42. package/dist/profile/index.d.ts +63 -59
  43. package/dist/trade/index.d.ts +69 -9
  44. package/dist/transform/index.d.ts +20 -4
  45. package/dist/widget/index.d.ts +156 -10
  46. package/dist/workspace/index.d.ts +22 -5
  47. package/package.json +1 -1
  48. package/dist/openalgo-charts.widget.grid-bar-Cm_CyA2j.mjs +0 -2
  49. package/dist/openalgo-charts.widget.grid-bar-Cm_CyA2j.mjs.map +0 -1
  50. package/dist/openalgo-charts.widget.storage-idb-WH_o01Wj.mjs +0 -2
  51. package/dist/openalgo-charts.widget.storage-idb-WH_o01Wj.mjs.map +0 -1
@@ -1,4 +1,4 @@
1
- import { ShortcutListItem, ChartTheme, SymbolMatch, Chart, SeriesApi, IndicatorInputPresentation, ChartSettingsInput, ChartObjects, AlertController, DataVariant, ChartSettingsValues, TradingCapabilitySource, TradingCapabilityRequest, ContextMenuEvent, IndicatorApi, ChartSettingsTabId, AlertSource, SessionPhase, SessionCalendarSource, ChartEvent, ChartEventDetails, EventMarkerDetails, QuoteFeed, InstrumentKey, NewsFeed, DataLoadingController, RestoreReport, ChartOptions, DataFeed, DataLoadingOptions, ResolvedLinkOptions, LinkOptions, QuoteSnapshot, NewsItem, Bar, IndicatorInputCondition, IndicatorInput, IndicatorSettings } from 'openalgo-charts';
1
+ import { ShortcutListItem, ChartTheme, SymbolMatch, Chart, SeriesApi, IndicatorInputPresentation, ChartSettingsInput, ChartObjects, AlertController, DataVariant, ChartSettingsValues, TradingCapabilitySource, TradingCapabilityRequest, ContextMenuEvent, IndicatorApi, ChartSettingsTabId, AlertSource, SessionPhase, SessionCalendarSource, DataSession, ChartEvent, ChartEventDetails, EventMarkerDetails, QuoteFeed, InstrumentKey, NewsFeed, DataLoadingController, RestoreReport, ChartOptions, DataFeed, DataLoadingOptions, ResolvedLinkOptions, LinkOptions, QuoteSnapshot, NewsItem, Bar, IndicatorInputCondition, IndicatorInput, IndicatorSettings } from 'openalgo-charts';
2
2
  export { SymbolMatch } from 'openalgo-charts';
3
3
  import { DrawingController, SettingsField, Drawing, MagnetMode, InstrumentDrawings, DrawingDocumentStore } from 'openalgo-charts/draw';
4
4
  import { DrawingTemplateStore, DrawingTemplateCatalog, DrawingTemplate, DrawingTemplateValues, WorkspaceStore, WorkspaceCatalog, WorkspaceDocument, WorkspacePayload, WatchlistStore, IndicatorTemplateInput, IndicatorTemplateDocument } from 'openalgo-charts/workspace';
@@ -19,6 +19,14 @@ interface StorageLike {
19
19
  interface AsyncStorageLike {
20
20
  /** Every stored key that starts with `prefix`, with its value. */
21
21
  entries(prefix: string): Promise<ReadonlyArray<readonly [key: string, value: string]>>;
22
+ /**
23
+ * What the store holds under one key now, or null. Optional: without it
24
+ * the widget reads that key through `entries`. The widget reads a key
25
+ * again just before it writes a value another tab may be changing too
26
+ * (each instrument's drawings), to merge its change into what is there.
27
+ * Since 2.7.3.
28
+ */
29
+ getItem?(key: string): Promise<string | null>;
22
30
  setItem(key: string, value: string): Promise<void>;
23
31
  removeItem(key: string): Promise<void>;
24
32
  /**
@@ -69,7 +77,9 @@ declare const STORAGE_PREFIX = "oac-widget:";
69
77
  * made before `load` settles waits for it and wins over the stored value,
70
78
  * because it is the newer of the two. A store that can say so (`subscribe`)
71
79
  * keeps the copy current with the writes other tabs land, as a synchronous
72
- * store's reads always were, until `close`.
80
+ * store's reads always were, until `close`. A name its owner merges
81
+ * (`mergeOnCommit`) is merged into what the store holds as it is written,
82
+ * rather than written over it.
73
83
  */
74
84
  declare class WidgetStorage {
75
85
  private readonly _store;
@@ -85,6 +95,23 @@ declare class WidgetStorage {
85
95
  private readonly _sending;
86
96
  /** Changes the store refused, sent again with the next change or flush. */
87
97
  private readonly _refused;
98
+ /**
99
+ * For each key with a change that has not landed, what the store held
100
+ * before it as far as this copy knows (null for nothing): the base a merge
101
+ * tells this copy's change from another writer's by, and what the journal
102
+ * records, so the next page can tell whether the store moved on since.
103
+ * Over a synchronous store, for a merged name, what this copy last read or
104
+ * wrote.
105
+ */
106
+ private readonly _base;
107
+ /**
108
+ * For a merged key with a change of this copy's out, what another writer
109
+ * landed meanwhile, which reads do not answer with: a change written at
110
+ * once as the page goes away is merged into it.
111
+ */
112
+ private readonly _theirs;
113
+ /** How many times each key was written at once since (`_leave`): a merged write waiting for its lock then writes nothing. */
114
+ private readonly _overtaken;
88
115
  private _loading;
89
116
  private _loaded;
90
117
  private _memoryOnly;
@@ -95,12 +122,20 @@ declare class WidgetStorage {
95
122
  private readonly _heard;
96
123
  private _unsubscribe;
97
124
  private _closed;
125
+ private readonly _listeners;
126
+ /** Stops hearing the page's storage events, over a synchronous store someone subscribed to. */
127
+ private _offPage;
98
128
  constructor(namespace: string, store: StorageLike | AsyncStorageLike | null, options?: WidgetStorageOptions);
99
129
  key(name: string): string;
100
130
  get(name: string): unknown;
101
131
  /** True when the write landed; over an asynchronous store, when it was taken to be sent. */
102
132
  set(name: string, value: unknown): boolean;
103
- remove(name: string): void;
133
+ /**
134
+ * True when the removal landed; over an asynchronous store, when it was
135
+ * taken to be sent. A refused removal reads as false, as a refused write
136
+ * does, so the caller can keep what it deleted rather than see it return.
137
+ */
138
+ remove(name: string): boolean;
104
139
  /** Whether writes can land at all. */
105
140
  get enabled(): boolean;
106
141
  /** Whether reads answer from what is stored: always over a synchronous store, once `load` has settled over an asynchronous one. */
@@ -118,12 +153,32 @@ declare class WidgetStorage {
118
153
  * destroyed; a copy nobody reads again need not follow the store.
119
154
  */
120
155
  close(): void;
156
+ /**
157
+ * Hear each change another user of the store makes to a key of this
158
+ * namespace, by the key's name, once reads answer with it, for a caller
159
+ * that keeps a state of its own read from the store: what the copy of an
160
+ * asynchronous store follows (`AsyncStorageLike.subscribe`), or the storage
161
+ * event the page fires when its own `localStorage` is the store. A key this
162
+ * copy has changed and not seen land is not heard, since its own value goes
163
+ * out after. Returns the call that stops listening; `close` stops every
164
+ * listener. Since 2.7.3.
165
+ */
166
+ subscribe(listener: (name: string) => void): () => void;
121
167
  /**
122
168
  * Send every change made so far now, and settle once each has landed or
123
- * failed. Before the sends it copies them to the store's journal, which is
124
- * what makes it the call for a page going away. Never rejects.
169
+ * failed. Before the sends it copies them to the store's journal, which
170
+ * keeps them for the next page when this one goes before they land. Never
171
+ * rejects. A merged name (`mergeOnCommit`) waits for its key's lock and a
172
+ * fresh read; the widget's own leaving sends everything at once instead.
125
173
  */
126
174
  flush(): Promise<void>;
175
+ /**
176
+ * `text` into a synchronous store: for a merged name another writer
177
+ * changed since this copy last read or wrote it, merged into what it holds,
178
+ * and then told as another writer's change is, so a caller that keeps a
179
+ * state of its own takes the other writer's part.
180
+ */
181
+ private _write;
127
182
  private _queue;
128
183
  private _requeue;
129
184
  private _read;
@@ -133,13 +188,65 @@ declare class WidgetStorage {
133
188
  * journal goes once everything it held has landed.
134
189
  */
135
190
  private _send;
191
+ /**
192
+ * Send one change, settling with the text written. A name another writer
193
+ * may change too (`mergeOnCommit`) is read again and this copy's change
194
+ * merged into what the store holds, holding the key's lock from the read
195
+ * to the write, so a second writer reads what the first wrote: two changes
196
+ * made before either landed both stay. Once the write has landed it is no
197
+ * longer out: another writer's heard from then on is the newer (`_hear`).
198
+ */
199
+ private _commit;
200
+ /** `text` of `key` has landed: no longer out, unless a newer change of it is (`_hear`). */
201
+ private _out;
202
+ /** The changes `batch` sent, settled: landed, or refused and kept to send again. */
203
+ private _settled;
204
+ /**
205
+ * Everything not landed, journaled, then written in this call (`flushLeaving`):
206
+ * a merged name into what another writer was heard to land meanwhile
207
+ * (`_theirs`), since there is no time to read the store again. A merged
208
+ * write still waiting for its lock then writes nothing, so an older value
209
+ * never lands over this one. Before the namespace is read nothing is sent,
210
+ * and the journal keeps it.
211
+ */
212
+ private _leave;
213
+ /**
214
+ * A change landed as `written`. With nothing newer to send, the key's base
215
+ * goes, and a merge that brought another writer's changes in is what reads
216
+ * answer from now, and is told as theirs is, unless a newer write another
217
+ * writer landed since has taken its place already.
218
+ */
219
+ private _landed;
220
+ private _mergeFor;
221
+ /**
222
+ * A journaled change the store moved past since the journal was written:
223
+ * the store already holds it, or another writer's newer value, which
224
+ * stays, or for a merged name both, merged. Undefined for nothing to replay.
225
+ */
226
+ private _replayOver;
136
227
  /**
137
228
  * A change another user of the store made, once it landed. A key this copy
138
229
  * has changed and not seen land keeps its own value: that write goes out
139
- * after, so it is the one the store keeps.
230
+ * after, so it is the one the store keeps, or for a merged name the one
231
+ * merged into it.
140
232
  */
141
233
  private _hear;
234
+ private _tell;
235
+ /**
236
+ * Each change with what the store may hold without another writer having
237
+ * moved it on (`was`), where this copy knows: what it held before, and each
238
+ * value of this copy's that is out. A journal whose writes landed, and that
239
+ * could be neither removed nor emptied after, is then not replayed over the
240
+ * newer values another writer stored since (`_replayOver`).
241
+ */
142
242
  private _writeJournal;
243
+ /**
244
+ * Everything the journal held has landed. One that cannot be removed is
245
+ * emptied instead: left whole, the next page would replay its values over
246
+ * every newer write that landed since. One that can be neither is tried
247
+ * again when the next send settles.
248
+ */
249
+ private _dropJournal;
143
250
  private _report;
144
251
  }
145
252
  /** The page's `localStorage` when it exists and works, else null. */
@@ -234,7 +341,7 @@ type ChartGridMessage = 'One chart' | 'Two columns' | 'Two rows' | 'Three column
234
341
  declare const CHART_GRID_LAYOUT_NAMES: Readonly<Record<ChartGridLayoutId, ChartGridMessage>>;
235
342
 
236
343
  /** English source keys keep fallback messages available without a locale bundle. */
237
- type WidgetBuiltinMessage = ChartGridMessage | "Add custom interval" | "Timeframes" | "Type" | "Add" | "Ticks" | "Seconds" | "Minutes" | "Hours" | "Days" | "Weeks" | "Months" | "Other intervals" | "Remove {code}" | "Add {code} to favorites" | "Remove {code} from favorites" | "The current source cannot build this interval" | "Only loaded rows are exported. Blank bounds include all loaded times." | "Study alignment" | "Source rows" | "Displayed rows" | "Use captured visible range" | "All loaded rows" | "Download CSV" | "The From bound must be before or equal to the To bound" | "Enable panning" | "Enable zooming" | "Go to" | "Go" | "Date" | "Range" | "From" | "To" | "Time" | "From time" | "To time" | "Showing {date}" | "Showing {from} to {to}" | "The range is wider than the chart. Showing {from} to {to}" | "History starts at {date}" | "The history limit stops at {date}" | "No older bars were found before {date}" | "Older history cannot load now. Showing from {date}" | "No bars at or after {date}" | "No bars between {from} and {to}" | "Go to needs a time-based interval" | "Enter a valid date" | "Could not load history: {error}" | "The end must not be before the start" | "Loading history" | "Times are in {zone}. A blank time is the start of the day, or its end for To." | "Dates are in {zone}." | "Charts" | "Chart {index}" | "Resize columns {first} and {second}" | "Resize rows {first} and {second}" | "Search" | "Enter a finite number" | "Minimum: {value}" | "Maximum: {value}" | "Use HHMM-HHMM with optional :days (1 to 7)" | "Depends on {inputs}" | "Not used with the current settings" | "Shown: {inputs}" | "Hidden: {inputs}" | "Available: {inputs}" | "Unavailable: {inputs}" | "{label} (UTC seconds)" | "Symbol search is not configured; enter an instrument manually" | "Finish or cancel the active drawing before picking" | "This host cannot suspend the settings dialog" | "Choose an explicit pane and scale for this price input" | "Pick on chart" | "Pick {label} on the chart" | "Pick point on chart" | "Pick {time} and {price} on the chart" | "Cancel pick" | "The value could not be picked" | "Add a study to the chart" | "Add level" | "Added {name}" | "Account" | "Accounts" | "Account: {name}" | "Analyzer" | "Available" | "Could not switch account: {error}" | "Equity" | "Loading account" | "Margin used" | "Stale" | "Alerts" | "Alerts are unavailable in this host" | "Alerts..." | "Active" | "Auto-fit to the data" | "Fit primary prices only" | "Collapse indicator legends" | "Collapse pane" | "Expand pane" | "Move pane up" | "Move pane down" | "at the top" | "at the bottom" | "price pane stays on top" | "Price pane" | "Axis settings..." | "Bar close" | "Bar close evaluates confirmed values. Intrabar touch can fire on a wick that is absent from final history." | "Behind the series" | "Bring to front" | "Buy limit at {price}" | "Buy market" | "Buy stop at {price}" | "C" | "Cancel" | "Candle condition" | "Candle condition is unavailable" | "Capture" | "Capture chart" | "Chart alerts" | "Chart branding" | "Chart controls" | "Chart copied" | "Chart data download started" | "Chart header" | "Chart menu" | "Chart objects" | "Chart settings" | "Chart toolbar" | "Chart type" | "Claimed by {name}" | "Click to switch the magnet off" | "Close" | "Color" | "Compare with" | "Copy drawing" | "Copy failed: {error}" | "Copy image" | "Copy {count} drawings" | "Could not change lock for {name}" | "Could not change visibility for {name}" | "Could not focus {name}" | "Could not load" | "{name} could not load: {error}" | "{name}: {error}" | "Event details" | "Events" | "Loading details..." | "No additional details." | "Unable to load additional details." | "Could not load older history" | "Could not load {symbol} {interval}" | "Could not load {symbol} {interval}: {error}" | "Could not open settings for {name}" | "Could not remove {name}" | "Could not save this alert" | "Could not select {name}" | "Create alert" | "Create alert at {price}..." | "Create drawing alert..." | "Create study alert..." | "Cursor" | "Custom" | "Cut drawing" | "Cut {count} drawings" | "Data export failed: {error}" | "Default level" | "Defaults" | "Delete" | "Delete drawing" | "Delete {count} drawings" | "Disable" | "Disable {name}" | "Disabled" | "Dismiss" | "Done" | "Download PNG" | "Download SVG" | "Download chart data (CSV)" | "Draw" | "Drawing" | "Drawing actions" | "Drawing level is unavailable" | "Drawing text" | "Drawing tools" | "Duplicate" | "Edit" | "Edit alert" | "Edit levels..." | "Edit text" | "Edit the expiry before enabling this alert" | "Enable" | "Enable {name}" | "Enabled" | "Enter a valid expiry date and time in UTC" | "Dark" | "Light" | "Enter an expiry date and time in UTC" | "Expires {time} UTC" | "Last fired {time} UTC" | "Symbol search results" | "That side is already in use" | "other side taken" | "Unlock drawing" | "Show drawing" | "Dark theme" | "Light theme" | "Stay: {mode}" | "Edit on chart" | "History is stale for {symbol} {interval}. Reload to retry." | "Magnet weak: snaps when O/H/L/C is within a few pixels" | "Magnet strong: every anchor lands on the nearest O/H/L/C" | "Click for weak: snaps when O/H/L/C is within a few pixels" | "Click for strong: every anchor lands on the nearest O/H/L/C" | "Ratio" | "Remove level" | "From (UTC seconds)" | "To (UTC seconds)" | "Enter finite UTC seconds or leave the bound blank" | "Enter an expiry date and time" | "Every match" | "Expired" | "Expires {time}" | "Expires" | "Finish" | "Fit all bars" | "Focus" | "Focus {name}" | "H" | "Hidden" | "Hide" | "Hide drawing" | "Hide drawing tools" | "Hide {name}" | "History is stale for {symbol} {interval}" | "History is stale. Refreshing {symbol} {interval}" | "History retention limit reached" | "In front of the series" | "Indicators" | "Indicators..." | "Input plot" | "Inputs" | "Interval" | "Interval {code}" | "Intrabar touch" | "Invert" | "Keep tool active" | "Keyboard shortcuts" | "L" | "Label" | "Last fired {time}" | "Level" | "Levels" | "Loading" | "Loading older history" | "Loading {symbol} {interval}" | "Regular hours" | "Extended hours" | "Adjusted prices" | "Raw prices" | "Not available from this source: {variant}" | "Lock" | "Lock drawing" | "Lock {name}" | "Locked" | "Magnet off" | "Magnet: {mode}" | "More" | "Move the scale closer to the plot" | "Move the scale further from the plot" | "Move the scale to the left" | "Move the scale to the right" | "No alerts. Create an alert for this chart." | "No bars for {symbol} {interval}" | "No data" | "No drawings to remove" | "No indicator on the chart to configure" | "No indicator to configure" | "No indicators are registered. Import the indicators tier to fill this list." | "No levels. Add one, or reset to the defaults." | "No match" | "No objects match your search." | "No objects on this chart." | "Nothing measured on this scale yet" | "Nothing to configure on this chart yet." | "Nothing to paste" | "O" | "OI" | "OK" | "Objects" | "Objects panel requires an object model" | "Off: one drawing per pick" | "On: the tool stays active after each drawing" | "Once" | "One drawing per pick" | "Open interest is unavailable for this instrument." | "Order" | "Order entry is locked by the host" | "Order entry is locked during replay" | "Order entry is unavailable" | "Order entry is unavailable: {reason}" | "Other" | "PNG, SVG, CSV or the clipboard" | "Pane {number}" | "Paste" | "Pick an indicator from the legend first" | "Pin price per bar" | "Pin to rail" | "Pinned. Right-click to unpin" | "Plot" | "Price" | "Price chart" | "Price {price}" | "Price {price} to {upper}" | "Properties" | "Properties of the selection..." | "Properties..." | "Redo" | "That step could not be undone: {error}" | "That step could not be redone: {error}" | "Refreshing {symbol} {interval}" | "Remove" | "Remove all drawings ({count})" | "Remove {name}" | "Removed {count} drawing" | "Removed {count} drawings" | "Reset" | "Restore defaults" | "Restore this tab" | "Retry" | "Retry chart data" | "Retry older history" | "Retry {name}" | "Right-click to remove all" | "Save" | "Saved a PNG of the chart" | "Saved an SVG of the chart" | "Scale" | "Search indicators" | "Search name, type or pane" | "Search objects" | "Searching" | "Select a drawing first" | "Select a drawing with levels first" | "Select a text drawing first" | "Select all ({count})" | "Select an input plot on the drawing pane" | "Select one first. Right-click to remove all" | "Select {name}" | "Selected" | "Selected drawing" | "Sell limit at {price}" | "Sell market" | "Sell stop at {price}" | "Send to back" | "Settings" | "Settings for {name}" | "Settings..." | "Show" | "Show drawing tools" | "Show labels" | "Show {name}" | "Source" | "Stays selected, so the eye brings it back" | "Studies" | "Study" | "Study instance is unavailable" | "Study plot is unavailable" | "Style" | "Switch to the dark theme" | "Switch to the light theme" | "Symbol" | "Symbols" | "Text" | "That indicator is no longer on the chart" | "That text is off the chart" | "The anchor changes only while the drawing's pane is on screen" | "The chart takes the space. The tab at its bottom left brings them back" | "The canvas produced no image" | "The chart changed; reopen Capture for its current source" | "The chart changed; reopen the menu before placing an order" | "The chart layout could not be saved" | "The chart layout could not be saved: {error}" | "The drawings for {instrument} could not be saved" | "The current plot value is unavailable. The alert waits for observed values." | "The indicator picker is not in this build" | "The instrument context changed. Reopen the editor for the intended instrument." | "The saved layout could not be restored: {error}" | "Saved chart settings could not be read, so changes are kept for this session only: {error}" | "Saved chart settings could not be written: {error}" | "The scale could not be moved" | "The settings dialog is not in this build" | "The study settings could not be applied" | "Theme" | "These drawings share no settings." | "This alert was removed" | "This runtime cannot save files" | "Tools" | "Tools stay active after each drawing" | "Trade" | "Triggered" | "Unavailable candle condition" | "Unavailable drawing" | "Unavailable study" | "Unavailable study output: {instanceId} / {plotKey}" | "Undo" | "Unlock" | "Unlock {name}" | "Unlocked" | "Unpin from rail" | "Unsupported" | "Visible" | "Vol" | "Wait for this chart to finish loading its data" | "locked" | "needs https or localhost" | "nothing measured" | "nothing on this side" | "object" | "off" | "on" | "on chart" | "on chart x{count}" | "one instance on the chart" | "paste it anywhere" | "protected" | "read-only" | "text stays text" | "{count} alert" | "{count} alerts" | "{count} bar" | "{count} bars" | "{count} drawings" | "{count} instances on the chart" | "{count} object" | "{count} objects" | "{group}: chevron for the rest" | "{group}: chevron for the rest. Double-click keeps it active" | "{name} / {plot}: {value}" | "{name} / {plot}: {value} to {upper}" | "{name} has nothing to configure" | "{name} settings" | "{name} settings are protected" | "{name} settings..." | "{name} stays active until Escape" | "{seconds}s cooldown" | "Drawing templates could not be loaded" | "The drawing template could not be saved: {error}" | "New {tool} drawings start with this look" | "New {tool} drawings start with the standard look" | "Saved the template {name}" | "Removed the template" | "Templates" | "Save as default for this tool" | "one tool at a time" | "Forget the default for this tool" | "Save as template..." | "Apply {name}" | "Save as template" | "Template name" | "Enter a name" | "Drawing toolbar" | "More drawing actions" | "{value} px" | "Line width" | "Line width: {value}" | "Line style" | "Line style: {style}" | "Dashed" | "Dotted" | "Solid" | "Color: {value}" | "mixed" | "Mixed" | "Enter a date and a time on the chart clock" | "Enter a price as a number" | "A logarithmic scale needs a price above zero" | "Point {number}" | "{field} of point {number}" | "Pinned to the screen: its anchors are not a time and a price." | "A freehand stroke has {count} points. Move it on the chart." | "Coordinates" | "Times are on the chart clock, {zone}." | "{shown} of {count} object" | "{shown} of {count} objects" | "{count} chart shortcut struck through: another shortcut uses the same chord here and takes precedence." | "{count} chart shortcuts struck through: another shortcut uses the same chord here and takes precedence." | "Change" | "Change {name}" | "Cancel changing {name}" | "Reset {name} to {chord}" | "Reset all" | "Put every shortcut back to its default?" | "Every shortcut is back to its default." | "Press keys" | "Press the new shortcut for {name}. Esc cancels." | "Not set" | "Replace" | "{chord} is used by {names}." | "Taken from {names}." | "{name} is now {chord}." | "{name} is back to {chord}." | "{chord} belongs to {names}, which cannot change. Press another." | "{chord} belongs to the browser. Press another." | "{chord} types into the chart. Add {mod} or {alt}." | "{chord} presses the focused control. Add {mod} or {alt}." | "That key cannot be used here. Press another." | "Nothing changed." | "unknown error" | "{name}, hidden" | "Level {level} enabled" | "Level {level} ratio" | "Level {level} color" | "Level {level} label" | "Remove level {level}" | "Search {label}" | "{name} (pinned)" | "Cancel order" | "Close position" | "Keep tool active: {mode}" | "Delete {name}" | "Magnet weak: snaps when a bar or study value is within a few pixels" | "Magnet strong: every anchor lands on the nearest bar or study value" | "Click for weak: snaps when a bar or study value is within a few pixels" | "Click for strong: every anchor lands on the nearest bar or study value" | "Armed" | "Keep tool armed" | "On: the tool stays armed after each drawing" | "Tools stay armed after each drawing" | "{group}: chevron for the rest. Double-click keeps it armed" | "{name} stays armed until Escape" | "{count} chart shortcut struck through: the same chord arms a drawing tool here and takes precedence." | "{count} chart shortcuts struck through: the same chord arms a drawing tool here and takes precedence.";
344
+ type WidgetBuiltinMessage = ChartGridMessage | "Add custom interval" | "Full screen" | "Leave full screen" | "The browser refused full screen" | "Move {name} to a new pane" | "Move {name} to the price pane" | "Bring {name} forward" | "Send {name} backward" | "{name} cannot move to that pane" | "Session" | "Regular hours only" | "With extended hours" | "Source default" | "Not offered for this interval" | "Timeframes" | "Type" | "Add" | "Ticks" | "Seconds" | "Minutes" | "Hours" | "Days" | "Weeks" | "Months" | "Other intervals" | "Remove {code}" | "Add {code} to favorites" | "Remove {code} from favorites" | "The current source cannot build this interval" | "Only loaded rows are exported. Blank bounds include all loaded times." | "Study alignment" | "Source rows" | "Displayed rows" | "Use captured visible range" | "All loaded rows" | "Download CSV" | "The From bound must be before or equal to the To bound" | "Enable panning" | "Enable zooming" | "Go to" | "Go" | "Date" | "Range" | "From" | "To" | "Time" | "From time" | "To time" | "Showing {date}" | "Showing {from} to {to}" | "The range is wider than the chart. Showing {from} to {to}" | "History starts at {date}" | "The history limit stops at {date}" | "No older bars were found before {date}" | "Older history cannot load now. Showing from {date}" | "No bars at or after {date}" | "No bars between {from} and {to}" | "Go to needs a time-based interval" | "Enter a valid date" | "Could not load history: {error}" | "The end must not be before the start" | "Loading history" | "Times are in {zone}. A blank time is the start of the day, or its end for To." | "Dates are in {zone}." | "Charts" | "Chart {index}" | "Resize columns {first} and {second}" | "Resize rows {first} and {second}" | "Search" | "Enter a finite number" | "Minimum: {value}" | "Maximum: {value}" | "Use HHMM-HHMM with optional :days (1 to 7)" | "Depends on {inputs}" | "Not used with the current settings" | "Shown: {inputs}" | "Hidden: {inputs}" | "Available: {inputs}" | "Unavailable: {inputs}" | "{label} (UTC seconds)" | "Symbol search is not configured; enter an instrument manually" | "Finish or cancel the active drawing before picking" | "This host cannot suspend the settings dialog" | "Choose an explicit pane and scale for this price input" | "Pick on chart" | "Pick {label} on the chart" | "Pick point on chart" | "Pick {time} and {price} on the chart" | "Cancel pick" | "The value could not be picked" | "Add a study to the chart" | "Add level" | "Added {name}" | "Account" | "Accounts" | "Account: {name}" | "Analyzer" | "Available" | "Could not switch account: {error}" | "Equity" | "Loading account" | "Margin used" | "Stale" | "Alerts" | "Alerts are unavailable in this host" | "Alerts..." | "Active" | "Auto-fit to the data" | "Fit primary prices only" | "Collapse indicator legends" | "Collapse pane" | "Expand pane" | "Move pane up" | "Move pane down" | "at the top" | "at the bottom" | "price pane stays on top" | "Price pane" | "Axis settings..." | "Bar close" | "Bar close evaluates confirmed values. Intrabar touch can fire on a wick that is absent from final history." | "Behind the series" | "Bring to front" | "Buy limit at {price}" | "Buy market" | "Buy stop at {price}" | "C" | "Cancel" | "Candle condition" | "Candle condition is unavailable" | "Capture" | "Capture chart" | "Chart alerts" | "Chart branding" | "Chart controls" | "Chart copied" | "Chart data download started" | "Chart header" | "Chart menu" | "Chart objects" | "Chart settings" | "Chart toolbar" | "Chart type" | "Claimed by {name}" | "Click to switch the magnet off" | "Close" | "Color" | "Compare with" | "Copy drawing" | "Copy failed: {error}" | "Copy image" | "Copy {count} drawings" | "Could not change lock for {name}" | "Could not change visibility for {name}" | "Could not focus {name}" | "Could not load" | "{name} could not load: {error}" | "{name}: {error}" | "Event details" | "Events" | "Loading details..." | "No additional details." | "Unable to load additional details." | "Could not load older history" | "Could not load {symbol} {interval}" | "Could not load {symbol} {interval}: {error}" | "Could not open settings for {name}" | "Could not remove {name}" | "Could not save this alert" | "Could not select {name}" | "Create alert" | "Create alert at {price}..." | "Create drawing alert..." | "Create study alert..." | "Cursor" | "Custom" | "Cut drawing" | "Cut {count} drawings" | "Data export failed: {error}" | "Default level" | "Defaults" | "Delete" | "Delete drawing" | "Delete {count} drawings" | "Disable" | "Disable {name}" | "Disabled" | "Dismiss" | "Done" | "Download PNG" | "Download SVG" | "Download chart data (CSV)" | "Draw" | "Drawing" | "Drawing actions" | "Drawing level is unavailable" | "Drawing text" | "Drawing tools" | "Duplicate" | "Edit" | "Edit alert" | "Edit levels..." | "Edit text" | "Edit the expiry before enabling this alert" | "Enable" | "Enable {name}" | "Enabled" | "Enter a valid expiry date and time in UTC" | "Dark" | "Light" | "Enter an expiry date and time in UTC" | "Expires {time} UTC" | "Last fired {time} UTC" | "Symbol search results" | "That side is already in use" | "other side taken" | "Unlock drawing" | "Show drawing" | "Dark theme" | "Light theme" | "Stay: {mode}" | "Edit on chart" | "History is stale for {symbol} {interval}. Reload to retry." | "Magnet weak: snaps when O/H/L/C is within a few pixels" | "Magnet strong: every anchor lands on the nearest O/H/L/C" | "Click for weak: snaps when O/H/L/C is within a few pixels" | "Click for strong: every anchor lands on the nearest O/H/L/C" | "Ratio" | "Remove level" | "From (UTC seconds)" | "To (UTC seconds)" | "Enter finite UTC seconds or leave the bound blank" | "Enter an expiry date and time" | "Every match" | "Expired" | "Expires {time}" | "Expires" | "Finish" | "Fit all bars" | "Focus" | "Focus {name}" | "H" | "Hidden" | "Hide" | "Hide drawing" | "Hide drawing tools" | "Hide {name}" | "History is stale for {symbol} {interval}" | "History is stale. Refreshing {symbol} {interval}" | "History retention limit reached" | "In front of the series" | "Indicators" | "Indicators..." | "Input plot" | "Inputs" | "Interval" | "Interval {code}" | "Intrabar touch" | "Invert" | "Keep tool active" | "Keyboard shortcuts" | "L" | "Label" | "Last fired {time}" | "Level" | "Levels" | "Loading" | "Loading older history" | "Loading {symbol} {interval}" | "Regular hours" | "Extended hours" | "Adjusted prices" | "Raw prices" | "Not available from this source: {variant}" | "Lock" | "Lock drawing" | "Lock {name}" | "Locked" | "Magnet off" | "Magnet: {mode}" | "More" | "Move the scale closer to the plot" | "Move the scale further from the plot" | "Move the scale to the left" | "Move the scale to the right" | "No alerts. Create an alert for this chart." | "No bars for {symbol} {interval}" | "No data" | "No drawings to remove" | "No indicator on the chart to configure" | "No indicator to configure" | "No indicators are registered. Import the indicators tier to fill this list." | "No levels. Add one, or reset to the defaults." | "No match" | "No objects match your search." | "No objects on this chart." | "Nothing measured on this scale yet" | "Nothing to configure on this chart yet." | "Nothing to paste" | "O" | "OI" | "OK" | "Objects" | "Objects panel requires an object model" | "Off: one drawing per pick" | "On: the tool stays active after each drawing" | "Once" | "One drawing per pick" | "Open interest is unavailable for this instrument." | "Order" | "Order entry is locked by the host" | "Order entry is locked during replay" | "Order entry is unavailable" | "Order entry is unavailable: {reason}" | "Other" | "PNG, SVG, CSV or the clipboard" | "Pane {number}" | "Paste" | "Pick an indicator from the legend first" | "Pin price per bar" | "Pin to rail" | "Pinned. Right-click to unpin" | "Plot" | "Price" | "Price chart" | "Price {price}" | "Price {price} to {upper}" | "Properties" | "Properties of the selection..." | "Properties..." | "Redo" | "That step could not be undone: {error}" | "That step could not be redone: {error}" | "Refreshing {symbol} {interval}" | "Remove" | "Remove all drawings ({count})" | "Remove {name}" | "Removed {count} drawing" | "Removed {count} drawings" | "Reset" | "Restore defaults" | "Restore this tab" | "Retry" | "Retry chart data" | "Retry older history" | "Retry {name}" | "Right-click to remove all" | "Save" | "Saved a PNG of the chart" | "Saved an SVG of the chart" | "Scale" | "Search indicators" | "Search name, type or pane" | "Search objects" | "Searching" | "Select a drawing first" | "Select a drawing with levels first" | "Select a text drawing first" | "Select all ({count})" | "Select an input plot on the drawing pane" | "Select one first. Right-click to remove all" | "Select {name}" | "Selected" | "Selected drawing" | "Sell limit at {price}" | "Sell market" | "Sell stop at {price}" | "Send to back" | "Settings" | "Settings for {name}" | "Settings..." | "Show" | "Show drawing tools" | "Show labels" | "Show {name}" | "Source" | "Stays selected, so the eye brings it back" | "Studies" | "Study" | "Study instance is unavailable" | "Study plot is unavailable" | "Style" | "Switch to the dark theme" | "Switch to the light theme" | "Symbol" | "Symbols" | "Text" | "That indicator is no longer on the chart" | "That text is off the chart" | "The anchor changes only while the drawing's pane is on screen" | "The chart takes the space. The tab at its bottom left brings them back" | "The canvas produced no image" | "The chart changed; reopen Capture for its current source" | "The chart changed; reopen the menu before placing an order" | "The chart layout could not be saved" | "The chart layout could not be saved: {error}" | "The drawings for {instrument} could not be saved" | "The current plot value is unavailable. The alert waits for observed values." | "The indicator picker is not in this build" | "The instrument context changed. Reopen the editor for the intended instrument." | "The saved layout could not be restored: {error}" | "Saved chart settings could not be read, so changes are kept for this session only: {error}" | "Saved chart settings could not be written: {error}" | "The scale could not be moved" | "The settings dialog is not in this build" | "The study settings could not be applied" | "Theme" | "These drawings share no settings." | "This alert was removed" | "This runtime cannot save files" | "Tools" | "Tools stay active after each drawing" | "Trade" | "Triggered" | "Unavailable candle condition" | "Unavailable drawing" | "Unavailable study" | "Unavailable study output: {instanceId} / {plotKey}" | "Undo" | "Unlock" | "Unlock {name}" | "Unlocked" | "Unpin from rail" | "Unsupported" | "Visible" | "Vol" | "Wait for this chart to finish loading its data" | "locked" | "needs https or localhost" | "nothing measured" | "nothing on this side" | "object" | "off" | "on" | "on chart" | "on chart x{count}" | "one instance on the chart" | "paste it anywhere" | "protected" | "read-only" | "text stays text" | "{count} alert" | "{count} alerts" | "{count} bar" | "{count} bars" | "{count} drawings" | "{count} instances on the chart" | "{count} object" | "{count} objects" | "{group}: chevron for the rest" | "{group}: chevron for the rest. Double-click keeps it active" | "{name} / {plot}: {value}" | "{name} / {plot}: {value} to {upper}" | "{name} has nothing to configure" | "{name} settings" | "{name} settings are protected" | "{name} settings..." | "{name} stays active until Escape" | "{seconds}s cooldown" | "Drawing templates could not be loaded" | "The drawing template could not be saved: {error}" | "New {tool} drawings start with this look" | "New {tool} drawings start with the standard look" | "Saved the template {name}" | "Removed the template" | "Templates" | "Save as default for this tool" | "one tool at a time" | "Forget the default for this tool" | "Save as template..." | "Apply {name}" | "Save as template" | "Template name" | "Enter a name" | "Drawing toolbar" | "More drawing actions" | "{value} px" | "Line width" | "Line width: {value}" | "Line style" | "Line style: {style}" | "Dashed" | "Dotted" | "Solid" | "Color: {value}" | "mixed" | "Mixed" | "Enter a date and a time on the chart clock" | "Enter a price as a number" | "A logarithmic scale needs a price above zero" | "Point {number}" | "{field} of point {number}" | "Pinned to the screen: its anchors are not a time and a price." | "A freehand stroke has {count} points. Move it on the chart." | "Coordinates" | "Times are on the chart clock, {zone}." | "{shown} of {count} object" | "{shown} of {count} objects" | "{count} chart shortcut struck through: another shortcut uses the same chord here and takes precedence." | "{count} chart shortcuts struck through: another shortcut uses the same chord here and takes precedence." | "Change" | "Change {name}" | "Cancel changing {name}" | "Reset {name} to {chord}" | "Reset all" | "Put every shortcut back to its default?" | "Every shortcut is back to its default." | "Press keys" | "Press the new shortcut for {name}. Esc cancels." | "Not set" | "Replace" | "{chord} is used by {names}." | "Taken from {names}." | "{name} is now {chord}." | "{name} is back to {chord}." | "{chord} belongs to {names}, which cannot change. Press another." | "{chord} belongs to the browser. Press another." | "{chord} types into the chart. Add {mod} or {alt}." | "{chord} presses the focused control. Add {mod} or {alt}." | "That key cannot be used here. Press another." | "Nothing changed." | "unknown error" | "{name}, hidden" | "Level {level} enabled" | "Level {level} ratio" | "Level {level} color" | "Level {level} label" | "Remove level {level}" | "Search {label}" | "{name} (pinned)" | "Cancel order" | "Close position" | "Keep tool active: {mode}" | "Delete {name}" | "Magnet weak: snaps when a bar or study value is within a few pixels" | "Magnet strong: every anchor lands on the nearest bar or study value" | "Click for weak: snaps when a bar or study value is within a few pixels" | "Click for strong: every anchor lands on the nearest bar or study value" | "Armed" | "Keep tool armed" | "On: the tool stays armed after each drawing" | "Tools stay armed after each drawing" | "{group}: chevron for the rest. Double-click keeps it armed" | "{name} stays armed until Escape" | "{count} chart shortcut struck through: the same chord arms a drawing tool here and takes precedence." | "{count} chart shortcuts struck through: the same chord arms a drawing tool here and takes precedence.";
238
345
  /**
239
346
  * Every key a translator is asked for. Widget text is keyed three ways, and
240
347
  * no published key is ever renamed:
@@ -1886,6 +1993,8 @@ interface TopbarOptions {
1886
1993
  canSelectInterval?: (code: string) => boolean;
1887
1994
  /** Show the indicators button. Default true. */
1888
1995
  indicators?: boolean | undefined;
1996
+ /** The full screen button: true for the widget, or the element that enters full screen. Default off. */
1997
+ fullscreen?: boolean | HTMLElement | undefined;
1889
1998
  search?: SymbolSearch | undefined;
1890
1999
  /** The current facts, read on every refresh. */
1891
2000
  state: () => TopbarState;
@@ -1980,8 +2089,8 @@ interface ContextMenuHooks {
1980
2089
  tradingMode?: TradingCapabilityRequest['mode'];
1981
2090
  /** Host replay selection or workspace transitions that also prevent order entry. */
1982
2091
  tradingLocked?(): boolean;
1983
- /** Extra rows a host appends, built per event. */
1984
- items?(e: ContextMenuEvent): MenuEntry[];
2092
+ /** Extra rows a host appends, built per event. A hook that throws adds none. */
2093
+ items?: ((e: ContextMenuEvent) => MenuEntry[]) | undefined;
1985
2094
  }
1986
2095
  interface ContextMenuOptions {
1987
2096
  /** The chart's event. Without one the menu is the chart-level menu at the anchor. */
@@ -2409,6 +2518,22 @@ interface BottombarTarget {
2409
2518
  range?(): string | null;
2410
2519
  /** Apply a range. The bar reports what it returns. Without it the range buttons are greyed. */
2411
2520
  setRange?(id: string): Promise<DateNavigationResult> | DateNavigationResult | void;
2521
+ /**
2522
+ * The session choice: drawn when the source serves this instrument with
2523
+ * and without its extended hours, and kept while the chart still asks for a
2524
+ * session the source does not serve here, so there is a way back from it.
2525
+ * Null, or no method, leaves the control out.
2526
+ */
2527
+ session?(): BottombarSession | null;
2528
+ /** Ask the source for a session, or with undefined for its own default. */
2529
+ setSession?(session: DataSession | undefined): void;
2530
+ }
2531
+ /** What the session control shows. */
2532
+ interface BottombarSession {
2533
+ /** The session the chart asked its source for; undefined is the source's default, which the bar cannot name. */
2534
+ readonly current: DataSession | undefined;
2535
+ /** The sessions the source serves for the instrument and interval on screen. */
2536
+ readonly available: readonly DataSession[];
2412
2537
  }
2413
2538
  interface BottombarOptions {
2414
2539
  /**
@@ -2452,6 +2577,12 @@ interface BottombarControls {
2452
2577
  /** The zones the timezone choice lists, the current one included. */
2453
2578
  timezones(): readonly string[];
2454
2579
  setTimezone(zone: string): void;
2580
+ /**
2581
+ * Null unless the source offers both regular and extended hours here.
2582
+ * Optional, with `setSession`: controls built before 2.7.4 have neither.
2583
+ */
2584
+ session?(): BottombarSession | null;
2585
+ setSession?(session: DataSession | undefined): void;
2455
2586
  /** Null when the chart has no price scale to act on yet. */
2456
2587
  scale(): BottombarScaleState | null;
2457
2588
  toggleScale(which: BottombarScaleToggle): void;
@@ -2870,6 +3001,15 @@ interface WidgetOptions extends Omit<ChartOptions, 'theme'>, WidgetBottombarOpti
2870
3001
  /** The drawing rail. `false` hides it; an object restricts its tools or seeds its pins. Default on. */
2871
3002
  rail?: boolean | RailOptions;
2872
3003
  topbar?: boolean;
3004
+ /**
3005
+ * A full screen button at the end of the top bar. Off by default, since
3006
+ * only the element that enters full screen stays on the display: `true`
3007
+ * takes the widget (a chart grid whole when the widget is one of its
3008
+ * cells), and an element takes that element, for a host whose own order
3009
+ * ticket or dialogs are drawn outside the widget and must come along.
3010
+ * Left out wherever the page may not enter full screen.
3011
+ */
3012
+ fullscreen?: boolean | HTMLElement;
2873
3013
  statusline?: boolean;
2874
3014
  /** Narrow controls. Auto activates when the container is at most 640 CSS px wide, or, with a coarse primary pointer, at most 960 px wide and under 600 px tall (a phone on its side); a tablet or a touch laptop keeps the desktop chrome. Default auto. */
2875
3015
  mobile?: MobileMode;
@@ -2948,6 +3088,12 @@ interface WidgetOptions extends Omit<ChartOptions, 'theme'>, WidgetBottombarOpti
2948
3088
  tradingMode?: TradingCapabilityRequest['mode'];
2949
3089
  /** Locks order entry during host replay selection or workspace transitions. */
2950
3090
  tradingLocked?: () => boolean;
3091
+ /**
3092
+ * Rows the host appends to the right-click menu, built for each event: the
3093
+ * event names the pane, the price and the object under the pointer. A hook
3094
+ * that throws adds no rows and leaves the menu's own rows in place.
3095
+ */
3096
+ contextMenuItems?: (event: ContextMenuEvent) => MenuEntry[];
2951
3097
  /**
2952
3098
  * Account state for the status line, usually a trade-tier `AccountManager`.
2953
3099
  * Omitted shows no account; a source whose provider declares no accounts is
@@ -3964,4 +4110,4 @@ declare function createAlertUi(container: HTMLElement, options: AlertUiOptions):
3964
4110
  */
3965
4111
  declare const WIDGET_TIER: "widget";
3966
4112
 
3967
- export { ACCOUNT_SUMMARY_CSS, type AccountSummaryHandle, type AccountSummaryOptions, type AlertEditorOptions, type AlertUi, type AlertUiOptions, type AlertsPanelOptions, type AsyncStorageLike, BOTTOMBAR_CSS, BOTTOMBAR_HEIGHT, type BottombarContext, type BottombarControls, type BottombarHandle, type BottombarOptions, type BottombarScaleState, type BottombarScaleToggle, type BottombarTarget, type Box, type BusHandler, CHART_GRID_CSS, CHART_GRID_LAYOUTS, CHART_GRID_LAYOUT_NAMES, CHART_GRID_PRESETS, CHART_TYPE_LABELS, COLOR_PICKER_CSS, type ChartGrid, type ChartGridApplyReport, type ChartGridCell, type ChartGridEventName, type ChartGridEvents, type ChartGridLayout, type ChartGridLayoutId, type ChartGridLayoutSlot, type ChartGridLayoutSpec, type ChartGridLinkGroup, type ChartGridMessage, type ChartGridOptions, type ChartGridPreset, type ChartGridUnevenLayout, ChartHistory, type ChartHistoryChange, type ChartHistoryCommand, type ChartHistoryError, type ChartHistoryOptions, type ChartHistoryStep, type ChartShortcutSource, type ColorPickerHandle, type ColorPickerOptions, type ContextMenuHooks, type ContextMenuOptions, DATA_WINDOW_CSS, DATE_NAVIGATION_CSS, DEFAULT_INTERVALS, DEFAULT_LOOKBACK_BARS, DEFAULT_RANGES, DIALOG_CSS, DRAWINGS_KEY_PREFIX, DRAWING_COORDINATES_CSS, DRAWING_TEMPLATES_CSS, DRAWING_TOOLBAR_CSS, type DataWindowHandle, type DataWindowOptions, type DataWindowRow, type DataWindowSection, type DataWindowSnapshot, type DateNavigationDialogOptions, type DateNavigationResult, type DateNavigationStatus, type DateNavigationTarget, DateNavigator, type DateNavigatorOptions, type DialogHandle, type DialogMount, type DrawingCoordinatesHandle, type DrawingPropertiesOptions, type DrawingTemplates, type DrawingToolbarHandle, type DrawingToolbarOptions, EVENT_DETAILS_CSS, type EventDetailAction, type EventDetailsLabels, type EventDetailsLoader, EventDetailsPopup, type EventDetailsPopupOptions, type FormControl, type FormHandle, type FormKind, type FormOptions, type FormTranslationOptions, type HistoryReach, type IndexedDbWidgetStorage, type IndexedDbWidgetStorageOptions, type IndicatorInputControlsHandle, type IndicatorInputControlsOptions, type IndicatorPickerOptions, type IndicatorSettingsOptions, type IndicatorSettingsTab, type IndicatorTemplateApplyMode, type InputState, KEYMAP_KEY, type KeyAction, type KeyBinding, type KeyBindingOptions, type KeyChordUse, type KeyConflict, type KeyEventLike, type KeyRebindResult, type KeyScope, Keymap, type KeymapChange, type KeymapGroup, type KeymapOptions, type KeymapOverrides, type KeymapRow, type LayoutApplyReport, type LayoutAutosaveStatus, type LayoutTarget, type LayoutsController, type LayoutsControllerOptions, type LayoutsState, type LevelEditorOptions, MAGNET_MODES, MIN_PRICE_DIGITS, type MarketStatusReading, type MenuEntry, type MenuItem, type MenuOptions, type MenuRow, type MobileHandle, type MobileMode, type MobileOptions, NEWS_PANEL_CSS, type NewsPanelHandle, type NewsPanelOptions, NewsReader, type NewsReaderOptions, type NewsSnapshot, type NewsStatus, OBJECTS_PANEL_CSS, type ObjectsPanelContent, type ObjectsPanelOptions, type OrderRequest, type OverlayOptions, type OverlayStack, PANEL_DOCK_CSS, type PanelDockContent, type PanelDockHandle, type PanelDockId, type PanelDockOptions, type PanelDockState, type PanelHandle, QUICK_ENTRY_CSS, type QuickEntryHandle, type QuickEntryOptions, QuoteBoard, type QuoteBoardOptions, type QuoteBoardStatus, type QuoteRow, type QuoteRowStatus, RAIL_GROUPS, RAIL_PREFS_KEY, RAIL_WIDTH, type RailGroup, type RailGroupItem, type RailHandle, type RailOptions, type RailPrefs, type RangeWindowOptions, type Rgba, SAVE_DEBOUNCE_MS, SEARCH_DEBOUNCE_MS, STATE_KEY, STATUSLINE_HEIGHT, STORAGE_PREFIX, SYMBOL_PICKER_CSS, type SettingsDialogOptions, type ShortcutsPanelOptions, type Size, type StatuslineHandle, type StatuslineOptions, type StorageLike, type SymbolPickerHandle, type SymbolPickerOptions, type SymbolSearch, TEXT_CONTRAST, TIP_DWELL_MS, TOAST_LEAVE_MS, TOAST_MAX, TOAST_MS, TOKEN_PREFIX, TOOLBAR_LINE_WIDTHS, TOPBAR_HEIGHT, type TextEditorHandle, type TextEditorOptions, type TimeframeMenuContext, type TimeframeMenuOptions, type TimeframePreferences, type TimeframePreferencesOptions, type TimeframeUnit, type TipController, type TipSide, type TipSource, type TipSpec, type ToastHandle, type ToastKind, type ToastOptions, type Toaster, type TopbarHandle, type TopbarOptions, type TopbarState, WATCHLIST_PANEL_CSS, WIDGET_COMPONENT_CSS, WIDGET_CSS, WIDGET_DIALOGS, WIDGET_FONT, WIDGET_MONO, WIDGET_STATE_VERSION, WIDGET_STYLE_ID, WIDGET_TIER, type WatchlistPanelHandle, type WatchlistPanelOptions, type WatchlistSort, type WatchlistSortKey, type Widget, type WidgetBottombarOptions, type WidgetBuiltinMessage, WidgetBus, type WidgetBusEvents, type WidgetChartState, type WidgetContext, type WidgetDialogName, type WidgetEventName, type WidgetMessageKey, type WidgetMessageParameters, type WidgetMessageValues, type WidgetNewsOptions, type WidgetOptions, type WidgetRange, type WidgetRangeUnit, type WidgetRangeWindow, type WidgetRestoreReport, type WidgetSessionCalendar, type WidgetState, WidgetStorage, type WidgetStorageError, type WidgetStorageOptions, type WidgetThemeName, type WidgetTokens, type WidgetTranslationOptions, type WidgetTranslator, type WidgetWatchlistOptions, applyIndicatorTemplate, applyTokens, attachContextMenu, boxIn, captureName, chartTypeChoices, chartTypeLabel, contextMenuEntries, contrastRatio, controlsFromFields, controlsFromInputs, createAlertUi, createChartGrid, createColorPicker, createDrawingTemplates, createIndexedDbWidgetStorage, createLayoutsController, createObjectsPanelContent, createOverlayStack, createTimeframePreferences, createTipController, createWidget, customTimeframeCode, defaultStorage, downloadText, esc, eventKeyCombo, focusable, focusables, formatColor, formatKeyCombo, fromChartCombo, glyph, h, historyPress, historyReady, inTextField, injectWidgetStyles, inputConditionMet, inputStates, intervalLabel, loadWindow, luminance, mix, mountAccountSummary, mountAlertEditor, mountAlertsPanel, mountBottombar, mountContextMenu, mountDataWindow, mountDrawingCoordinates, mountDrawingProperties, mountDrawingToolbar, mountIndicatorInputControls, mountIndicatorPicker, mountIndicatorSettings, mountLevelEditor, mountMobile, mountNewsPanel, mountObjectsPanel, mountPanelDock, mountQuickEntry, mountRail, mountSettingsDialog, mountStatusline, mountSymbolPicker, mountTextEditor, mountToasts, mountTopbar, mountWatchlistPanel, openCustomTimeframeDialog, openDateNavigation, openLayoutsMenu, openMenu, openShortcutsPanel, openTimeframeMenu, parseColor, parseKeyCombo, placeBelow, placeBeside, placeTip, priceDigits, quoteChange, rangeInterval, rangeWindow, readDataWindow, readableOn, registerWidgetDialog, registerWidgetDialogs, registeredWidgetDialogs, renderForm, resolveTheme, safeNewsUrl, safeSymbolIconUrl, sanitizePanelDockState, sanitizeRailPrefs, saveIndicatorTemplate, stripView, themeMode, token, toolGlyph, toolName, unregisterWidgetDialog, widgetDialog, widgetLayoutTarget, widgetText, widgetTokens, withAlpha };
4113
+ export { ACCOUNT_SUMMARY_CSS, type AccountSummaryHandle, type AccountSummaryOptions, type AlertEditorOptions, type AlertUi, type AlertUiOptions, type AlertsPanelOptions, type AsyncStorageLike, BOTTOMBAR_CSS, BOTTOMBAR_HEIGHT, type BottombarContext, type BottombarControls, type BottombarHandle, type BottombarOptions, type BottombarScaleState, type BottombarScaleToggle, type BottombarSession, type BottombarTarget, type Box, type BusHandler, CHART_GRID_CSS, CHART_GRID_LAYOUTS, CHART_GRID_LAYOUT_NAMES, CHART_GRID_PRESETS, CHART_TYPE_LABELS, COLOR_PICKER_CSS, type ChartGrid, type ChartGridApplyReport, type ChartGridCell, type ChartGridEventName, type ChartGridEvents, type ChartGridLayout, type ChartGridLayoutId, type ChartGridLayoutSlot, type ChartGridLayoutSpec, type ChartGridLinkGroup, type ChartGridMessage, type ChartGridOptions, type ChartGridPreset, type ChartGridUnevenLayout, ChartHistory, type ChartHistoryChange, type ChartHistoryCommand, type ChartHistoryError, type ChartHistoryOptions, type ChartHistoryStep, type ChartShortcutSource, type ColorPickerHandle, type ColorPickerOptions, type ContextMenuHooks, type ContextMenuOptions, DATA_WINDOW_CSS, DATE_NAVIGATION_CSS, DEFAULT_INTERVALS, DEFAULT_LOOKBACK_BARS, DEFAULT_RANGES, DIALOG_CSS, DRAWINGS_KEY_PREFIX, DRAWING_COORDINATES_CSS, DRAWING_TEMPLATES_CSS, DRAWING_TOOLBAR_CSS, type DataWindowHandle, type DataWindowOptions, type DataWindowRow, type DataWindowSection, type DataWindowSnapshot, type DateNavigationDialogOptions, type DateNavigationResult, type DateNavigationStatus, type DateNavigationTarget, DateNavigator, type DateNavigatorOptions, type DialogHandle, type DialogMount, type DrawingCoordinatesHandle, type DrawingPropertiesOptions, type DrawingTemplates, type DrawingToolbarHandle, type DrawingToolbarOptions, EVENT_DETAILS_CSS, type EventDetailAction, type EventDetailsLabels, type EventDetailsLoader, EventDetailsPopup, type EventDetailsPopupOptions, type FormControl, type FormHandle, type FormKind, type FormOptions, type FormTranslationOptions, type HistoryReach, type IndexedDbWidgetStorage, type IndexedDbWidgetStorageOptions, type IndicatorInputControlsHandle, type IndicatorInputControlsOptions, type IndicatorPickerOptions, type IndicatorSettingsOptions, type IndicatorSettingsTab, type IndicatorTemplateApplyMode, type InputState, KEYMAP_KEY, type KeyAction, type KeyBinding, type KeyBindingOptions, type KeyChordUse, type KeyConflict, type KeyEventLike, type KeyRebindResult, type KeyScope, Keymap, type KeymapChange, type KeymapGroup, type KeymapOptions, type KeymapOverrides, type KeymapRow, type LayoutApplyReport, type LayoutAutosaveStatus, type LayoutTarget, type LayoutsController, type LayoutsControllerOptions, type LayoutsState, type LevelEditorOptions, MAGNET_MODES, MIN_PRICE_DIGITS, type MarketStatusReading, type MenuEntry, type MenuItem, type MenuOptions, type MenuRow, type MobileHandle, type MobileMode, type MobileOptions, NEWS_PANEL_CSS, type NewsPanelHandle, type NewsPanelOptions, NewsReader, type NewsReaderOptions, type NewsSnapshot, type NewsStatus, OBJECTS_PANEL_CSS, type ObjectsPanelContent, type ObjectsPanelOptions, type OrderRequest, type OverlayOptions, type OverlayStack, PANEL_DOCK_CSS, type PanelDockContent, type PanelDockHandle, type PanelDockId, type PanelDockOptions, type PanelDockState, type PanelHandle, QUICK_ENTRY_CSS, type QuickEntryHandle, type QuickEntryOptions, QuoteBoard, type QuoteBoardOptions, type QuoteBoardStatus, type QuoteRow, type QuoteRowStatus, RAIL_GROUPS, RAIL_PREFS_KEY, RAIL_WIDTH, type RailGroup, type RailGroupItem, type RailHandle, type RailOptions, type RailPrefs, type RangeWindowOptions, type Rgba, SAVE_DEBOUNCE_MS, SEARCH_DEBOUNCE_MS, STATE_KEY, STATUSLINE_HEIGHT, STORAGE_PREFIX, SYMBOL_PICKER_CSS, type SettingsDialogOptions, type ShortcutsPanelOptions, type Size, type StatuslineHandle, type StatuslineOptions, type StorageLike, type SymbolPickerHandle, type SymbolPickerOptions, type SymbolSearch, TEXT_CONTRAST, TIP_DWELL_MS, TOAST_LEAVE_MS, TOAST_MAX, TOAST_MS, TOKEN_PREFIX, TOOLBAR_LINE_WIDTHS, TOPBAR_HEIGHT, type TextEditorHandle, type TextEditorOptions, type TimeframeMenuContext, type TimeframeMenuOptions, type TimeframePreferences, type TimeframePreferencesOptions, type TimeframeUnit, type TipController, type TipSide, type TipSource, type TipSpec, type ToastHandle, type ToastKind, type ToastOptions, type Toaster, type TopbarHandle, type TopbarOptions, type TopbarState, WATCHLIST_PANEL_CSS, WIDGET_COMPONENT_CSS, WIDGET_CSS, WIDGET_DIALOGS, WIDGET_FONT, WIDGET_MONO, WIDGET_STATE_VERSION, WIDGET_STYLE_ID, WIDGET_TIER, type WatchlistPanelHandle, type WatchlistPanelOptions, type WatchlistSort, type WatchlistSortKey, type Widget, type WidgetBottombarOptions, type WidgetBuiltinMessage, WidgetBus, type WidgetBusEvents, type WidgetChartState, type WidgetContext, type WidgetDialogName, type WidgetEventName, type WidgetMessageKey, type WidgetMessageParameters, type WidgetMessageValues, type WidgetNewsOptions, type WidgetOptions, type WidgetRange, type WidgetRangeUnit, type WidgetRangeWindow, type WidgetRestoreReport, type WidgetSessionCalendar, type WidgetState, WidgetStorage, type WidgetStorageError, type WidgetStorageOptions, type WidgetThemeName, type WidgetTokens, type WidgetTranslationOptions, type WidgetTranslator, type WidgetWatchlistOptions, applyIndicatorTemplate, applyTokens, attachContextMenu, boxIn, captureName, chartTypeChoices, chartTypeLabel, contextMenuEntries, contrastRatio, controlsFromFields, controlsFromInputs, createAlertUi, createChartGrid, createColorPicker, createDrawingTemplates, createIndexedDbWidgetStorage, createLayoutsController, createObjectsPanelContent, createOverlayStack, createTimeframePreferences, createTipController, createWidget, customTimeframeCode, defaultStorage, downloadText, esc, eventKeyCombo, focusable, focusables, formatColor, formatKeyCombo, fromChartCombo, glyph, h, historyPress, historyReady, inTextField, injectWidgetStyles, inputConditionMet, inputStates, intervalLabel, loadWindow, luminance, mix, mountAccountSummary, mountAlertEditor, mountAlertsPanel, mountBottombar, mountContextMenu, mountDataWindow, mountDrawingCoordinates, mountDrawingProperties, mountDrawingToolbar, mountIndicatorInputControls, mountIndicatorPicker, mountIndicatorSettings, mountLevelEditor, mountMobile, mountNewsPanel, mountObjectsPanel, mountPanelDock, mountQuickEntry, mountRail, mountSettingsDialog, mountStatusline, mountSymbolPicker, mountTextEditor, mountToasts, mountTopbar, mountWatchlistPanel, openCustomTimeframeDialog, openDateNavigation, openLayoutsMenu, openMenu, openShortcutsPanel, openTimeframeMenu, parseColor, parseKeyCombo, placeBelow, placeBeside, placeTip, priceDigits, quoteChange, rangeInterval, rangeWindow, readDataWindow, readableOn, registerWidgetDialog, registerWidgetDialogs, registeredWidgetDialogs, renderForm, resolveTheme, safeNewsUrl, safeSymbolIconUrl, sanitizePanelDockState, sanitizeRailPrefs, saveIndicatorTemplate, stripView, themeMode, token, toolGlyph, toolName, unregisterWidgetDialog, widgetDialog, widgetLayoutTarget, widgetText, widgetTokens, withAlpha };
@@ -108,6 +108,18 @@ interface DocumentMetadata {
108
108
  interface WorkspaceDocument extends DocumentMetadata, WorkspacePayload {
109
109
  kind: 'workspace';
110
110
  }
111
+ /** How `parseWorkspaceDocument` and `parseWorkspacePayload` read a document. */
112
+ interface WorkspaceParseOptions {
113
+ /**
114
+ * False drops each drawing's and each study's `policy`. A policy is how a
115
+ * host keeps its own objects from the user (read-only, unselectable,
116
+ * unlisted), so a document from a file, a link or another account, which
117
+ * is anyone's, should arrive without one: pass false for it, as
118
+ * `importDocument` does. The default keeps them, because hosts read their
119
+ * own saved state through these parsers too. Since 2.7.3.
120
+ */
121
+ keepPolicy?: boolean;
122
+ }
111
123
  interface IndicatorTemplatePlotBinding {
112
124
  instanceId: string;
113
125
  plotKey: string;
@@ -139,11 +151,11 @@ declare function parseIndicatorStates(input: unknown): IndicatorState[];
139
151
 
140
152
  /** Validate and detach portable study settings and optional pane/scale relationships. */
141
153
  declare function parseIndicatorTemplatePayload(input: unknown): IndicatorTemplatePayload;
142
- /** Validate, detach and project a portable chart-only workspace. */
143
- declare function parseWorkspaceDocument(input: unknown): WorkspaceDocument;
144
- declare function parseWorkspacePayload(input: unknown): WorkspacePayload;
154
+ /** Validate, detach and project a portable chart-only workspace. Policies are kept unless `options.keepPolicy` is false. */
155
+ declare function parseWorkspaceDocument(input: unknown, options?: WorkspaceParseOptions): WorkspaceDocument;
156
+ declare function parseWorkspacePayload(input: unknown, options?: WorkspaceParseOptions): WorkspacePayload;
145
157
  declare function parseIndicatorTemplate(input: unknown): IndicatorTemplateDocument;
146
- /** Explicit migration of the existing single-widget state; no input is modified. */
158
+ /** Explicit migration of the existing single-widget state, the host's own, so policies are kept; no input is modified. */
147
159
  declare function migrateWidgetWorkspace(input: unknown, meta: {
148
160
  id: string;
149
161
  name: string;
@@ -304,6 +316,11 @@ declare class WorkspaceRepository implements WorkspaceStore {
304
316
  remove(kind: WorkspaceKind, id: string, options?: WorkspaceOperationOptions): Promise<void>;
305
317
  openWorkspace(id: string, options?: WorkspaceOpenOptions): Promise<WorkspaceDocument>;
306
318
  setAutosave(enabled: boolean, options?: WorkspaceOperationOptions): Promise<void>;
319
+ /**
320
+ * Store a document from outside the catalog: a file, a link, another
321
+ * account. Each drawing's and study's policy is dropped (since 2.7.3), so
322
+ * what it places is the user's own to select, change or delete.
323
+ */
307
324
  importDocument(input: unknown, options?: WorkspaceOperationOptions): Promise<WorkspaceDocument | IndicatorTemplateDocument>;
308
325
  /** `captureIndicatorTemplate`, as the store member a widget reaches it through. */
309
326
  captureIndicatorTemplate(chart: Chart): IndicatorTemplatePayload;
@@ -563,4 +580,4 @@ type IndexedDbDrawingTemplateStorage = IndexedDbCatalogStorage<DrawingTemplateCa
563
580
  */
564
581
  declare function createIndexedDbDrawingTemplateStorage(factory: IDBFactory, databaseName?: string): IndexedDbDrawingTemplateStorage;
565
582
 
566
- export { type DrawingTemplate, type DrawingTemplateCatalog, DrawingTemplateConflictError, type DrawingTemplateLevel, type DrawingTemplateOperationOptions, DrawingTemplateRepository, type DrawingTemplateRepositoryOptions, type DrawingTemplateStorage, type DrawingTemplateStore, type DrawingTemplateValue, type DrawingTemplateValues, type DrawingToolDefault, type IndexedDbCatalogStorage, type IndexedDbDrawingTemplateStorage, type IndexedDbWatchlistStorage, type IndexedDbWorkspaceStorage, type IndicatorTemplateApplyOptions, type IndicatorTemplateDocument, type IndicatorTemplateInput, type IndicatorTemplateLayout, type IndicatorTemplateMode, type IndicatorTemplatePayload, type IndicatorTemplatePlan, type IndicatorTemplatePlotBinding, WORKSPACE_VERSION, type Watchlist, type WatchlistCatalog, WatchlistConflictError, type WatchlistEntry, type WatchlistOperationOptions, WatchlistRepository, type WatchlistRepositoryOptions, type WatchlistStorage, type WatchlistStore, type WorkspaceCatalog, type WorkspaceChartState, type WorkspaceComparison, WorkspaceConflictError, type WorkspaceDocument, WorkspaceDocumentError, type WorkspaceKind, type WorkspaceLinkChannels, type WorkspaceLinkGroup, type WorkspaceOpenOptions, type WorkspaceOperationOptions, type WorkspacePane, type WorkspacePayload, WorkspaceRepository, type WorkspaceRepositoryOptions, type WorkspaceSettings, type WorkspaceSlot, type WorkspaceStorage, type WorkspaceStore, type WorkspaceSync, captureIndicatorTemplate, createIndexedDbDrawingTemplateStorage, createIndexedDbWatchlistStorage, createIndexedDbWorkspaceStorage, createMemoryDrawingTemplateStorage, createMemoryWatchlistStorage, createMemoryWorkspaceStorage, migrateWidgetWorkspace, parseDrawingTemplateCatalog, parseDrawingTemplateValues, parseIndicatorStates, parseIndicatorTemplate, parseIndicatorTemplatePayload, parseWatchlistCatalog, parseWorkspaceCatalog, parseWorkspaceDocument, parseWorkspacePayload, planIndicatorTemplate, planIndicatorTemplateState, watchlistKey };
583
+ export { type DrawingTemplate, type DrawingTemplateCatalog, DrawingTemplateConflictError, type DrawingTemplateLevel, type DrawingTemplateOperationOptions, DrawingTemplateRepository, type DrawingTemplateRepositoryOptions, type DrawingTemplateStorage, type DrawingTemplateStore, type DrawingTemplateValue, type DrawingTemplateValues, type DrawingToolDefault, type IndexedDbCatalogStorage, type IndexedDbDrawingTemplateStorage, type IndexedDbWatchlistStorage, type IndexedDbWorkspaceStorage, type IndicatorTemplateApplyOptions, type IndicatorTemplateDocument, type IndicatorTemplateInput, type IndicatorTemplateLayout, type IndicatorTemplateMode, type IndicatorTemplatePayload, type IndicatorTemplatePlan, type IndicatorTemplatePlotBinding, WORKSPACE_VERSION, type Watchlist, type WatchlistCatalog, WatchlistConflictError, type WatchlistEntry, type WatchlistOperationOptions, WatchlistRepository, type WatchlistRepositoryOptions, type WatchlistStorage, type WatchlistStore, type WorkspaceCatalog, type WorkspaceChartState, type WorkspaceComparison, WorkspaceConflictError, type WorkspaceDocument, WorkspaceDocumentError, type WorkspaceKind, type WorkspaceLinkChannels, type WorkspaceLinkGroup, type WorkspaceOpenOptions, type WorkspaceOperationOptions, type WorkspacePane, type WorkspaceParseOptions, type WorkspacePayload, WorkspaceRepository, type WorkspaceRepositoryOptions, type WorkspaceSettings, type WorkspaceSlot, type WorkspaceStorage, type WorkspaceStore, type WorkspaceSync, captureIndicatorTemplate, createIndexedDbDrawingTemplateStorage, createIndexedDbWatchlistStorage, createIndexedDbWorkspaceStorage, createMemoryDrawingTemplateStorage, createMemoryWatchlistStorage, createMemoryWorkspaceStorage, migrateWidgetWorkspace, parseDrawingTemplateCatalog, parseDrawingTemplateValues, parseIndicatorStates, parseIndicatorTemplate, parseIndicatorTemplatePayload, parseWatchlistCatalog, parseWorkspaceCatalog, parseWorkspaceDocument, parseWorkspacePayload, planIndicatorTemplate, planIndicatorTemplateState, watchlistKey };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openalgo-charts",
3
- "version": "2.7.2",
3
+ "version": "2.7.4",
4
4
  "description": "From-scratch, dependency-free canvas charting engine for OpenAlgo: professional-grade interactive rendering, advanced on-chart trading, and a one-call widget tier that adds the toolbar, drawing rail, dialogs and shortcuts.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "marketcalls",
@@ -1,2 +0,0 @@
1
- import{layoutIconPath as t,chromeIconSvg as e}from"./openalgo-charts.draw.mjs";import{createLayoutsController as a,s as n,e as o,b as r,d as s,f as i,widgetText as c,widgetLayoutTarget as l,h as d,CHART_GRID_LAYOUTS as u,j as p,a as h,i as m,l as g,k as b,r as f,g as y}from"./openalgo-charts.widget.mjs";import{isReplaying as x}from"./openalgo-charts.mjs";function k(t){const{grid:e}=t,d=!1===t.layouts?null:t.layouts??null;if(!1===t.layouts||null===d&&void 0===t.workspaces)return null;const u=(e,a,n={})=>c(t.context(),`schema.ui.layouts.${e}`,n,a),p=a=>{e.isDestroyed||t.context().status(a,"error")};let h=null,m=[];const g=()=>{for(const t of m.splice(0))t();const t=h;null!==t&&(m=e.cells().map(e=>l(e.widget).subscribe(t)))},b={capture(){const t=e.getWorkspace();return{...t,activePaneId:t.panes[0].id,panes:t.panes.map(t=>({...t,chart:i(t.chart)}))}},apply:t=>e.applyWorkspace(t),subscribe(t){h=t,g();const a=[e.on("layout",({reason:e})=>{"preset"!==e&&"workspace"!==e||g(),t()}),e.on("links",t)];return()=>{h=null,g();for(const t of a)t()}},suspended:()=>e.cells().some(t=>x(t.widget.chart))},f=null===d?a(t.workspaces,b):null,y=d??f,k={handle:null,waiting:null};let _=!1;return null!==f&&(n(f,u,p),t.ready.then(()=>_?null:f.reload()).then(async e=>{if(_||null==e||null===e.activeWorkspaceId||t.opened())return;const a=await f.open(e.activeWorkspaceId);a.applied||_||p(u("notReopened","The last layout could not open here: {error}",{error:a.reason??""}))}).catch(e=>{_||p(u("notLoaded","Saved layouts could not be read: {error}",{error:o(t.context(),e)}))})),{controller:y,open(a){_||s(t.context(),y,a,k,()=>!_&&!e.isDestroyed)},status:()=>r(t.context(),y.state()),flush(){_||f?.flush()},destroy(){_||(_=!0,f?.destroy())}}}function _(e){const a=u[e];return p(t(a.rows,a.columns,a.slots))}const v=(t,e)=>{const a=d(t,"span","oac-glyph oac-glyph--chrome",{"aria-hidden":"true"});return a.innerHTML=e,a};function w(t,a){const n=t.doc,o=(t=>t.text)(t);h(n,L);const r=(t,e)=>d(n,"button",`oac-btn ${t}`,{type:"button","aria-label":e}),s=()=>{const t=d(n,"span","oac-chev",{"aria-hidden":"true"});return t.innerHTML=e("chevron-down"),t},i=r("oac-grid__layout",c(o,"Arrange charts"));i.setAttribute("aria-haspopup","menu");const l=v(n,e("layout")),u=d(n,"span","oac-grid__bar-text");i.append(l,u,s()),t.tips.attach(i,()=>{const e=t.layout();return{title:m(e)?c(o,"Arrange charts: {name}",{name:g(o,e)}):c(o,"Arrange charts"),side:"bottom"}}),i.addEventListener("click",()=>t.openMenu("layouts",i)),i.hidden=0===t.layouts.length;const p=r("oac-btn--icon oac-grid__max",c(o,"Maximize the chart")),x=v(n,e("maximize"));p.appendChild(x);t.tips.attach(p,()=>({title:c(o,t.maximized()?"Restore the grid":"Maximize the chart"),sub:t.maximizeBlocked()??void 0,side:"bottom"})),p.addEventListener("click",()=>{null===t.maximizeBlocked()&&t.toggleMaximize()});const k=r("oac-grid__link",c(o,"Link"));k.setAttribute("aria-haspopup","menu");const w=d(n,"span","oac-grid__bar-text");w.textContent=c(o,"Link");const A=d(n,"span","oac-grid__bar-mark");k.append(v(n,e("link")),w,A,s()),t.tips.attach(k,()=>{const e=t.links.current();return{title:c(o,"Link: {name}",{name:null===e?c(o,"Not linked"):e.name}),side:"bottom"}}),k.addEventListener("click",()=>t.openMenu("link",k));const z=r("oac-btn--icon oac-grid__capture",c(o,"Capture every chart"));z.setAttribute("aria-haspopup","menu"),z.appendChild(v(n,e("capture-grid"))),t.tips.attach(z,()=>({title:c(o,"Capture every chart"),sub:t.capture.blocked()??void 0,side:"bottom"})),z.addEventListener("click",()=>t.openMenu("capture",z));const M=()=>d(n,"span","oac-sep",{role:"separator"});a.append(i,p,M(),k,M(),z);let C=null,E=null;if(void 0!==t.saved){const{controller:s}=t.saved,i=c(o,"schema.ui.layouts.title",{},"Layouts"),l=()=>{const t=s.state();return t.catalog?.workspaces.find(e=>e.id===t.layoutId)?.name??null},u=C=r("oac-grid__saved",i);u.setAttribute("aria-haspopup","dialog");const p=d(n,"span","oac-grid__bar-text");u.append(v(n,e("folder")),p),t.tips.attach(u,()=>{const e=l(),a=null===e?i:`${i}: ${e}`,n=t.saved?.status();return{title:a,label:b(s.state())?`${a}, ${n??""}`:void 0,sub:n,side:"bottom"}});const h=()=>{p.textContent=l()??i,u.dataset.attention=String(b(s.state())),t.tips.refreshLabel(u)};E=s.subscribe(h),h(),u.addEventListener("click",()=>t.saved?.open(u)),a.append(d(n,"span","oac-grid__spacer"),u)}const $=[i,p,k,z,C].filter(t=>null!==t&&!t.hidden);a.addEventListener("keydown",t=>{const e=$.indexOf(n.activeElement),a=f(t.key,e,$.length,["ArrowLeft","ArrowRight"]);a<0||(t.preventDefault(),t.stopPropagation(),$[a].focus())});const T=()=>{const a=t.layout(),r=m(a);l.innerHTML=r?_(a):e("layout"),u.textContent=r?g(o,a):"",u.hidden=!r;const s=t.maximized();x.innerHTML=e(s?"restore":"maximize");const c=t.maximizeBlocked();p.classList.toggle("is-off",null!==c),p.setAttribute("aria-disabled",String(null!==c));const d=t.links.current();A.replaceChildren(y(n,d)),z.classList.toggle("is-off",null!==t.capture.blocked());for(const e of[i,p,k,z])t.tips.refreshLabel(e);const h=t.tips.target();h!==i&&h!==p&&h!==k&&h!==z||t.tips.show(h)};return T(),{el:a,refresh:T,destroy:()=>{E?.(),a.textContent=""}}}const L="\n.oac-grid__bar .oac-grid__bar-text { max-width: 22ch; overflow: hidden; text-overflow: ellipsis; }\n.oac-grid__bar-mark { display: inline-flex; }\n.oac-grid__spacer { flex: 1 1 auto; }\n.oac-grid__saved { min-width: 0; }\n.oac-grid__saved[data-attention=\"true\"]::after { content: ''; width: 6px; height: 6px; flex: none; border-radius: 50%; background: var(--oac-amber); }\n/* A phone's bar keeps the glyph and the mark; the held layout's name stays in the tip and the accessible name. */\n@container oac-grid-bar (max-width: 520px) { .oac-grid__saved > .oac-grid__bar-text { display: none; } }\n";export{k as attachGridSaved,v as chrome,_ as layoutTileSvg,w as mountGridBar};
2
- //# sourceMappingURL=openalgo-charts.widget.grid-bar-Cm_CyA2j.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"openalgo-charts.widget.grid-bar-Cm_CyA2j.mjs","sources":["../src/widget/grid-saved.ts","../src/widget/grid-bar.ts"],"sourcesContent":[null,null],"names":["attachGridSaved","host","grid","given","layouts","undefined","workspaces","text","key","fallback","values","widgetText","context","report","message","isDestroyed","status","heard","chartOffs","wire","off","splice","listener","cells","map","cell","widgetLayoutTarget","widget","subscribe","target","capture","payload","getWorkspace","activePaneId","panes","id","pane","chart","layoutChartState","apply","applyWorkspace","offs","on","reason","suspended","some","isReplaying","own","createLayoutsController","controller","menu","handle","waiting","destroyed","sayLayoutFailures","ready","then","reload","async","catalog","activeWorkspaceId","opened","open","applied","error","catch","errorText","anchor","showLayoutsMenu","layoutStatusText","state","flush","destroy","layoutTileSvg","spec","CHART_GRID_LAYOUTS","glyphSvg","layoutIconPath","rows","columns","slots","chrome","doc","svg","span","h","innerHTML","mountGridBar","el","t","txt","addWidgetStyles","GRID_BAR_CSS","button","className","label","type","chev","s","chromeIconSvg","layout","setAttribute","layoutGlyph","layoutText","append","tips","attach","title","isChartGridLayout","name","layoutName","side","addEventListener","openMenu","hidden","length","max","maxGlyph","appendChild","maximized","sub","maximizeBlocked","toggleMaximize","link","linkText","textContent","linkMark","group","links","current","blocked","sep","role","saved","offSaved","held","find","layoutId","b","at","said","layoutNeedsAttention","paint","dataset","attention","String","refreshLabel","controls","filter","control","e","indexOf","activeElement","to","rovingIndex","preventDefault","stopPropagation","focus","refresh","known","maxed","classList","toggle","replaceChildren","groupMark","up","show"],"mappings":"qWA6DM,SAAUA,EAAgBC,GAC9B,MAAMC,KAAEA,GAASD,EACXE,GAAyB,IAAjBF,EAAKG,QAAoB,KAAOH,EAAKG,SAAW,KAC9D,IAAqB,IAAjBH,EAAKG,SAAgC,OAAVD,QAAsCE,IAApBJ,EAAKK,WAA2B,OAAO,KACxF,MAAMC,EAAO,CAACC,EAAaC,EAAkBC,EAA0C,CAAA,IACrFC,EAAWV,EAAKW,UAAW,qBAAqBJ,IAAOE,EAAQD,GAC3DI,EAAUC,IAAiCZ,EAAKa,aAAad,EAAKW,UAAUI,OAAOF,EAAS,UAElG,IAAIG,EAA6B,KAC7BC,EAA+B,GAEnC,MAAMC,EAAO,KACX,IAAK,MAAMC,KAAOF,EAAUG,OAAO,GAAID,IACvC,MAAME,EAAWL,EACA,OAAbK,IAAmBJ,EAAYhB,EAAKqB,QAAQC,IAAIC,GAAQC,EAAmBD,EAAKE,QAAQC,UAAWN,MAEnGO,EAAuB,CAC3B,OAAAC,GACE,MAAMC,EAAU7B,EAAK8B,eACrB,MAAO,IAAKD,EAASE,aAAcF,EAAQG,MAAM,GAAIC,GACnDD,MAAOH,EAAQG,MAAMV,IAAIY,IAAI,IAAUA,EAAMC,MAAOC,EAAiBF,EAAKC,UAC9E,EACAE,MAAOR,GAAW7B,EAAKsC,eAAeT,GACtC,SAAAH,CAAUN,GACRL,E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AIQ,EAAShC,OAAQ,CAAC,YAAa,eAC7DsC,EAAK,IACTH,EAAEK,iBACFL,EAAEM,kBACFT,EAASM,GAAKI,WAGhB,MAAMC,EAAU,KACd,MAAM3H,EAAKlC,EAAKmG,SACV2D,EAAQnD,EAAkBzE,GAChCmE,EAAYhB,UAAYyE,EAAQtF,EAActC,GAAMgE,EAAc,UAClEI,EAAWsB,YAAckC,EAAQjD,EAAWrB,EAAGtD,GAAM,GACrDoE,EAAWW,QAAU6C,EACrB,MAAMC,EAAQ/J,EAAKsH,YAEnBF,EAAS/B,UAAYa,EAAc6D,EAAQ,UAAY,YACvD,MAAM9B,EAAUjI,EAAKwH,kBACrBL,EAAI6C,UAAUC,OAAO,SAAsB,OAAZhC,GAC/Bd,EAAIf,aAAa,gBAAiB4C,OAAmB,OAAZf,IACzC,MAAMH,EAAQ9H,EAAK+H,MAAMC,UACzBH,EAASqC,gBAAgBC,EAAUlF,EAAK6C,IACxCjG,EAAQmI,UAAUC,OAAO,SAAqC,OAA3BjK,EAAK6B,QAAQoG,WAChD,IAAK,MAAMmB,IAAW,CAACjD,EAAQgB,EAAKO,EAAM7F,GAAU7B,EAAKwG,KAAKyC,aAAaG,GAG3E,MAAMgB,EAAKpK,EAAKwG,KAAK5E,SACjBwI,IAAOjE,GAAUiE,IAAOjD,GAAOiD,IAAO1C,GAAQ0C,IAAOvI,GAAS7B,EAAKwG,KAAK6D,KAAKD,IAGnF,OADAP,IACO,CACLtE,KACAsE,UACAtF,QAAS,KAAQ8D,MAAc9C,EAAGqC,YAAc,IAEpD,CAGA,MAAMjC,EAAe"}
@@ -1,2 +0,0 @@
1
- import"./openalgo-charts.draw.mjs";import{defaultStorage as e,D as t,STORAGE_PREFIX as n}from"./openalgo-charts.widget.mjs";import"./openalgo-charts.mjs";const r="entries",o="copied:",s="oac-widget-store:";function l(t,n,l){const i=void 0===l.journal?e():l.journal,g=void 0===l.migrateFrom?a():l.migrateFrom;let d=null,h=!1;const m=new Set;let p=null;const f=(e,t)=>{for(const n of[...m])try{n(e,t)}catch{}},y=(e,t)=>{f(e,t);const r=u();if(null!==r)try{if(null!==p)return void p.postMessage({key:e,value:t});const o=new r(s+n);o.postMessage({key:e,value:t}),o.close()}catch{}},w=()=>{null!==p&&(p.onmessage=null,p.close(),p=null)},v=async(e,o)=>{const s=await(()=>{if(h)return Promise.reject(new Error("The widget storage is closed"));if(null!==d)return d;const e=new Promise((o,s)=>{const l=t.open(n,1);l.onupgradeneeded=()=>{l.result.objectStoreNames.contains(r)||l.result.createObjectStore(r)},l.onblocked=()=>s(new Error("The widget storage is held open by another tab")),l.onerror=()=>s(l.error??new Error("The widget storage could not be opened")),l.onsuccess=()=>{const t=l.result;if(h)return t.close(),void s(new Error("The widget storage is closed"));t.onversionchange=()=>{t.close(),d===e&&(d=null)},t.onclose=()=>{d===e&&(d=null)},o(t)}}).catch(t=>{throw d===e&&(d=null),t});return d=e,e})();return new Promise((t,n)=>{const l=s.transaction(r,e);let u;l.oncomplete=()=>t(u),l.onabort=()=>n(l.error??new Error("The widget storage transaction was aborted")),o(l.objectStore(r),e=>{u=e})})};return{journal:i,entries:e=>v("readwrite",(t,n)=>{const r=[];n(r);const s=function(e){const t=globalThis.IDBKeyRange;try{return void 0===t?null:t.bound(e,e+"￿")}catch{return null}}(e),l=null===s?t.openCursor():t.openCursor(s);l.onsuccess=()=>{const n=l.result;if(null!==n)return"string"==typeof n.key&&n.key.startsWith(e)&&"string"==typeof n.value&&r.push([n.key,n.value]),void n.continue();if(r.length>0||null===g)return;const s=t.get(o+e);s.onsuccess=()=>{if(void 0!==s.result)return;const n=c(g,e);if(0!==n.length){for(const[e,o]of n)t.put(o,e),r.push([e,o]);t.put((new Date).toISOString(),o+e)}}}}),setItem:(e,t)=>v("readwrite",n=>{n.put(t,e)}).then(()=>y(e,t)),removeItem:e=>v("readwrite",t=>{t.delete(e)}).then(()=>y(e,null)),subscribe:e=>(m.add(e),(()=>{const e=u();if(null===p&&null!==e&&!h)try{p=new e(s+n),p.onmessage=e=>{const t=e.data;"string"!=typeof t?.key||"string"!=typeof t.value&&null!==t.value||f(t.key,t.value)}}catch{p=null}})(),()=>{m.delete(e),0===m.size&&w()}),close:()=>{h=!0,m.clear(),w();const e=d;d=null,e?.then(e=>e.close(),()=>{})}}}function u(){const e=globalThis.BroadcastChannel;return"function"==typeof e?e:null}function c(e,t){const n=[];try{for(let r=0;r<e.length;r++){const o=e.key(r);if(null===o||!o.startsWith(t))continue;const s=e.getItem(o);null!==s&&n.push([o,s])}}catch{return[]}return n}function a(){const t=e();return null!==t&&"function"==typeof t.key&&"number"==typeof t.length?t:null}function i(e){return function(e){const t=a();if(null===t)return e;let r=null;const o=e=>{try{return e(),Promise.resolve()}catch(e){return Promise.reject(e)}};return{journal:e.journal,subscribe:o=>{const s=e.subscribe((e,t)=>{"page"!==r&&o(e,t)}),l=globalThis,u=e=>{"page"===r&&e.storageArea===t&&!0===e.key?.startsWith(n)&&o(e.key,e.newValue)};try{l.addEventListener?.("storage",u)}catch{}return()=>{s();try{l.removeEventListener?.("storage",u)}catch{}}},entries:n=>"page"===r?Promise.resolve(c(t,n)):e.entries(n).then(e=>(r="idb",e),e=>{if("idb"===r)throw e;return r="page",c(t,n)}),setItem:(n,s)=>"page"===r?o(()=>t.setItem(n,s)):e.setItem(n,s),removeItem:n=>"page"===r?o(()=>t.removeItem(n)):e.removeItem(n)}}(l(e,t,{}))}export{l as openIndexedDbStore,i as openPageDefault};
2
- //# sourceMappingURL=openalgo-charts.widget.storage-idb-WH_o01Wj.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"openalgo-charts.widget.storage-idb-WH_o01Wj.mjs","sources":["../src/widget/storage-idb.ts"],"sourcesContent":[null],"names":["STORE","COPIED","CHANNEL","openIndexedDbStore","factory","name","options","journal","undefined","defaultStorage","legacy","migrateFrom","pageStorage","opening","closed","listeners","Set","channel","tell","key","value","listener","announce","Channel","broadcastChannel","postMessage","once","close","stopListening","onmessage","run","async","mode","body","db","Promise","reject","Error","attempt","resolve","request","open","onupgradeneeded","result","objectStoreNames","contains","createObjectStore","onblocked","onerror","error","onsuccess","onversionchange","onclose","catch","tx","transaction","oncomplete","onabort","objectStore","entries","prefix","store","done","rows","range","Range","globalThis","IDBKeyRange","bound","keyRange","cursor","openCursor","at","startsWith","push","continue","length","marker","get","copied","legacyEntries","put","Date","toISOString","setItem","then","removeItem","delete","subscribe","add","event","data","listen","size","clear","pending","BroadcastChannel","storage","out","i","getItem","openPageDefault","idb","page","use","onPage","write","off","win","changed","storageArea","STORAGE_PREFIX","newValue","addEventListener","removeEventListener","orPageStorage","DATABASE"],"mappings":"0JAwCA,MAAMA,EAAQ,UAERC,EAAS,UAETC,EAAU,6BAKAC,EAAmBC,EAAqBC,EAAcC,GACpE,MAAMC,OAA8BC,IAApBF,EAAQC,QAAwBE,IAAmBH,EAAQC,QACrEG,OAAiCF,IAAxBF,EAAQK,YAA4BC,IAAgBN,EAAQK,YAC3E,IAAIE,EAAuC,KACvCC,GAAS,EACb,MAAMC,EAAY,IAAIC,IAGtB,IAAIC,EAAmC,KAEvC,MAAMC,EAAO,CAACC,EAAaC,KACzB,IAAK,MAAMC,IAAY,IAAIN,GACzB,IAAMM,EAASF,EAAKC,EAAQ,CAAE,MAAwD,GAGpFE,EAAW,CAACH,EAAaC,KAC7BF,EAAKC,EAAKC,GACV,MAAMG,EAAUC,IAChB,GAAgB,OAAZD,EACJ,IACE,GAAgB,OAAZN,EAAyD,YAArCA,EAAQQ,YAAY,CAAEN,MAAKC,UACnD,MAAMM,EAAO,IAAIH,EAAQrB,EAAUG,GACnCqB,EAAKD,YAAY,CAAEN,MAAKC,UACxBM,EAAKC,OACP,CAAE,MAAmF,GAajFC,EAAgB,KACJ,OAAZX,IACJA,EAAQY,UAAY,KACpBZ,EAAQU,QACRV,EAAU,OA6BNa,EAAMC,MAAUC,EAA0BC,KAC9C,MAAMC,OA3BK,MACX,GAAIpB,EAAQ,OAAOqB,QAAQC,OAAO,IAAIC,MA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