react-semaphor 0.1.512 → 0.1.513

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 (82) hide show
  1. package/dist/analytics-protocol/index.js +10 -10
  2. package/dist/brand-studio/index.cjs +1 -1
  3. package/dist/brand-studio/index.js +4 -4
  4. package/dist/briefings/index.js +5 -5
  5. package/dist/chunks/{calculated-field-identity-CJL54uFx.js → calculated-field-identity-DnRd4YIY.js} +4 -4
  6. package/dist/chunks/{card-config-utils-Bq1enstT.js → card-config-utils-B2cDWQqB.js} +5 -5
  7. package/dist/chunks/{dashboard-briefing-launcher-Dna1RtyP.cjs → dashboard-briefing-launcher-BgGxFDKD.cjs} +1 -1
  8. package/dist/chunks/{dashboard-briefing-launcher-CKOSxJJy.js → dashboard-briefing-launcher-C7ptb5Yf.js} +10 -10
  9. package/dist/chunks/{dashboard-controls-9H6PxWNh.cjs → dashboard-controls-BFT7savs.cjs} +1 -1
  10. package/dist/chunks/{dashboard-controls-BqePoOt8.js → dashboard-controls-BybAeRL8.js} +12 -12
  11. package/dist/chunks/{dashboard-date-comparison-definition-BX0ltXzm.js → dashboard-date-comparison-definition-D7Bl-YAl.js} +1 -1
  12. package/dist/chunks/{dashboard-json-BJJ1cddf.js → dashboard-json-DmgEQ0yQ.js} +7 -7
  13. package/dist/chunks/{dashboard-json-BwwJoZdd.cjs → dashboard-json-qNJC4fZW.cjs} +1 -1
  14. package/dist/chunks/{edit-dashboard-visual-cJdvfkou.cjs → edit-dashboard-visual-BS219qr8.cjs} +1 -1
  15. package/dist/chunks/{edit-dashboard-visual-Db2mRA_9.js → edit-dashboard-visual-CHqpQVfv.js} +16 -16
  16. package/dist/chunks/{editor-action-buttons-CKS-8x2Y.cjs → editor-action-buttons-6NvSUz4D.cjs} +1 -1
  17. package/dist/chunks/{editor-action-buttons-ktNQjwNQ.js → editor-action-buttons-DbU_vUvm.js} +7 -7
  18. package/dist/chunks/{field-aggregations-DUb0NU6c.js → field-aggregations-CzuQKtqx.js} +6 -6
  19. package/dist/chunks/{field-dependencies-Cl97kkHy.js → field-dependencies-DXW4jtvJ.js} +11 -11
  20. package/dist/chunks/{index-0pdaQ9e1.js → index-CnGVjyF8.js} +11 -11
  21. package/dist/chunks/{index-CdlFHeq9.cjs → index-CrxlydOT.cjs} +246 -241
  22. package/dist/chunks/{index-SVO291wS.js → index-WMVZeOZp.js} +35072 -34608
  23. package/dist/chunks/{matrix-analytical-definition-xesmc3Qa.js → matrix-analytical-definition-BDAK2aEi.js} +1 -1
  24. package/dist/chunks/{matrix-card-CnKQpnsj.js → matrix-card-DOIeTmjh.js} +2 -2
  25. package/dist/chunks/{matrix-control-sources-CRRdP03Q.js → matrix-control-sources-BxKH2yu2.js} +5 -5
  26. package/dist/chunks/{matrix-definition-RyU0cpLX.js → matrix-definition-I9rHB9zN.js} +1 -1
  27. package/dist/chunks/{matrix-formatter-ZVS5QOuq.js → matrix-formatter-BLunke3R.js} +4 -4
  28. package/dist/chunks/{matrix-member-presentation-CzGZJd3a.js → matrix-member-presentation-DO1VSqfh.js} +1 -1
  29. package/dist/chunks/{matrix-operation-contract-xL8IhFzp.js → matrix-operation-contract-D0HfzwZg.js} +27 -27
  30. package/dist/chunks/{metric-comparison-C-sYqv0g.js → metric-comparison-Dqc7_tnW.js} +1 -1
  31. package/dist/chunks/{pivot-header-presentation-DVylCBHB.js → pivot-header-presentation-Dm9dUQsl.js} +3 -3
  32. package/dist/chunks/{pivot-result-identity-BSudrDLN.js → pivot-result-identity-8M-bZrw9.js} +1 -1
  33. package/dist/chunks/{pivot-result-lifecycle-CmjpW7qG.js → pivot-result-lifecycle-BeOpjAhg.js} +7 -7
  34. package/dist/chunks/{raw-temporal-CUJ86xHI.js → raw-temporal-DrmCX9Wq.js} +2 -2
  35. package/dist/chunks/{raw-temporal-contract-Eyr5U8DK.js → raw-temporal-contract-CFLGwTiI.js} +1 -1
  36. package/dist/chunks/{report-preferences-dialog-CBZBmpxZ.js → report-preferences-dialog-BoDcPtha.js} +6 -6
  37. package/dist/chunks/{report-preferences-dialog-DserKhuQ.cjs → report-preferences-dialog-CaefWf8W.cjs} +1 -1
  38. package/dist/chunks/{report-runtime-context-DWvUf1HT.js → report-runtime-context-Cs65Mrxj.js} +5 -5
  39. package/dist/chunks/{selection-reducer-B94WgZ9V.js → selection-reducer-BIiQXbGM.js} +1 -1
  40. package/dist/chunks/{semantic-format-CBlRO8Aw.js → semantic-format-BZxJLKvw.js} +2 -2
  41. package/dist/chunks/{source-entity-resolution-DZhUckix.js → source-entity-resolution-D7vnmDwm.js} +1 -1
  42. package/dist/chunks/switch--Re1K566.cjs +134 -0
  43. package/dist/chunks/{switch-CrstROAR.js → switch-QfKb0Iwe.js} +2373 -2294
  44. package/dist/chunks/{temporal-bucket-contract-D5QlJbmm.js → temporal-bucket-contract-IWDgyTMw.js} +1 -1
  45. package/dist/chunks/{token-types-CPde8_LG.js → token-types-Dl0hcKBX.js} +1 -1
  46. package/dist/chunks/{update-policy-D9q1Tz8k.js → update-policy-BeQqjupC.js} +2 -2
  47. package/dist/chunks/{validators-BDYzZFgs.js → validators-CkHsAvwB.js} +12 -12
  48. package/dist/dashboard/index.cjs +1 -1
  49. package/dist/dashboard/index.js +1 -1
  50. package/dist/dashboard-authoring/index.js +10 -10
  51. package/dist/data-app-builder/index.cjs +1 -1
  52. package/dist/data-app-builder/index.js +3 -3
  53. package/dist/data-app-codegen/index.js +2 -2
  54. package/dist/data-app-codegen-node/index.js +3 -3
  55. package/dist/data-app-sdk/index.js +5 -5
  56. package/dist/data-app-sdk-adapters/index.js +2 -2
  57. package/dist/data-app-sdk-validation/index.js +5 -5
  58. package/dist/format-utils/index.js +16 -16
  59. package/dist/index.cjs +1 -1
  60. package/dist/index.js +32 -32
  61. package/dist/report-runtime-context/index.js +2 -2
  62. package/dist/style.css +1 -1
  63. package/dist/surfboard/index.cjs +1 -1
  64. package/dist/surfboard/index.js +2 -2
  65. package/dist/types/components/calculated-fields/field-picker-panel.d.ts +5 -1
  66. package/dist/types/components/calculated-fields/placeholder-field-picker.d.ts +30 -0
  67. package/dist/types/components/calculated-fields/templates-menu.d.ts +9 -3
  68. package/dist/types/components/explorer/fields/field-option-list.d.ts +3 -1
  69. package/dist/types/components/semaphor/code-editor.d.ts +28 -0
  70. package/dist/types/components/surfboard/filter/use-dashboard-filter-mapping-popover.d.ts +0 -1
  71. package/dist/types/index.cjs +1 -1
  72. package/dist/types/index.js +40 -31
  73. package/dist/types/lib/hooks/calculated-fields/use-calculated-field-templates.d.ts +9 -0
  74. package/dist/types/lib/hooks/calculated-fields/use-formula-placeholders.d.ts +54 -0
  75. package/dist/types/lib/stores/dashboard-store.d.ts +1 -2
  76. package/dist/types/lib/types/calculated-field-template-types.d.ts +13 -0
  77. package/dist/types/lib/types/common-types.d.ts +0 -7
  78. package/dist/types/lib/types/index.d.ts +1 -0
  79. package/dist/types/lib/utils/calculated-field-row-templates.d.ts +13 -0
  80. package/dist/types/lib/utils/calculated-field-token-utils.d.ts +23 -0
  81. package/package.json +1 -1
  82. package/dist/chunks/switch-BkcJCTS7.cjs +0 -134
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-CdlFHeq9.cjs"),r=require("../chunks/common-types-nBuCd3u2.cjs"),o=require("../chunks/report-preferences-dialog-DserKhuQ.cjs");exports.DisplayFormatPreferencesFields=e.DisplayFormatPreferencesFields;exports.Surfboard=e.DashboardPlus;exports.CONTROL_CARD_DEFAULT_VALUE=r.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;exports.ReportPreferencesDialog=o.ReportPreferencesDialog;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("../chunks/index-CrxlydOT.cjs"),r=require("../chunks/common-types-nBuCd3u2.cjs"),o=require("../chunks/report-preferences-dialog-CaefWf8W.cjs");exports.DisplayFormatPreferencesFields=e.DisplayFormatPreferencesFields;exports.Surfboard=e.DashboardPlus;exports.CONTROL_CARD_DEFAULT_VALUE=r.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=r.EMPTY_SELECTION;exports.ReportPreferencesDialog=o.ReportPreferencesDialog;
@@ -1,6 +1,6 @@
1
- import { b as a, a as o } from "../chunks/index-SVO291wS.js";
1
+ import { b as a, a as o } from "../chunks/index-WMVZeOZp.js";
2
2
  import { C as f, E } from "../chunks/common-types-C6cAQgyh.js";
3
- import { R as t } from "../chunks/report-preferences-dialog-CBZBmpxZ.js";
3
+ import { R as t } from "../chunks/report-preferences-dialog-BoDcPtha.js";
4
4
  export {
5
5
  f as CONTROL_CARD_DEFAULT_VALUE,
6
6
  a as DisplayFormatPreferencesFields,
@@ -4,7 +4,7 @@ import { AvailableFieldGroup, AvailableField } from '../../lib/hooks/calculated-
4
4
  * `useAvailableFields` decides compatibility and grouping (it knows about
5
5
  * the calculated-fields group and aggregate rules); this panel only renders.
6
6
  */
7
- export declare function FieldPickerPanel({ groups, searchTerm, onSearchTermChange, onFieldClick, selectedFieldIds, unavailableFieldReasons, disabled, }: {
7
+ export declare function FieldPickerPanel({ groups, searchTerm, onSearchTermChange, onFieldClick, selectedFieldIds, unavailableFieldReasons, disabled, listLabel, autoFocusSearch, selectFirstOnEnter, }: {
8
8
  groups: AvailableFieldGroup[];
9
9
  searchTerm: string;
10
10
  onSearchTermChange: (value: string) => void;
@@ -13,4 +13,8 @@ export declare function FieldPickerPanel({ groups, searchTerm, onSearchTermChang
13
13
  /** Fields blocked for the current chart, by id, with the reason. */
14
14
  unavailableFieldReasons?: Record<string, string>;
15
15
  disabled?: boolean;
16
+ listLabel?: string;
17
+ autoFocusSearch?: boolean;
18
+ /** Enter in the search box picks the first enabled match. */
19
+ selectFirstOnEnter?: boolean;
16
20
  }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,30 @@
1
+ import { RefObject } from 'react';
2
+ import { AvailableField, AvailableFieldGroup } from '../../lib/hooks/calculated-fields/use-available-fields.js';
3
+ type Measurable = {
4
+ getBoundingClientRect: () => DOMRect;
5
+ };
6
+ export type PlaceholderFieldPickerProps = {
7
+ /** Token being replaced (text between the braces); null when closed. */
8
+ token: string | null;
9
+ /** Unbound tokens left in the formula, including this one. */
10
+ remaining: number;
11
+ /** Measures the chip the picker hangs from. */
12
+ anchorRef: RefObject<Measurable>;
13
+ groups: AvailableFieldGroup[];
14
+ unavailableFieldReasons?: Record<string, string>;
15
+ onPick: (field: AvailableField) => void;
16
+ /** Esc: close and keep the token selected so typing replaces it. */
17
+ onEscape: () => void;
18
+ /** Click outside: close and leave focus where the click put it. */
19
+ onDismiss: () => void;
20
+ onCloseAutoFocus: (event: Event) => void;
21
+ };
22
+ /**
23
+ * Field picker anchored under a dashed chip in the formula box. Opens
24
+ * when the author clicks a chip, presses Tab in the formula, or inserts
25
+ * a template. Picking replaces the whole token; the editor then moves to
26
+ * the next chip. Reuses `FieldPickerPanel`, so compatibility and the
27
+ * "Not in this visual" hints match Insert field.
28
+ */
29
+ export declare function PlaceholderFieldPicker({ token, remaining, anchorRef, groups, unavailableFieldReasons, onPick, onEscape, onDismiss, onCloseAutoFocus, }: PlaceholderFieldPickerProps): import("react/jsx-runtime").JSX.Element;
30
+ export {};
@@ -1,5 +1,11 @@
1
+ import { CalculatedFieldType } from '../../lib/types/calculated-field-editor-types.js';
2
+ import { CalculatedFieldTemplateDefaults, ResolvedCalculatedFieldTemplate } from '../../lib/types/calculated-field-template-types.js';
1
3
  export type TemplatesMenuProps = {
4
+ fieldType: CalculatedFieldType;
2
5
  onInsert: (snippet: string) => void;
6
+ onInsertRowTemplate: (template: ResolvedCalculatedFieldTemplate) => void;
7
+ rowTemplates?: CalculatedFieldTemplateDefaults;
8
+ rowTemplatesLoading?: boolean;
3
9
  disabled?: boolean;
4
10
  };
5
11
  /**
@@ -8,7 +14,7 @@ export type TemplatesMenuProps = {
8
14
  * the formula editor at the cursor; the user replaces `{a}` / `{b}`
9
15
  * placeholders with real fields after.
10
16
  *
11
- * Metric-only — caller decides whether to render this. Calculated
12
- * Columns are row-level and do not have aggregate templates.
17
+ * Aggregate templates insert their portable formula directly. Row templates
18
+ * synchronously insert defaults already loaded for the active connection.
13
19
  */
14
- export declare function TemplatesMenu({ onInsert, disabled }: TemplatesMenuProps): import("react/jsx-runtime").JSX.Element;
20
+ export declare function TemplatesMenu({ fieldType, onInsert, onInsertRowTemplate, rowTemplates, rowTemplatesLoading, disabled, }: TemplatesMenuProps): import("react/jsx-runtime").JSX.Element;
@@ -35,6 +35,8 @@ export type FieldOptionListProps<TField extends Field = Field> = {
35
35
  /** Classes for the scrolling list container (height belongs here). */
36
36
  listClassName?: string;
37
37
  autoFocusSearch?: boolean;
38
+ /** Enter in the search box picks the first enabled match. */
39
+ selectFirstOnEnter?: boolean;
38
40
  emptyMessage?: string;
39
41
  };
40
42
  /**
@@ -49,4 +51,4 @@ export type FieldOptionListProps<TField extends Field = Field> = {
49
51
  *
50
52
  * Hosts own the trigger, what a selection means, and where it lives.
51
53
  */
52
- export declare function FieldOptionList<TField extends Field = Field>({ fields, selectedIds, onSelect, selectionMode, query: controlledQuery, onQueryChange, searchPlaceholder, listLabel, getGroup, sorted, isDisabled, isCalculated, renderTrailing, toolbar, density, listClassName, autoFocusSearch, emptyMessage, }: FieldOptionListProps<TField>): import("react/jsx-runtime").JSX.Element;
54
+ export declare function FieldOptionList<TField extends Field = Field>({ fields, selectedIds, onSelect, selectionMode, query: controlledQuery, onQueryChange, searchPlaceholder, listLabel, getGroup, sorted, isDisabled, isCalculated, renderTrailing, toolbar, density, listClassName, autoFocusSearch, selectFirstOnEnter, emptyMessage, }: FieldOptionListProps<TField>): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,16 @@
1
1
  import { ElementRef, KeyboardEventHandler } from 'react';
2
2
  import { default as Editor } from 'react-simple-code-editor';
3
3
  export type CodeEditorLanguage = 'yaml' | 'json' | 'sql' | 'sql-jinja' | 'python' | 'javascript';
4
+ /**
5
+ * A character range drawn as a chip behind the text. `field` is a quiet
6
+ * solid tint; `pending` is a dashed outline that can be hovered and
7
+ * clicked (see `onChipClick`).
8
+ */
9
+ export type CodeEditorChip = {
10
+ start: number;
11
+ end: number;
12
+ tone: 'field' | 'pending';
13
+ };
4
14
  export type CodeEditorProps = {
5
15
  value: string;
6
16
  onValueChange?: (value: string) => void;
@@ -66,6 +76,21 @@ export type CodeEditorProps = {
66
76
  * global shortcuts on its own.
67
77
  */
68
78
  onKeyDown?: KeyboardEventHandler<HTMLTextAreaElement & HTMLDivElement>;
79
+ /**
80
+ * Opt-in chips drawn behind the text (non-overlapping ranges into
81
+ * `value`). Chips use background and outline only, so they never
82
+ * change character metrics and the caret stays on the text.
83
+ */
84
+ chips?: ReadonlyArray<CodeEditorChip>;
85
+ /** Index into `chips` rendered in the active state. */
86
+ activeChipIndex?: number | null;
87
+ /**
88
+ * Called with the index into `chips` when a `pending` chip is clicked.
89
+ * Clicks land on the textarea, so hits are resolved by measuring the
90
+ * chip layer. Not called when `readOnly`, or for drag selections that
91
+ * reach outside the chip.
92
+ */
93
+ onChipClick?: (index: number) => void;
69
94
  className?: string;
70
95
  };
71
96
  type SimpleCodeEditorHandle = ElementRef<typeof Editor>;
@@ -81,6 +106,9 @@ export type CodeEditorHandle = {
81
106
  captureSession: () => CodeEditorSessionSnapshot | null;
82
107
  restoreSession: (snapshot: CodeEditorSessionSnapshot) => void;
83
108
  focus: () => void;
109
+ /** Viewport rect of chip `index` (its last line when it wraps), for
110
+ * anchoring a popover to it. */
111
+ getChipRect: (index: number) => DOMRect | null;
84
112
  };
85
113
  export declare const CodeEditor: import('react').ForwardRefExoticComponent<CodeEditorProps & import('react').RefAttributes<CodeEditorHandle>>;
86
114
  export {};
@@ -54,7 +54,6 @@ export declare function useDashboardFilterMappingPopover(params: {
54
54
  aiScopeTables?: import('../index.js').AIScopeTable[];
55
55
  globalStyle?: import('../index.js').TStyle;
56
56
  globalCacheConfig?: import('../index.js').CacheConfig;
57
- emailSettings?: import('../index.js').EmailSettings;
58
57
  defaultFilterValues?: import('./types.js').TFilterValue[];
59
58
  controls?: import('../index.js').ControlDefinition[];
60
59
  defaultControlValues?: Record<string, unknown>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const l=require("../chunks/common-types-nBuCd3u2.cjs"),e=require("../chunks/validators-DVYAnnX0.cjs"),t=require("../chunks/field-dependencies-DIab72rQ.cjs"),r=require("../chunks/token-types-Ahh5u4iT.cjs"),a=require("../chunks/pivot-result-identity-uTiylUNr.cjs"),i=require("../chunks/report-runtime-context-DzvHBPxl.cjs");exports.CONTROL_CARD_DEFAULT_VALUE=l.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=l.EMPTY_SELECTION;exports.CALCULATED_FIELD_ENTITY_MARKER=e.CALCULATED_FIELD_ENTITY_MARKER;exports.DATE_FORMAT_VALUES=e.DATE_FORMAT_VALUES;exports.LEGACY_CALCULATED_FIELD_ENTITY_MARKER=e.LEGACY_CALCULATED_FIELD_ENTITY_MARKER;exports.PivotMarkerEnum=e.PivotMarkerEnum;exports.getCalculatedFieldComputeStage=e.getCalculatedFieldComputeStage;exports.getFieldRuntimeColumnName=e.getFieldRuntimeColumnName;exports.hasCalculatedFieldMarker=e.hasCalculatedFieldMarker;exports.hasCalculatedFormulaInputs=e.hasCalculatedFormulaInputs;exports.hasSyntheticCalculatedFieldOwner=e.hasSyntheticCalculatedFieldOwner;exports.inspectCalculatedField=e.inspectCalculatedField;exports.isCalculatedDimension=e.isCalculatedDimension;exports.isCalculatedMetric=e.isCalculatedMetric;exports.isDerivedField=e.isDerivedField;exports.normalizeCalculatedFieldRepresentation=e.normalizeCalculatedFieldRepresentation;exports.shouldDropInheritedCalculationAggregate=e.shouldDropInheritedCalculationAggregate;exports.collectDatasetNamesFromExplorerField=t.collectDatasetNamesFromExplorerField;exports.collectDatasetNamesFromFilterGroup=t.collectDatasetNamesFromFilterGroup;exports.collectExecutionDatasetNamesFromExplorerField=t.collectExecutionDatasetNamesFromExplorerField;exports.collectPreferredDatasetNamesFromExplorerField=t.collectPreferredDatasetNamesFromExplorerField;exports.collectQualifiedDatasetNamesFromExplorerField=t.collectQualifiedDatasetNamesFromExplorerField;exports.datasetRefFromSource=t.datasetRefFromSource;exports.dependencyDisplayIdentity=t.dependencyDisplayIdentity;exports.humanizeDatasetName=t.humanizeDatasetName;exports.resolveFieldDatasetDependencies=t.resolveFieldDatasetDependencies;exports.DEFAULT_SEMANTIC_DOMAIN_ACCESS=r.DEFAULT_SEMANTIC_DOMAIN_ACCESS;exports.resolveQueryColumnKeyMapEntry=a.resolveQueryColumnKeyMapEntry;exports.resolveUniqueQueryColumnKeyMapEntry=a.resolveUniqueQueryColumnKeyMapEntry;exports.DEFAULT_CALENDAR_CONTEXT=i.DEFAULT_CALENDAR_CONTEXT;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("../chunks/common-types-nBuCd3u2.cjs"),e=require("../chunks/validators-DVYAnnX0.cjs"),t=require("../chunks/field-dependencies-DIab72rQ.cjs"),r=require("../chunks/token-types-Ahh5u4iT.cjs"),l=require("../chunks/pivot-result-identity-uTiylUNr.cjs"),i=require("../chunks/report-runtime-context-DzvHBPxl.cjs"),o=["concatenate","conditional-category","date-part","date-difference","null-to-zero","safe-ratio"];exports.CONTROL_CARD_DEFAULT_VALUE=a.CONTROL_CARD_DEFAULT_VALUE;exports.EMPTY_SELECTION=a.EMPTY_SELECTION;exports.CALCULATED_FIELD_ENTITY_MARKER=e.CALCULATED_FIELD_ENTITY_MARKER;exports.DATE_FORMAT_VALUES=e.DATE_FORMAT_VALUES;exports.LEGACY_CALCULATED_FIELD_ENTITY_MARKER=e.LEGACY_CALCULATED_FIELD_ENTITY_MARKER;exports.PivotMarkerEnum=e.PivotMarkerEnum;exports.getCalculatedFieldComputeStage=e.getCalculatedFieldComputeStage;exports.getFieldRuntimeColumnName=e.getFieldRuntimeColumnName;exports.hasCalculatedFieldMarker=e.hasCalculatedFieldMarker;exports.hasCalculatedFormulaInputs=e.hasCalculatedFormulaInputs;exports.hasSyntheticCalculatedFieldOwner=e.hasSyntheticCalculatedFieldOwner;exports.inspectCalculatedField=e.inspectCalculatedField;exports.isCalculatedDimension=e.isCalculatedDimension;exports.isCalculatedMetric=e.isCalculatedMetric;exports.isDerivedField=e.isDerivedField;exports.normalizeCalculatedFieldRepresentation=e.normalizeCalculatedFieldRepresentation;exports.shouldDropInheritedCalculationAggregate=e.shouldDropInheritedCalculationAggregate;exports.collectDatasetNamesFromExplorerField=t.collectDatasetNamesFromExplorerField;exports.collectDatasetNamesFromFilterGroup=t.collectDatasetNamesFromFilterGroup;exports.collectExecutionDatasetNamesFromExplorerField=t.collectExecutionDatasetNamesFromExplorerField;exports.collectPreferredDatasetNamesFromExplorerField=t.collectPreferredDatasetNamesFromExplorerField;exports.collectQualifiedDatasetNamesFromExplorerField=t.collectQualifiedDatasetNamesFromExplorerField;exports.datasetRefFromSource=t.datasetRefFromSource;exports.dependencyDisplayIdentity=t.dependencyDisplayIdentity;exports.humanizeDatasetName=t.humanizeDatasetName;exports.resolveFieldDatasetDependencies=t.resolveFieldDatasetDependencies;exports.DEFAULT_SEMANTIC_DOMAIN_ACCESS=r.DEFAULT_SEMANTIC_DOMAIN_ACCESS;exports.resolveQueryColumnKeyMapEntry=l.resolveQueryColumnKeyMapEntry;exports.resolveUniqueQueryColumnKeyMapEntry=l.resolveUniqueQueryColumnKeyMapEntry;exports.DEFAULT_CALENDAR_CONTEXT=i.DEFAULT_CALENDAR_CONTEXT;exports.CALCULATED_FIELD_TEMPLATE_IDS=o;
@@ -1,38 +1,47 @@
1
- import { C as s, E as t } from "../chunks/common-types-C6cAQgyh.js";
2
- import { C as r, D as o, L as i, P as d, d as E, g as m, e as c, h as C, f as n, c as u, a as D, i as F, b as p, n as A, s as _ } from "../chunks/validators-BDYzZFgs.js";
3
- import { c as L, g as N, f, b as x, e as M, d as R, a as y, h as I, r as h } from "../chunks/field-dependencies-Cl97kkHy.js";
4
- import { D as S } from "../chunks/token-types-CPde8_LG.js";
5
- import { r as O, a as v } from "../chunks/pivot-result-identity-BSudrDLN.js";
6
- import { D as P } from "../chunks/report-runtime-context-DWvUf1HT.js";
1
+ import { C as s, E as l } from "../chunks/common-types-C6cAQgyh.js";
2
+ import { C as o, D as i, L as d, P as E, f as c, g as n, k as C, j as m, l as D, e as u, c as F, b as A, d as p, n as _, h as L } from "../chunks/validators-CkHsAvwB.js";
3
+ import { c as N, g as f, f as x, b as I, e as M, d as y, a as R, h as g, r as h } from "../chunks/field-dependencies-DXW4jtvJ.js";
4
+ import { D as U } from "../chunks/token-types-Dl0hcKBX.js";
5
+ import { r as v, a as P } from "../chunks/pivot-result-identity-8M-bZrw9.js";
6
+ import { D as Y } from "../chunks/report-runtime-context-Cs65Mrxj.js";
7
+ const e = [
8
+ "concatenate",
9
+ "conditional-category",
10
+ "date-part",
11
+ "date-difference",
12
+ "null-to-zero",
13
+ "safe-ratio"
14
+ ];
7
15
  export {
8
- r as CALCULATED_FIELD_ENTITY_MARKER,
16
+ o as CALCULATED_FIELD_ENTITY_MARKER,
17
+ e as CALCULATED_FIELD_TEMPLATE_IDS,
9
18
  s as CONTROL_CARD_DEFAULT_VALUE,
10
- o as DATE_FORMAT_VALUES,
11
- P as DEFAULT_CALENDAR_CONTEXT,
12
- S as DEFAULT_SEMANTIC_DOMAIN_ACCESS,
13
- t as EMPTY_SELECTION,
14
- i as LEGACY_CALCULATED_FIELD_ENTITY_MARKER,
15
- d as PivotMarkerEnum,
16
- L as collectDatasetNamesFromExplorerField,
17
- N as collectDatasetNamesFromFilterGroup,
18
- f as collectExecutionDatasetNamesFromExplorerField,
19
- x as collectPreferredDatasetNamesFromExplorerField,
19
+ i as DATE_FORMAT_VALUES,
20
+ Y as DEFAULT_CALENDAR_CONTEXT,
21
+ U as DEFAULT_SEMANTIC_DOMAIN_ACCESS,
22
+ l as EMPTY_SELECTION,
23
+ d as LEGACY_CALCULATED_FIELD_ENTITY_MARKER,
24
+ E as PivotMarkerEnum,
25
+ N as collectDatasetNamesFromExplorerField,
26
+ f as collectDatasetNamesFromFilterGroup,
27
+ x as collectExecutionDatasetNamesFromExplorerField,
28
+ I as collectPreferredDatasetNamesFromExplorerField,
20
29
  M as collectQualifiedDatasetNamesFromExplorerField,
21
- R as datasetRefFromSource,
22
- y as dependencyDisplayIdentity,
23
- E as getCalculatedFieldComputeStage,
24
- m as getFieldRuntimeColumnName,
25
- c as hasCalculatedFieldMarker,
26
- C as hasCalculatedFormulaInputs,
27
- n as hasSyntheticCalculatedFieldOwner,
28
- I as humanizeDatasetName,
30
+ y as datasetRefFromSource,
31
+ R as dependencyDisplayIdentity,
32
+ c as getCalculatedFieldComputeStage,
33
+ n as getFieldRuntimeColumnName,
34
+ C as hasCalculatedFieldMarker,
35
+ m as hasCalculatedFormulaInputs,
36
+ D as hasSyntheticCalculatedFieldOwner,
37
+ g as humanizeDatasetName,
29
38
  u as inspectCalculatedField,
30
- D as isCalculatedDimension,
31
- F as isCalculatedMetric,
39
+ F as isCalculatedDimension,
40
+ A as isCalculatedMetric,
32
41
  p as isDerivedField,
33
- A as normalizeCalculatedFieldRepresentation,
42
+ _ as normalizeCalculatedFieldRepresentation,
34
43
  h as resolveFieldDatasetDependencies,
35
- O as resolveQueryColumnKeyMapEntry,
36
- v as resolveUniqueQueryColumnKeyMapEntry,
37
- _ as shouldDropInheritedCalculationAggregate
44
+ v as resolveQueryColumnKeyMapEntry,
45
+ P as resolveUniqueQueryColumnKeyMapEntry,
46
+ L as shouldDropInheritedCalculationAggregate
38
47
  };
@@ -0,0 +1,9 @@
1
+ export declare function useCalculatedFieldTemplates({ endpoint, connectionId, enabled, }: {
2
+ endpoint: string | null;
3
+ connectionId?: string;
4
+ enabled?: boolean;
5
+ }): {
6
+ templates: import('../../types/calculated-field-template-types.js').CalculatedFieldTemplateDefaults | undefined;
7
+ isLoading: boolean;
8
+ error: string | null;
9
+ };
@@ -0,0 +1,54 @@
1
+ import { KeyboardEvent, RefObject } from 'react';
2
+ import { CodeEditorChip, CodeEditorHandle } from '../../../components/semaphor/code-editor.js';
3
+ import { AvailableField } from './use-available-fields.js';
4
+ type Range = {
5
+ start: number;
6
+ end: number;
7
+ };
8
+ /**
9
+ * Clickable placeholders in the calculated-field formula box.
10
+ *
11
+ * Every `{token}` renders as a chip. Tokens that bind to exactly one field
12
+ * (the rule validation uses) are quiet `field` chips; the rest are dashed
13
+ * `pending` chips: template slots like `{a}`, typos, stale or ambiguous
14
+ * references. A pending chip opens a field picker when it is clicked, when
15
+ * the author presses Tab in the formula, or right after a template is
16
+ * inserted. Picking replaces the whole token and moves to the next pending
17
+ * chip.
18
+ *
19
+ * Reference: semaphor-app/src/app/design/calculated-field-placeholders/page.tsx
20
+ */
21
+ export declare function useFormulaPlaceholders({ expression, onExpressionChange, tokenCandidates, textareaId, editorRef, interactive, }: {
22
+ expression: string;
23
+ onExpressionChange: (next: string) => void;
24
+ /** Same candidates validation resolves against. */
25
+ tokenCandidates: Map<string, AvailableField[]>;
26
+ textareaId: string;
27
+ editorRef: RefObject<CodeEditorHandle | null>;
28
+ /** False when read-only or while the formula box is hidden. */
29
+ interactive: boolean;
30
+ }): {
31
+ chips: CodeEditorChip[];
32
+ activeChipIndex: number | null;
33
+ onChipClick: (chipIndex: number) => void;
34
+ onEditorKeyDown: (event: KeyboardEvent<HTMLTextAreaElement & HTMLDivElement>) => void;
35
+ /** Call after inserting text at `range` (offsets in the new value). */
36
+ openFirstIn: import('react').Dispatch<import('react').SetStateAction<Range | null>>;
37
+ reset: () => void;
38
+ summary: {
39
+ placeholders: number;
40
+ unresolved: number;
41
+ };
42
+ picker: {
43
+ token: string | null;
44
+ remaining: number;
45
+ anchorRef: RefObject<{
46
+ getBoundingClientRect: () => DOMRect;
47
+ }>;
48
+ onPick: (field: AvailableField) => void;
49
+ onEscape: () => void;
50
+ onDismiss: () => void;
51
+ onCloseAutoFocus: (event: Event) => void;
52
+ };
53
+ };
54
+ export {};
@@ -1,4 +1,4 @@
1
- import { AuthToken, TBaseQuery, Breakpoint, ControlDefinition, CustomCard, StyleProps, TCard, TDashboard, TEvent, TFrame, TSheet, TStyle, AIScopeTable, TLens, CacheConfig, EmailSettings, FilterLayoutSettings, DocumentDefinition, DashboardInput, DashboardInputSlot, DashboardInputValues, DashboardLifecycleEvent } from '../types/common-types.js';
1
+ import { AuthToken, TBaseQuery, Breakpoint, ControlDefinition, CustomCard, StyleProps, TCard, TDashboard, TEvent, TFrame, TSheet, TStyle, AIScopeTable, TLens, CacheConfig, FilterLayoutSettings, DocumentDefinition, DashboardInput, DashboardInputSlot, DashboardInputValues, DashboardLifecycleEvent } from '../types/common-types.js';
2
2
  import { TFilter, TFilterValue } from '../../components/surfboard/filter/types.js';
3
3
  import { TransientInputContext } from '../dashboard-inputs/transient-input-context.js';
4
4
  import { default as ReactGridLayout } from 'react-grid-layout';
@@ -184,7 +184,6 @@ type Actions = {
184
184
  setDashboardControlsModel: (controls: ControlDefinition[], defaultValues?: Record<string, unknown>, options?: DashboardControlsModelOptions) => void;
185
185
  updateDashboardControl: (controlId: string, updates: Partial<ControlDefinition>) => void;
186
186
  reorderDashboardControls: (orderedControlIds: string[]) => void;
187
- updateEmailSettings: (emailSettings: EmailSettings) => void;
188
187
  setIsDownloadingPdf: (isDownloadingPdf: boolean) => void;
189
188
  setLenses: (lenses: TLens[]) => void;
190
189
  setSelectedLensId: (lensId: string) => void;
@@ -0,0 +1,13 @@
1
+ export declare const CALCULATED_FIELD_TEMPLATE_IDS: readonly ["concatenate", "conditional-category", "date-part", "date-difference", "null-to-zero", "safe-ratio"];
2
+ export type CalculatedFieldTemplateId = (typeof CALCULATED_FIELD_TEMPLATE_IDS)[number];
3
+ export type ResolvedCalculatedFieldTemplate = {
4
+ expression: string;
5
+ outputType: 'number' | 'string';
6
+ };
7
+ export type CalculatedFieldTemplateDefaults = Record<CalculatedFieldTemplateId, ResolvedCalculatedFieldTemplate>;
8
+ export type CalculatedFieldTemplateDefaultsRequest = {
9
+ connectionId: string;
10
+ };
11
+ export type CalculatedFieldTemplateDefaultsResponse = {
12
+ templates: CalculatedFieldTemplateDefaults;
13
+ };
@@ -1568,12 +1568,6 @@ export type CacheConfig = {
1568
1568
  ttl: string;
1569
1569
  status: 'on' | 'on-refresh' | 'off';
1570
1570
  };
1571
- export type EmailSettings = {
1572
- companyName: string;
1573
- dashboardUrl: string;
1574
- supportEmail: string;
1575
- senderTitle: string;
1576
- };
1577
1571
  export type TDashboard = {
1578
1572
  id: string;
1579
1573
  title?: string;
@@ -1597,7 +1591,6 @@ export type TDashboard = {
1597
1591
  aiScopeTables?: AIScopeTable[];
1598
1592
  globalStyle?: TStyle;
1599
1593
  globalCacheConfig?: CacheConfig;
1600
- emailSettings?: EmailSettings;
1601
1594
  defaultFilterValues?: TFilterValue[];
1602
1595
  controls?: ControlDefinition[];
1603
1596
  defaultControlValues?: Record<string, unknown>;
@@ -1,5 +1,6 @@
1
1
  export * from './common-types.js';
2
2
  export * from './explorer-types.js';
3
+ export * from './calculated-field-template-types.js';
3
4
  export * from '../utils/field-dependencies.js';
4
5
  export * from './token-types.js';
5
6
  export * from './briefing-types.js';
@@ -0,0 +1,13 @@
1
+ import { CalculatedFieldTemplateId } from '../types/calculated-field-template-types.js';
2
+ export type RowFormulaTemplateDefinition = {
3
+ id: CalculatedFieldTemplateId;
4
+ label: string;
5
+ symbol: string;
6
+ preview: string;
7
+ hint: string;
8
+ };
9
+ /**
10
+ * Dialect-neutral catalog for row-level authoring shortcuts. The Semaphor App
11
+ * resolver owns executable SQL for each connection dialect.
12
+ */
13
+ export declare const ROW_FORMULA_TEMPLATES: RowFormulaTemplateDefinition[];
@@ -3,6 +3,29 @@ export declare function normalizeToken(token: string): string;
3
3
  export declare function extractExpressionTokens(expression: string): string[];
4
4
  export declare function getUniqueTokens(tokens: string[]): string[];
5
5
  export declare function buildTokenCandidates(fields: AvailableField[]): Map<string, AvailableField[]>;
6
+ export type ExpressionTokenRange = {
7
+ /** Text between the braces, as typed. */
8
+ token: string;
9
+ /** Offset of `{`. */
10
+ start: number;
11
+ /** Offset just past `}`. */
12
+ end: number;
13
+ };
14
+ /** Every `{token}` in the expression with its offsets. Same grammar as
15
+ * `extractExpressionTokens`, so it agrees with validation. */
16
+ export declare function findExpressionTokenRanges(expression: string): ExpressionTokenRange[];
17
+ /** Template slots are single lowercase letters: `{a}`, `{b}`. */
18
+ export declare function isTemplatePlaceholderToken(token: string): boolean;
19
+ /** A token binds only when exactly one field claims it, the same rule
20
+ * `resolveExpressionTokens` uses before validation. */
21
+ export declare function isResolvedToken(token: string, candidates: Map<string, AvailableField[]>): boolean;
22
+ /**
23
+ * Tokens that do not bind to a field, in the order the author should fill
24
+ * them: template placeholders by letter (`{a}` before `{b}`, even when the
25
+ * dialect SQL mentions `{b}` first), then any other unbound token (typo,
26
+ * stale or ambiguous reference) by position.
27
+ */
28
+ export declare function findPendingTokenRanges(ranges: ExpressionTokenRange[], candidates: Map<string, AvailableField[]>): ExpressionTokenRange[];
6
29
  export declare function resolveExpressionTokens(expression: string, fields: AvailableField[]): {
7
30
  orderedTokens: string[];
8
31
  orderedFields: (AvailableField | null)[];
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "email": "support@semaphor.cloud"
6
6
  },
7
7
  "license": "MIT",
8
- "version": "0.1.512",
8
+ "version": "0.1.513",
9
9
  "description": "Fully interactive and customizable dashboards for your apps.",
10
10
  "keywords": [
11
11
  "react",