@philosaether/chipper 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +778 -0
- package/dist/base.css +1 -0
- package/dist/headless.d.ts +16 -0
- package/dist/headless.d.ts.map +1 -0
- package/dist/headless.js +18 -0
- package/dist/index.js +1445 -0
- package/dist/src/builder/index.d.ts +82 -0
- package/dist/src/builder/index.d.ts.map +1 -0
- package/dist/src/builder/predicates.d.ts +18 -0
- package/dist/src/builder/predicates.d.ts.map +1 -0
- package/dist/src/components/Chip.d.ts +15 -0
- package/dist/src/components/Chip.d.ts.map +1 -0
- package/dist/src/components/ChipInfoPopup.d.ts +12 -0
- package/dist/src/components/ChipInfoPopup.d.ts.map +1 -0
- package/dist/src/components/ChipPopup.d.ts +20 -0
- package/dist/src/components/ChipPopup.d.ts.map +1 -0
- package/dist/src/components/Chipper.d.ts +25 -0
- package/dist/src/components/Chipper.d.ts.map +1 -0
- package/dist/src/components/Clause.d.ts +13 -0
- package/dist/src/components/Clause.d.ts.map +1 -0
- package/dist/src/components/Sentence.d.ts +15 -0
- package/dist/src/components/Sentence.d.ts.map +1 -0
- package/dist/src/components/index.d.ts +12 -0
- package/dist/src/components/index.d.ts.map +1 -0
- package/dist/src/components/popups/AlternativeCoordinatePopup.d.ts +16 -0
- package/dist/src/components/popups/AlternativeCoordinatePopup.d.ts.map +1 -0
- package/dist/src/components/popups/KeywordGroupList.d.ts +29 -0
- package/dist/src/components/popups/KeywordGroupList.d.ts.map +1 -0
- package/dist/src/components/popups/KeywordOrExpressionPopup.d.ts +30 -0
- package/dist/src/components/popups/KeywordOrExpressionPopup.d.ts.map +1 -0
- package/dist/src/components/popups/MultiSelectPopup.d.ts +20 -0
- package/dist/src/components/popups/MultiSelectPopup.d.ts.map +1 -0
- package/dist/src/components/popups/NumericInput.d.ts +16 -0
- package/dist/src/components/popups/NumericInput.d.ts.map +1 -0
- package/dist/src/components/popups/ReferencePopup.d.ts +20 -0
- package/dist/src/components/popups/ReferencePopup.d.ts.map +1 -0
- package/dist/src/core/actions/set-chip-value.d.ts +17 -0
- package/dist/src/core/actions/set-chip-value.d.ts.map +1 -0
- package/dist/src/core/actions/set-context.d.ts +18 -0
- package/dist/src/core/actions/set-context.d.ts.map +1 -0
- package/dist/src/core/actions/set-display-value.d.ts +18 -0
- package/dist/src/core/actions/set-display-value.d.ts.map +1 -0
- package/dist/src/core/actions/toggle-clause.d.ts +15 -0
- package/dist/src/core/actions/toggle-clause.d.ts.map +1 -0
- package/dist/src/core/context-resolution.d.ts +36 -0
- package/dist/src/core/context-resolution.d.ts.map +1 -0
- package/dist/src/core/initialize.d.ts +43 -0
- package/dist/src/core/initialize.d.ts.map +1 -0
- package/dist/src/core/mode-switching.d.ts +10 -0
- package/dist/src/core/mode-switching.d.ts.map +1 -0
- package/dist/src/core/reducer.d.ts +16 -0
- package/dist/src/core/reducer.d.ts.map +1 -0
- package/dist/src/core/resolve-keyword-label.d.ts +7 -0
- package/dist/src/core/resolve-keyword-label.d.ts.map +1 -0
- package/dist/src/core/serialize.d.ts +34 -0
- package/dist/src/core/serialize.d.ts.map +1 -0
- package/dist/src/core/state.d.ts +59 -0
- package/dist/src/core/state.d.ts.map +1 -0
- package/dist/src/core/store.d.ts +23 -0
- package/dist/src/core/store.d.ts.map +1 -0
- package/dist/src/core/types.d.ts +242 -0
- package/dist/src/core/types.d.ts.map +1 -0
- package/dist/src/domains/alternative-coordinate.d.ts +110 -0
- package/dist/src/domains/alternative-coordinate.d.ts.map +1 -0
- package/dist/src/domains/create-domain.d.ts +30 -0
- package/dist/src/domains/create-domain.d.ts.map +1 -0
- package/dist/src/domains/facades.d.ts +134 -0
- package/dist/src/domains/facades.d.ts.map +1 -0
- package/dist/src/domains/index.d.ts +14 -0
- package/dist/src/domains/index.d.ts.map +1 -0
- package/dist/src/domains/keyword-or-expression.d.ts +148 -0
- package/dist/src/domains/keyword-or-expression.d.ts.map +1 -0
- package/dist/src/domains/multi-select.d.ts +68 -0
- package/dist/src/domains/multi-select.d.ts.map +1 -0
- package/dist/src/domains/normalize-keywords.d.ts +83 -0
- package/dist/src/domains/normalize-keywords.d.ts.map +1 -0
- package/dist/src/domains/reference.d.ts +89 -0
- package/dist/src/domains/reference.d.ts.map +1 -0
- package/dist/src/hooks/SentenceProvider.d.ts +17 -0
- package/dist/src/hooks/SentenceProvider.d.ts.map +1 -0
- package/dist/src/hooks/context.d.ts +31 -0
- package/dist/src/hooks/context.d.ts.map +1 -0
- package/dist/src/hooks/index.d.ts +13 -0
- package/dist/src/hooks/index.d.ts.map +1 -0
- package/dist/src/hooks/useChip.d.ts +21 -0
- package/dist/src/hooks/useChip.d.ts.map +1 -0
- package/dist/src/hooks/useDisplaySource.d.ts +16 -0
- package/dist/src/hooks/useDisplaySource.d.ts.map +1 -0
- package/dist/src/hooks/useKeyboardNavigation.d.ts +44 -0
- package/dist/src/hooks/useKeyboardNavigation.d.ts.map +1 -0
- package/dist/src/hooks/usePopup.d.ts +13 -0
- package/dist/src/hooks/usePopup.d.ts.map +1 -0
- package/dist/src/hooks/useReferenceDisplay.d.ts +22 -0
- package/dist/src/hooks/useReferenceDisplay.d.ts.map +1 -0
- package/dist/src/hooks/useSentence.d.ts +14 -0
- package/dist/src/hooks/useSentence.d.ts.map +1 -0
- package/dist/src/index.d.ts +25 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/palette/index.d.ts +29 -0
- package/dist/src/palette/index.d.ts.map +1 -0
- package/dist/src/themes/apply-theme.d.ts +34 -0
- package/dist/src/themes/apply-theme.d.ts.map +1 -0
- package/dist/src/themes/create-hue.d.ts +23 -0
- package/dist/src/themes/create-hue.d.ts.map +1 -0
- package/dist/src/themes/index.d.ts +13 -0
- package/dist/src/themes/index.d.ts.map +1 -0
- package/dist/src/themes/midnight.d.ts +11 -0
- package/dist/src/themes/midnight.d.ts.map +1 -0
- package/dist/src/themes/praxis.d.ts +11 -0
- package/dist/src/themes/praxis.d.ts.map +1 -0
- package/dist/src/themes/terminal.d.ts +9 -0
- package/dist/src/themes/terminal.d.ts.map +1 -0
- package/dist/src/themes/types.d.ts +72 -0
- package/dist/src/themes/types.d.ts.map +1 -0
- package/dist/styles.css +1 -0
- package/dist/themes/index.js +256 -0
- package/dist/themes/midnight.css +1 -0
- package/dist/themes/praxis.css +1 -0
- package/dist/themes/terminal.css +1 -0
- package/dist/usePopup-Of6OHa1_.js +653 -0
- package/package.json +75 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sentence builder API.
|
|
3
|
+
*
|
|
4
|
+
* The builder is how consumers define sentences — composing clauses
|
|
5
|
+
* from palette domains with contingency relationships and behavior.
|
|
6
|
+
* See chipper-architecture.md §4, builder-dx.md.
|
|
7
|
+
*/
|
|
8
|
+
import type { ChipDefinition, ChipMode, ClauseDefinition, ContingencyConfig, Palette, RepeatingClauseConfig, SentenceContext, SentenceDefinition } from '../core/types';
|
|
9
|
+
import type { SentenceState } from '../core/state';
|
|
10
|
+
/** Display shorthand accepted by the builder `display` key on ChipOptions. */
|
|
11
|
+
export type DisplayShorthand<T = unknown> = T | ((context: import('../core/types').SentenceContext, state: import('../core/state').SentenceState) => T) | {
|
|
12
|
+
url: string;
|
|
13
|
+
extract: (response: unknown) => T;
|
|
14
|
+
interval?: number;
|
|
15
|
+
} | {
|
|
16
|
+
subscribe: (callback: (value: T) => void) => (() => void);
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Define a chip within a clause.
|
|
20
|
+
*/
|
|
21
|
+
export declare function chip(id: string, domainName?: string | ChipOptions, options?: ChipOptions): ChipDefinition;
|
|
22
|
+
export interface ChipOptions {
|
|
23
|
+
/** Make this a display chip. Accepts a value, function, or source config. */
|
|
24
|
+
display?: DisplayShorthand;
|
|
25
|
+
/** Info popup content for display chips. */
|
|
26
|
+
info?: string | ((value: unknown, state: import('../core/state').SentenceState) => string);
|
|
27
|
+
/** Legacy mode key — prefer `display` for non-interactive chips. */
|
|
28
|
+
mode?: ChipMode;
|
|
29
|
+
present?: (context: SentenceContext) => boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface TextOptions {
|
|
32
|
+
present?: (context: SentenceContext) => boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface PuncOptions {
|
|
35
|
+
display?: (context: SentenceContext) => string;
|
|
36
|
+
present?: (context: SentenceContext) => boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface ClauseBuilder {
|
|
39
|
+
required(): ClauseBuilder;
|
|
40
|
+
optional(): ClauseBuilder;
|
|
41
|
+
text(text: string, options?: TextOptions): ClauseBuilder;
|
|
42
|
+
leads(first: string, rest: string): ClauseBuilder;
|
|
43
|
+
placeholder(text: string): ClauseBuilder;
|
|
44
|
+
chip(id: string, domainName?: string | ChipOptions, options?: ChipOptions): ClauseBuilder;
|
|
45
|
+
punc(options?: PuncOptions): ClauseBuilder;
|
|
46
|
+
contingentOn(superclauseId: string, config: Omit<ContingencyConfig, 'superclauseId'> | ((context: SentenceContext) => boolean)): ClauseBuilder;
|
|
47
|
+
produces(chipIdOrMapping: string | Record<string, string>): ClauseBuilder;
|
|
48
|
+
_build(id: string): ClauseDefinition;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Define a clause within a sentence.
|
|
52
|
+
*
|
|
53
|
+
* Segments are built in call order: .text(), .chip(), .text()
|
|
54
|
+
* all push to the segment list. Text and chips interleave freely.
|
|
55
|
+
*/
|
|
56
|
+
export declare function builder(): ClauseBuilder;
|
|
57
|
+
/**
|
|
58
|
+
* Define a repeating clause group (e.g., "when [condition], and [condition], ...").
|
|
59
|
+
*/
|
|
60
|
+
export declare function repeating(clauseBuilder: ClauseBuilder, options: {
|
|
61
|
+
min?: number;
|
|
62
|
+
max?: number;
|
|
63
|
+
}): RepeatingClauseConfig;
|
|
64
|
+
interface LineOptions {
|
|
65
|
+
indent?: boolean;
|
|
66
|
+
}
|
|
67
|
+
interface SentenceBuilder {
|
|
68
|
+
clause(id: string, clauseBuilder: ClauseBuilder): SentenceBuilder;
|
|
69
|
+
clauses(clauseBuilders: ClauseBuilder[]): SentenceBuilder;
|
|
70
|
+
line(options?: LineOptions): SentenceBuilder;
|
|
71
|
+
serializer(fn: (state: SentenceState) => Record<string, unknown>): SentenceBuilder;
|
|
72
|
+
deserializer(fn: (data: Record<string, unknown>) => Record<string, unknown>): SentenceBuilder;
|
|
73
|
+
build(): SentenceDefinition;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Define a sentence. Entry point for the builder API.
|
|
77
|
+
*
|
|
78
|
+
* @param palette - The palette to resolve domain names from. Defaults to chipperPalette.
|
|
79
|
+
*/
|
|
80
|
+
export declare function sentence(palette?: Palette): SentenceBuilder;
|
|
81
|
+
export {};
|
|
82
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/builder/index.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Predicate helpers — factories that return context predicates for use
|
|
3
|
+
* with `present`, `contingentOn`, and `.punc({ present })`.
|
|
4
|
+
*/
|
|
5
|
+
import type { SentenceContext } from '../core/types';
|
|
6
|
+
/**
|
|
7
|
+
* True when the context value for `key` is a numeric string.
|
|
8
|
+
*
|
|
9
|
+
* Usage: `.chip('unit', 'timeUnit', { present: isNumeric('measure') })`
|
|
10
|
+
*/
|
|
11
|
+
export declare function isNumeric(key: string): (context: SentenceContext) => boolean;
|
|
12
|
+
/**
|
|
13
|
+
* True when the context value for `key` is one of the given values.
|
|
14
|
+
*
|
|
15
|
+
* Usage: `.punc({ present: isOneOf('measure', 'daily', 'weekday', 'weekend') })`
|
|
16
|
+
*/
|
|
17
|
+
export declare function isOneOf(key: string, ...values: string[]): (context: SentenceContext) => boolean;
|
|
18
|
+
//# sourceMappingURL=predicates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"predicates.d.ts","sourceRoot":"","sources":["../../../src/builder/predicates.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAErD;;;;GAIG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,CAAC,OAAO,EAAE,eAAe,KAAK,OAAO,CAK5E;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,OAAO,EAAE,eAAe,KAAK,OAAO,CAG/F"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chip — trigger button + popup mount point.
|
|
3
|
+
*
|
|
4
|
+
* Reads chip state from useChip, manages popup via usePopup.
|
|
5
|
+
* The popup renders conditionally (unmounted when closed).
|
|
6
|
+
*
|
|
7
|
+
* Interactive chips open a domain-specific input popup.
|
|
8
|
+
* Display chips optionally open a read-only info popup.
|
|
9
|
+
*/
|
|
10
|
+
export interface ChipProps {
|
|
11
|
+
clauseId: string;
|
|
12
|
+
chipId: string;
|
|
13
|
+
}
|
|
14
|
+
export declare function Chip({ clauseId, chipId }: ChipProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=Chip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chip.d.ts","sourceRoot":"","sources":["../../../src/components/Chip.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAYH,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,wBAAgB,IAAI,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,SAAS,2CAyHnD"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ChipInfoPopup — read-only info popup for display chips.
|
|
3
|
+
*
|
|
4
|
+
* Shows provenance/context text. Reuses popup positioning but
|
|
5
|
+
* renders a simple text block instead of domain-specific input UI.
|
|
6
|
+
*/
|
|
7
|
+
export interface ChipInfoPopupProps {
|
|
8
|
+
content: string;
|
|
9
|
+
onClose: () => void;
|
|
10
|
+
}
|
|
11
|
+
export declare function ChipInfoPopup({ content, onClose }: ChipInfoPopupProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
//# sourceMappingURL=ChipInfoPopup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChipInfoPopup.d.ts","sourceRoot":"","sources":["../../../src/components/ChipInfoPopup.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,MAAM,WAAW,kBAAkB;IACjC,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,aAAa,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,kBAAkB,2CAgCrE"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ChipPopup — popup container with positioning, Escape, outside-click,
|
|
3
|
+
* and archetype routing.
|
|
4
|
+
*
|
|
5
|
+
* Positioned via CSS (absolute, below trigger). Routes to the
|
|
6
|
+
* appropriate archetype popup based on domain.type.
|
|
7
|
+
*/
|
|
8
|
+
import type { Domain, SentenceContext } from '../core/types';
|
|
9
|
+
export interface ChipPopupProps {
|
|
10
|
+
clauseId: string;
|
|
11
|
+
chipId: string;
|
|
12
|
+
domain: Domain;
|
|
13
|
+
value: unknown;
|
|
14
|
+
expressionActive?: boolean;
|
|
15
|
+
context?: SentenceContext;
|
|
16
|
+
onSelect: (value: unknown) => void;
|
|
17
|
+
onClose: () => void;
|
|
18
|
+
}
|
|
19
|
+
export declare function ChipPopup({ chipId, domain, value, expressionActive, context, onSelect, onClose }: ChipPopupProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
//# sourceMappingURL=ChipPopup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ChipPopup.d.ts","sourceRoot":"","sources":["../../../src/components/ChipPopup.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,MAAM,EAA2B,eAAe,EAAE,MAAM,eAAe,CAAC;AAUtF,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACnC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAED,wBAAgB,SAAS,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,cAAc,2CAoIhH"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chipper — top-level auto-rendering component.
|
|
3
|
+
*
|
|
4
|
+
* Wraps SentenceProvider + Sentence. Consumers write:
|
|
5
|
+
* <Chipper sentence={def} onChange={fn} />
|
|
6
|
+
*
|
|
7
|
+
* For custom layouts, pass children instead of relying on auto-render:
|
|
8
|
+
* <Chipper sentence={def} onChange={fn}>
|
|
9
|
+
* <MyCustomLayout />
|
|
10
|
+
* </Chipper>
|
|
11
|
+
*/
|
|
12
|
+
import type { SentenceDefinition } from '../core/types';
|
|
13
|
+
import type { SentenceState } from '../core/state';
|
|
14
|
+
export interface ChipperProps {
|
|
15
|
+
/** The sentence definition to render */
|
|
16
|
+
sentence: SentenceDefinition;
|
|
17
|
+
/** Saved values to restore on mount (from serialize()) */
|
|
18
|
+
initialValues?: Record<string, unknown>;
|
|
19
|
+
/** Called on every state change */
|
|
20
|
+
onChange?: (state: SentenceState) => void;
|
|
21
|
+
/** Custom children — if provided, replaces auto-rendered Sentence */
|
|
22
|
+
children?: React.ReactNode;
|
|
23
|
+
}
|
|
24
|
+
export declare function Chipper({ sentence, initialValues, onChange, children }: ChipperProps): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
//# sourceMappingURL=Chipper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Chipper.d.ts","sourceRoot":"","sources":["../../../src/components/Chipper.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAInD,MAAM,WAAW,YAAY;IAC3B,wCAAwC;IACxC,QAAQ,EAAE,kBAAkB,CAAC;IAE7B,0DAA0D;IAC1D,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAExC,mCAAmC;IACnC,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAE1C,qEAAqE;IACrE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC5B;AAED,wBAAgB,OAAO,CAAC,EAAE,QAAQ,EAAE,aAAa,EAAE,QAAQ,EAAE,QAAQ,EAAE,EAAE,YAAY,2CAMpF"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Clause — renders interleaved text and chips for a single clause.
|
|
3
|
+
*
|
|
4
|
+
* Handles three presentation modes:
|
|
5
|
+
* - Contingent + latent: returns null (clause not rendered)
|
|
6
|
+
* - Optional + dormant: shows ↳ toggle + segments as plain text (muted italic)
|
|
7
|
+
* - Active: shows segments with interactive chips (with × toggle for optional)
|
|
8
|
+
*/
|
|
9
|
+
export interface ClauseProps {
|
|
10
|
+
clauseId: string;
|
|
11
|
+
}
|
|
12
|
+
export declare function Clause({ clauseId }: ClauseProps): import("react/jsx-runtime").JSX.Element | null;
|
|
13
|
+
//# sourceMappingURL=Clause.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Clause.d.ts","sourceRoot":"","sources":["../../../src/components/Clause.tsx"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAOH,MAAM,WAAW,WAAW;IAC1B,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,MAAM,CAAC,EAAE,QAAQ,EAAE,EAAE,WAAW,kDAuG/C"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sentence — renders the clause list from the sentence definition.
|
|
3
|
+
*
|
|
4
|
+
* Reads definition from context. No props — the structure comes
|
|
5
|
+
* from the SentenceProvider above.
|
|
6
|
+
*
|
|
7
|
+
* If the definition includes lines, clauses are grouped into
|
|
8
|
+
* chipper-line wrappers. Otherwise each clause gets its own line.
|
|
9
|
+
*
|
|
10
|
+
* Indent is derived: a line is indented if all its clauses are
|
|
11
|
+
* optional or contingent-not-present. Explicit indent on
|
|
12
|
+
* LineDefinition overrides this.
|
|
13
|
+
*/
|
|
14
|
+
export declare function Sentence(): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
//# sourceMappingURL=Sentence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Sentence.d.ts","sourceRoot":"","sources":["../../../src/components/Sentence.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA+CH,wBAAgB,QAAQ,4CAoBvB"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { Chipper, type ChipperProps } from './Chipper';
|
|
2
|
+
export { Sentence } from './Sentence';
|
|
3
|
+
export { Clause, type ClauseProps } from './Clause';
|
|
4
|
+
export { Chip, type ChipProps } from './Chip';
|
|
5
|
+
export { ChipPopup, type ChipPopupProps } from './ChipPopup';
|
|
6
|
+
export { ChipInfoPopup, type ChipInfoPopupProps } from './ChipInfoPopup';
|
|
7
|
+
export { KeywordOrExpressionPopup, type KeywordOrExpressionPopupProps, } from './popups/KeywordOrExpressionPopup';
|
|
8
|
+
export { MultiSelectPopup, type MultiSelectPopupProps, } from './popups/MultiSelectPopup';
|
|
9
|
+
export { AlternativeCoordinatePopup, type AlternativeCoordinatePopupProps, } from './popups/AlternativeCoordinatePopup';
|
|
10
|
+
export { NumericInput, type NumericInputProps } from './popups/NumericInput';
|
|
11
|
+
export { ReferencePopup, type ReferencePopupProps, } from './popups/ReferencePopup';
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AACpD,OAAO,EAAE,IAAI,EAAE,KAAK,SAAS,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACzE,OAAO,EACL,wBAAwB,EACxB,KAAK,6BAA6B,GACnC,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EACL,gBAAgB,EAChB,KAAK,qBAAqB,GAC3B,MAAM,2BAA2B,CAAC;AACnC,OAAO,EACL,0BAA0B,EAC1B,KAAK,+BAA+B,GACrC,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EACL,cAAc,EACd,KAAK,mBAAmB,GACzB,MAAM,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AlternativeCoordinatePopup — tabbed popup with slot-based selection.
|
|
3
|
+
*
|
|
4
|
+
* Each tab renders one mode's slots. Single-slot modes close on keyword
|
|
5
|
+
* select (like enum). Multi-slot modes stay open until all slots are
|
|
6
|
+
* filled, then auto-close. Expression submission always closes.
|
|
7
|
+
*/
|
|
8
|
+
import type { ResolvedAlternativeCoordinateMode } from '../../domains/alternative-coordinate';
|
|
9
|
+
export interface AlternativeCoordinatePopupProps {
|
|
10
|
+
modes: ResolvedAlternativeCoordinateMode[];
|
|
11
|
+
value: string;
|
|
12
|
+
onSelect: (value: string) => void;
|
|
13
|
+
onClose: () => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function AlternativeCoordinatePopup({ modes, value, onSelect, onClose, }: AlternativeCoordinatePopupProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=AlternativeCoordinatePopup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AlternativeCoordinatePopup.d.ts","sourceRoot":"","sources":["../../../../src/components/popups/AlternativeCoordinatePopup.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,sCAAsC,CAAC;AAK9F,MAAM,WAAW,+BAA+B;IAC9C,KAAK,EAAE,iCAAiC,EAAE,CAAC;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AA0CD,wBAAgB,0BAA0B,CAAC,EACzC,KAAK,EACL,KAAK,EACL,QAAQ,EACR,OAAO,GACR,EAAE,+BAA+B,2CA2LjC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KeywordGroupList — shared rendering for grouped keywords.
|
|
3
|
+
*
|
|
4
|
+
* Renders NormalizedKeywordGroup[] as visual sections with optional
|
|
5
|
+
* labels, prefixes, and flow/grid layouts. Used by KOE, multi-select,
|
|
6
|
+
* and alt-coordinate popups.
|
|
7
|
+
*
|
|
8
|
+
* See keyword-grouping.md.
|
|
9
|
+
*/
|
|
10
|
+
import type { Keyword, SentenceContext } from '../../core/types';
|
|
11
|
+
import type { NormalizedKeywordGroup } from '../../domains/normalize-keywords';
|
|
12
|
+
export interface KeywordGroupListProps {
|
|
13
|
+
groups: NormalizedKeywordGroup<string>[];
|
|
14
|
+
context?: SentenceContext;
|
|
15
|
+
/** Called with the keyword's flat index (across all groups) */
|
|
16
|
+
getOptionProps: (index: number) => Record<string, unknown>;
|
|
17
|
+
/** Render selected state for a keyword */
|
|
18
|
+
isSelected?: (keyword: Keyword<string>) => boolean;
|
|
19
|
+
/** Render disabled state for a keyword */
|
|
20
|
+
isDisabled?: (keyword: Keyword<string>) => boolean;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Render grouped keywords with labels, prefixes, and layout variants.
|
|
24
|
+
*
|
|
25
|
+
* Flat keyword index is computed by summing keywords in prior groups,
|
|
26
|
+
* so keyboard navigation stays linear across all groups.
|
|
27
|
+
*/
|
|
28
|
+
export declare function KeywordGroupList({ groups, context, getOptionProps, isSelected, isDisabled, }: KeywordGroupListProps): import("react/jsx-runtime").JSX.Element;
|
|
29
|
+
//# sourceMappingURL=KeywordGroupList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeywordGroupList.d.ts","sourceRoot":"","sources":["../../../../src/components/popups/KeywordGroupList.tsx"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAG/E,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,sBAAsB,CAAC,MAAM,CAAC,EAAE,CAAC;IACzC,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,+DAA+D;IAC/D,cAAc,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC3D,0CAA0C;IAC1C,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,OAAO,CAAC;IACnD,0CAA0C;IAC1C,UAAU,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,KAAK,OAAO,CAAC;CACpD;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,OAAO,EACP,cAAc,EACd,UAAU,EACV,UAAU,GACX,EAAE,qBAAqB,2CAwDvB"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* KeywordOrExpressionPopup — keyword pills + text/numeric input.
|
|
3
|
+
*
|
|
4
|
+
* Three layout modes:
|
|
5
|
+
* 1. Always-on expression (no trigger): keywords + expression visible simultaneously.
|
|
6
|
+
* 2. Trigger-gated, keyword mode: keywords + trigger pill, no expression input.
|
|
7
|
+
* 3. Trigger-gated, expression mode: keywords (escape hatches) + expression input.
|
|
8
|
+
*
|
|
9
|
+
* Text: keyword click or Enter submits. Valid input auto-saves on close.
|
|
10
|
+
* Numeric: stepper buttons submit immediately. Manual entry validates.
|
|
11
|
+
*/
|
|
12
|
+
import type { ExpressionMode, Keyword, SentenceContext } from '../../core/types';
|
|
13
|
+
import type { NormalizedKeywordGroup } from '../../domains/normalize-keywords';
|
|
14
|
+
export interface KeywordOrExpressionPopupProps {
|
|
15
|
+
keywords: Keyword<string>[];
|
|
16
|
+
keywordGroups?: NormalizedKeywordGroup<string>[];
|
|
17
|
+
value: string;
|
|
18
|
+
expressionMode?: ExpressionMode<string>;
|
|
19
|
+
/** Is the chip currently in trigger-gated expression mode? */
|
|
20
|
+
expressionActive?: boolean;
|
|
21
|
+
/** Label for the trigger pill (absent = always-on expression). */
|
|
22
|
+
triggerLabel?: string;
|
|
23
|
+
/** Sentence context for resolving dynamic prefix/suffix. */
|
|
24
|
+
context?: SentenceContext;
|
|
25
|
+
maxLength?: number;
|
|
26
|
+
onSelect: (value: string | symbol) => void;
|
|
27
|
+
onClose: () => void;
|
|
28
|
+
}
|
|
29
|
+
export declare function KeywordOrExpressionPopup({ keywords, keywordGroups, value, expressionMode, expressionActive, triggerLabel, context, maxLength, onSelect, onClose, }: KeywordOrExpressionPopupProps): import("react/jsx-runtime").JSX.Element;
|
|
30
|
+
//# sourceMappingURL=KeywordOrExpressionPopup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"KeywordOrExpressionPopup.d.ts","sourceRoot":"","sources":["../../../../src/components/popups/KeywordOrExpressionPopup.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AACjF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAO/E,MAAM,WAAW,6BAA6B;IAC5C,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;IAC5B,aAAa,CAAC,EAAE,sBAAsB,CAAC,MAAM,CAAC,EAAE,CAAC;IACjD,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,CAAC,EAAE,cAAc,CAAC,MAAM,CAAC,CAAC;IACxC,8DAA8D;IAC9D,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,kEAAkE;IAClE,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,4DAA4D;IAC5D,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,KAAK,IAAI,CAAC;IAC3C,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB;AAMD,wBAAgB,wBAAwB,CAAC,EACvC,QAAQ,EACR,aAAa,EACb,KAAK,EACL,cAAc,EACd,gBAAgB,EAChB,YAAY,EACZ,OAAO,EACP,SAAS,EACT,QAAQ,EACR,OAAO,GACR,EAAE,6BAA6B,2CAuN/B"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MultiSelectPopup — toggle grid with optional group keyword shortcuts.
|
|
3
|
+
*
|
|
4
|
+
* Unlike enum/KOE popups, this popup stays open during selection.
|
|
5
|
+
* The user toggles options freely and closes via outside-click,
|
|
6
|
+
* Escape, or trigger re-click.
|
|
7
|
+
*/
|
|
8
|
+
import type { Keyword } from '../../core/types';
|
|
9
|
+
import type { NormalizedKeywordGroup } from '../../domains/normalize-keywords';
|
|
10
|
+
export interface MultiSelectPopupProps {
|
|
11
|
+
options: Keyword<string>[];
|
|
12
|
+
optionGroups?: NormalizedKeywordGroup<string>[];
|
|
13
|
+
keywords: Keyword<string[]>[];
|
|
14
|
+
value: string[];
|
|
15
|
+
maxSelections?: number;
|
|
16
|
+
onSelect: (value: string[]) => void;
|
|
17
|
+
onClose?: () => void;
|
|
18
|
+
}
|
|
19
|
+
export declare function MultiSelectPopup({ options, optionGroups, keywords, value, maxSelections, onSelect, onClose, }: MultiSelectPopupProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
//# sourceMappingURL=MultiSelectPopup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MultiSelectPopup.d.ts","sourceRoot":"","sources":["../../../../src/components/popups/MultiSelectPopup.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAM/E,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;IAC3B,YAAY,CAAC,EAAE,sBAAsB,CAAC,MAAM,CAAC,EAAE,CAAC;IAChD,QAAQ,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;IAC9B,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACpC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,wBAAgB,gBAAgB,CAAC,EAC/B,OAAO,EACP,YAAY,EACZ,QAAQ,EACR,KAAK,EACL,aAAa,EACb,QAAQ,EACR,OAAO,GACR,EAAE,qBAAqB,2CA2GvB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* NumericInput — number stepper with +/- buttons.
|
|
3
|
+
*
|
|
4
|
+
* Renders: [ − ] value [ + ]
|
|
5
|
+
* Submits on change (no Enter required — each click/edit is a selection).
|
|
6
|
+
*/
|
|
7
|
+
export interface NumericInputProps {
|
|
8
|
+
value: string;
|
|
9
|
+
min?: number;
|
|
10
|
+
max?: number;
|
|
11
|
+
step?: number;
|
|
12
|
+
onSelect: (value: string) => void;
|
|
13
|
+
onSubmit?: () => void;
|
|
14
|
+
}
|
|
15
|
+
export declare function NumericInput({ value, min, max, step, onSelect, onSubmit, }: NumericInputProps): import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
//# sourceMappingURL=NumericInput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NumericInput.d.ts","sourceRoot":"","sources":["../../../../src/components/popups/NumericInput.tsx"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,GAAG,EACH,GAAG,EACH,IAAQ,EACR,QAAQ,EACR,QAAQ,GACT,EAAE,iBAAiB,2CAqEnB"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ReferencePopup — navigation/search popup for reference domains.
|
|
3
|
+
*
|
|
4
|
+
* Supports hierarchical tree navigation (breadcrumb + drill-in) and
|
|
5
|
+
* flat list search. Items can be selectable, drillable, or both.
|
|
6
|
+
* Handles sync and async data sources transparently.
|
|
7
|
+
*/
|
|
8
|
+
import type { Keyword } from '../../core/types';
|
|
9
|
+
import type { ReferenceSource } from '../../domains/reference';
|
|
10
|
+
export interface ReferencePopupProps {
|
|
11
|
+
source: ReferenceSource;
|
|
12
|
+
keywords: Keyword<string>[];
|
|
13
|
+
value: string;
|
|
14
|
+
onSelect: (value: string) => void;
|
|
15
|
+
onClose: () => void;
|
|
16
|
+
/** Write-through to the domain's display cache */
|
|
17
|
+
displayCache: Map<string, string>;
|
|
18
|
+
}
|
|
19
|
+
export declare function ReferencePopup({ source, keywords, value, onSelect, onClose, displayCache, }: ReferencePopupProps): import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
//# sourceMappingURL=ReferencePopup.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ReferencePopup.d.ts","sourceRoot":"","sources":["../../../../src/components/popups/ReferencePopup.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEhD,OAAO,KAAK,EAAiB,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG9E,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,eAAe,CAAC;IACxB,QAAQ,EAAE,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,kDAAkD;IAClD,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACnC;AAKD,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,OAAO,EACP,YAAY,GACb,EAAE,mBAAmB,2CAwVrB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SET_CHIP_VALUE action — updates a chip's value, revalidates, recomputes display.
|
|
3
|
+
*
|
|
4
|
+
* When the chip's clause produces context, triggers context propagation
|
|
5
|
+
* to evaluate contingent clauses. See contingency-engine.md §4.
|
|
6
|
+
*/
|
|
7
|
+
import type { SentenceStore } from '../store';
|
|
8
|
+
/** Set a chip's value. */
|
|
9
|
+
export interface SetChipValueAction {
|
|
10
|
+
type: 'SET_CHIP_VALUE';
|
|
11
|
+
clauseId: string;
|
|
12
|
+
chipId: string;
|
|
13
|
+
value: unknown;
|
|
14
|
+
}
|
|
15
|
+
/** Handle SET_CHIP_VALUE: update chip, cascade validity, propagate context. */
|
|
16
|
+
export declare function handleSetChipValue(store: SentenceStore, action: SetChipValueAction): SentenceStore;
|
|
17
|
+
//# sourceMappingURL=set-chip-value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-chip-value.d.ts","sourceRoot":"","sources":["../../../../src/core/actions/set-chip-value.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAM9C,0BAA0B;AAC1B,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,gBAAgB,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,+EAA+E;AAC/E,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,kBAAkB,GACzB,aAAa,CAyFf"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SET_CONTEXT action — updates scoped context and evaluates contingent clauses.
|
|
3
|
+
*
|
|
4
|
+
* Delegates to the contingency engine's evaluateContingency function
|
|
5
|
+
* for presence evaluation, domain reconfiguration, and cascade.
|
|
6
|
+
* See contingency-engine.md §3.
|
|
7
|
+
*/
|
|
8
|
+
import type { SentenceContext } from '../types';
|
|
9
|
+
import type { SentenceStore } from '../store';
|
|
10
|
+
/** Update scoped context values for a clause. */
|
|
11
|
+
export interface SetContextAction {
|
|
12
|
+
type: 'SET_CONTEXT';
|
|
13
|
+
clauseId: string;
|
|
14
|
+
values: SentenceContext;
|
|
15
|
+
}
|
|
16
|
+
/** Handle SET_CONTEXT: evaluate contingency and cascade. */
|
|
17
|
+
export declare function handleSetContext(store: SentenceStore, action: SetContextAction): SentenceStore;
|
|
18
|
+
//# sourceMappingURL=set-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-context.d.ts","sourceRoot":"","sources":["../../../../src/core/actions/set-context.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,UAAU,CAAC;AAChD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9C,iDAAiD;AACjD,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,aAAa,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,eAAe,CAAC;CACzB;AAED,4DAA4D;AAC5D,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,gBAAgB,GACvB,aAAa,CAEf"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SET_DISPLAY_VALUE action — updates a display chip with a new value from its source.
|
|
3
|
+
*
|
|
4
|
+
* Handles static, derived, remote, and external display sources.
|
|
5
|
+
* Updates value, displayValue, loading, error, and lastUpdated on ChipState.
|
|
6
|
+
*/
|
|
7
|
+
import type { SentenceStore } from '../store';
|
|
8
|
+
/** Update a display chip's value from its source. */
|
|
9
|
+
export interface SetDisplayValueAction {
|
|
10
|
+
type: 'SET_DISPLAY_VALUE';
|
|
11
|
+
chipId: string;
|
|
12
|
+
value: unknown;
|
|
13
|
+
loading?: boolean;
|
|
14
|
+
error?: string;
|
|
15
|
+
}
|
|
16
|
+
/** Handle SET_DISPLAY_VALUE — write value + display state into the chip. */
|
|
17
|
+
export declare function handleSetDisplayValue(store: SentenceStore, action: SetDisplayValueAction): SentenceStore;
|
|
18
|
+
//# sourceMappingURL=set-display-value.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-display-value.d.ts","sourceRoot":"","sources":["../../../../src/core/actions/set-display-value.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9C,qDAAqD;AACrD,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,mBAAmB,CAAC;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,4EAA4E;AAC5E,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,qBAAqB,GAC5B,aAAa,CAmDf"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TOGGLE_CLAUSE action — activates or deactivates an optional clause.
|
|
3
|
+
*
|
|
4
|
+
* Only affects user-controlled activation, never engine-controlled presence.
|
|
5
|
+
* See contingency-engine.md §2.
|
|
6
|
+
*/
|
|
7
|
+
import type { SentenceStore } from '../store';
|
|
8
|
+
/** Toggle an optional clause's active state. */
|
|
9
|
+
export interface ToggleClauseAction {
|
|
10
|
+
type: 'TOGGLE_CLAUSE';
|
|
11
|
+
clauseId: string;
|
|
12
|
+
}
|
|
13
|
+
/** Handle TOGGLE_CLAUSE: flip active, cascade validity. */
|
|
14
|
+
export declare function handleToggleClause(store: SentenceStore, action: ToggleClauseAction): SentenceStore;
|
|
15
|
+
//# sourceMappingURL=toggle-clause.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toggle-clause.d.ts","sourceRoot":"","sources":["../../../../src/core/actions/toggle-clause.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAG9C,gDAAgD;AAChD,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,eAAe,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,2DAA2D;AAC3D,wBAAgB,kBAAkB,CAChC,KAAK,EAAE,aAAa,EACpB,MAAM,EAAE,kBAAkB,GACzB,aAAa,CAmBf"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Context resolution — tree-scoped context propagation for the contingency engine.
|
|
3
|
+
*
|
|
4
|
+
* Context propagates down the contingency tree. A producing clause writes
|
|
5
|
+
* context visible to its contingent descendants. A consuming clause walks
|
|
6
|
+
* up its contingency chain to find the nearest ancestor producer.
|
|
7
|
+
*
|
|
8
|
+
* See chipper-architecture.md §1 (Sentence Context) and
|
|
9
|
+
* contingency-engine.md §3 (Context Propagation).
|
|
10
|
+
*/
|
|
11
|
+
import type { SentenceContext, ClauseDefinition } from './types';
|
|
12
|
+
import type { ChipState, ContextScope } from './state';
|
|
13
|
+
import type { SentenceStore } from './store';
|
|
14
|
+
/**
|
|
15
|
+
* Build a clause's full context by merging ancestor context with its own productions.
|
|
16
|
+
* Used for evaluating segment predicates (both chip and text visibility).
|
|
17
|
+
*/
|
|
18
|
+
export declare function buildClauseContext(clauseId: string, clauseDef: ClauseDefinition, clauseChips: Record<string, ChipState>, clauseById: Map<string, ClauseDefinition>, contexts: ContextScope[]): SentenceContext;
|
|
19
|
+
/**
|
|
20
|
+
* Resolve the full context visible to a clause by walking up the contingency chain.
|
|
21
|
+
* Nearest ancestor's values win — keys already resolved are not overwritten.
|
|
22
|
+
*/
|
|
23
|
+
export declare function resolveContext(clauseId: string, clauseById: Map<string, ClauseDefinition>, contexts: ContextScope[]): SentenceContext;
|
|
24
|
+
/**
|
|
25
|
+
* Evaluate contingency for all clauses contingent on a given clause.
|
|
26
|
+
* Updates presence, applies domain reconfiguration, revalidates chips,
|
|
27
|
+
* and cascades through subtrees.
|
|
28
|
+
*/
|
|
29
|
+
export declare function evaluateContingency(store: SentenceStore, clauseId: string, values: SentenceContext): SentenceStore;
|
|
30
|
+
/**
|
|
31
|
+
* Run initial context evaluation after state initialization.
|
|
32
|
+
* For each clause that produces context, compute context from default
|
|
33
|
+
* chip values and evaluate contingent clauses.
|
|
34
|
+
*/
|
|
35
|
+
export declare function runInitialContextPass(store: SentenceStore): SentenceStore;
|
|
36
|
+
//# sourceMappingURL=context-resolution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-resolution.d.ts","sourceRoot":"","sources":["../../../src/core/context-resolution.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAsB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AACrF,OAAO,KAAK,EAAE,SAAS,EAAe,YAAY,EAAE,MAAM,SAAS,CAAC;AACpE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAG7C;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,gBAAgB,EAC3B,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EACtC,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,EACzC,QAAQ,EAAE,YAAY,EAAE,GACvB,eAAe,CASjB;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,EACzC,QAAQ,EAAE,YAAY,EAAE,GACvB,eAAe,CAuBjB;AAaD;;;;GAIG;AACH,wBAAgB,mBAAmB,CACjC,KAAK,EAAE,aAAa,EACpB,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,eAAe,GACtB,aAAa,CA2Hf;AA8ED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,aAAa,GAAG,aAAa,CAiBzE"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* State initialization — creates a SentenceStore from a SentenceDefinition.
|
|
3
|
+
*
|
|
4
|
+
* Resolves each chip's domain from the palette, creates initial ChipState
|
|
5
|
+
* with defaultValue, and derives clause/sentence validity. Runs an initial
|
|
6
|
+
* context evaluation pass so contingent clauses start in the correct state.
|
|
7
|
+
*/
|
|
8
|
+
import type { Domain, SentenceContext, SentenceDefinition } from './types';
|
|
9
|
+
import type { ChipState, ClauseState } from './state';
|
|
10
|
+
import type { SentenceStore } from './store';
|
|
11
|
+
/** Compute displayValue from a domain and value. Context enables dynamic display. */
|
|
12
|
+
export declare function computeDisplayValue(domain: Domain, value: unknown, isValid: boolean, context?: SentenceContext): string;
|
|
13
|
+
/** Derive clause validity: all visible chips must be valid. */
|
|
14
|
+
export declare function computeClauseValidity(chips: Record<string, ChipState>, visibleChips?: string[]): boolean;
|
|
15
|
+
/** Derive sentence validity: all present+active clauses must be valid. */
|
|
16
|
+
export declare function computeSentenceValidity(clauses: Record<string, ClauseState>): boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Build context values from a clause's chips using its contextProductions mapping.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* Build context values from a clause's chips using its contextProductions mapping.
|
|
22
|
+
* Hidden chips (not in visibleChips) are excluded from context production.
|
|
23
|
+
*/
|
|
24
|
+
export declare function buildContextFromChips(contextProductions: Record<string, string>, clauseState: ClauseState): SentenceContext;
|
|
25
|
+
/**
|
|
26
|
+
* Evaluate which chips in a clause are visible based on segment presence predicates.
|
|
27
|
+
* Returns undefined if all chips are unconditionally visible (no predicates).
|
|
28
|
+
*/
|
|
29
|
+
export declare function evaluateVisibleChips(segments: import('./types').ClauseSegment[], context: SentenceContext): string[] | undefined;
|
|
30
|
+
/**
|
|
31
|
+
* Create a SentenceStore from a sentence definition.
|
|
32
|
+
*
|
|
33
|
+
* Resolves domains from the palette, initializes chip state with
|
|
34
|
+
* default values (or initial values if provided), and derives
|
|
35
|
+
* clause/sentence validity. Runs an initial context pass so contingent
|
|
36
|
+
* clauses reflect the starting values.
|
|
37
|
+
*
|
|
38
|
+
* @param initialValues — Optional saved data to overlay. Keys are chip IDs
|
|
39
|
+
* with their values. `__active` maps optional clause IDs to activation state.
|
|
40
|
+
* `__expressionMode` maps chip IDs to expression mode flags.
|
|
41
|
+
*/
|
|
42
|
+
export declare function initializeSentenceState(definition: SentenceDefinition, initialValues?: Record<string, unknown>): SentenceStore;
|
|
43
|
+
//# sourceMappingURL=initialize.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initialize.d.ts","sourceRoot":"","sources":["../../../src/core/initialize.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAW,eAAe,EAAE,kBAAkB,EAAE,MAAM,SAAS,CAAC;AACpF,OAAO,KAAK,EAAE,SAAS,EAAE,WAAW,EAAiB,MAAM,SAAS,CAAC;AACrE,OAAO,KAAK,EAAmB,aAAa,EAAE,MAAM,SAAS,CAAC;AAkB9D,qFAAqF;AACrF,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,OAAO,EAChB,OAAO,CAAC,EAAE,eAAe,GACxB,MAAM,CAKR;AAED,+DAA+D;AAC/D,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,EAChC,YAAY,CAAC,EAAE,MAAM,EAAE,GACtB,OAAO,CAMT;AAED,0EAA0E;AAC1E,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,OAAO,CAErF;AAED;;GAEG;AACH;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC1C,WAAW,EAAE,WAAW,GACvB,eAAe,CAUjB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,EAAE,OAAO,SAAS,EAAE,aAAa,EAAE,EAC3C,OAAO,EAAE,eAAe,GACvB,MAAM,EAAE,GAAG,SAAS,CAkBtB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,uBAAuB,CACrC,UAAU,EAAE,kBAAkB,EAC9B,aAAa,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GACtC,aAAa,CAwEf"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Mode-switching primitives.
|
|
3
|
+
*
|
|
4
|
+
* A trigger keyword enters expression mode instead of storing a value.
|
|
5
|
+
* The popup sends TRIGGER_SENTINEL via SET_CHIP_VALUE; the reducer
|
|
6
|
+
* detects it and substitutes the expression default.
|
|
7
|
+
*/
|
|
8
|
+
/** Sentinel value dispatched by the popup when the user clicks a trigger keyword. */
|
|
9
|
+
export declare const TRIGGER_SENTINEL: unique symbol;
|
|
10
|
+
//# sourceMappingURL=mode-switching.d.ts.map
|