@molecule/app-ide-panel-logic 1.1.0 → 1.3.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/README.md +368 -3
- package/dist/command-metadata.d.ts +225 -4
- package/dist/command-metadata.d.ts.map +1 -1
- package/dist/command-metadata.js +163 -2
- package/dist/command-metadata.js.map +1 -1
- package/dist/components/chat-models-utilities.d.ts +16 -0
- package/dist/components/chat-models-utilities.d.ts.map +1 -1
- package/dist/components/chat-models-utilities.js +25 -0
- package/dist/components/chat-models-utilities.js.map +1 -1
- package/dist/components/chat-settings-utilities.d.ts +65 -4
- package/dist/components/chat-settings-utilities.d.ts.map +1 -1
- package/dist/components/chat-settings-utilities.js +155 -4
- package/dist/components/chat-settings-utilities.js.map +1 -1
- package/dist/components/chat-share-utilities.d.ts +39 -0
- package/dist/components/chat-share-utilities.d.ts.map +1 -1
- package/dist/components/chat-share-utilities.js +91 -0
- package/dist/components/chat-share-utilities.js.map +1 -1
- package/dist/components/chat-tips-utilities.d.ts +72 -7
- package/dist/components/chat-tips-utilities.d.ts.map +1 -1
- package/dist/components/chat-tips-utilities.js +68 -0
- package/dist/components/chat-tips-utilities.js.map +1 -1
- package/dist/components/context-usage-utilities.d.ts +32 -0
- package/dist/components/context-usage-utilities.d.ts.map +1 -0
- package/dist/components/context-usage-utilities.js +77 -0
- package/dist/components/context-usage-utilities.js.map +1 -0
- package/dist/components/headless-hooks.d.ts +89 -0
- package/dist/components/headless-hooks.d.ts.map +1 -0
- package/dist/components/headless-hooks.js +254 -0
- package/dist/components/headless-hooks.js.map +1 -0
- package/dist/components/preview-panel-logic.d.ts +182 -0
- package/dist/components/preview-panel-logic.d.ts.map +1 -0
- package/dist/components/preview-panel-logic.js +1993 -0
- package/dist/components/preview-panel-logic.js.map +1 -0
- package/dist/components/preview-panel-session.d.ts +62 -0
- package/dist/components/preview-panel-session.d.ts.map +1 -0
- package/dist/components/preview-panel-session.js +40 -0
- package/dist/components/preview-panel-session.js.map +1 -0
- package/dist/components/quick-picker-utilities.d.ts +19 -0
- package/dist/components/quick-picker-utilities.d.ts.map +1 -0
- package/dist/components/quick-picker-utilities.js +36 -0
- package/dist/components/quick-picker-utilities.js.map +1 -0
- package/dist/components/tests-bar-utilities.d.ts +27 -0
- package/dist/components/tests-bar-utilities.d.ts.map +1 -1
- package/dist/components/tests-bar-utilities.js +71 -0
- package/dist/components/tests-bar-utilities.js.map +1 -1
- package/dist/components/tool-call-utilities.d.ts +14 -5
- package/dist/components/tool-call-utilities.d.ts.map +1 -1
- package/dist/components/tool-call-utilities.js +111 -51
- package/dist/components/tool-call-utilities.js.map +1 -1
- package/dist/panels.d.ts +8 -2
- package/dist/panels.d.ts.map +1 -1
- package/dist/panels.js +8 -2
- package/dist/panels.js.map +1 -1
- package/dist/settings-metadata.d.ts +33 -2
- package/dist/settings-metadata.d.ts.map +1 -1
- package/dist/settings-metadata.js +138 -2
- package/dist/settings-metadata.js.map +1 -1
- package/package.json +2 -2
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
*
|
|
17
17
|
* @module
|
|
18
18
|
*/
|
|
19
|
+
import type { TranslateFunction } from '@molecule/app-i18n';
|
|
19
20
|
/**
|
|
20
21
|
* Share roles, ordered least- to most-privileged. Mirrors the
|
|
21
22
|
* `@molecule/api-resource-share` `SHARE_ROLES` contract; duplicated here (rather
|
|
@@ -107,4 +108,42 @@ export declare function buildSharePayload(role?: ShareRole): SharePayload;
|
|
|
107
108
|
* @returns The absolute, copyable share URL.
|
|
108
109
|
*/
|
|
109
110
|
export declare function buildShareUrl(result: ShareLinkResult, origin: string): string;
|
|
111
|
+
/**
|
|
112
|
+
* The localized picker label for a share role (the `ide.chat.share.role.<role>`
|
|
113
|
+
* keys), through the CALLER's translate function so a framework port and a
|
|
114
|
+
* live locale switch both get their own text. One literal `t()` call per
|
|
115
|
+
* {@link ShareRole}, chosen by a switch exhaustive over the role union: a new
|
|
116
|
+
* role in {@link SHARE_ROLES} fails to compile until it has a label. Each
|
|
117
|
+
* `defaultValue` equals that role's {@link SHARE_ROLE_LABELS} entry, so the
|
|
118
|
+
* English output is unchanged.
|
|
119
|
+
*
|
|
120
|
+
* @param t - The caller's translate function (React passes `useTranslation()`'s `t`).
|
|
121
|
+
* @param role - The share role.
|
|
122
|
+
* @returns The localized role label.
|
|
123
|
+
*/
|
|
124
|
+
export declare function shareRoleLabel(t: TranslateFunction, role: ShareRole): string;
|
|
125
|
+
/**
|
|
126
|
+
* The localized sentence saying what a link of the given role grants (the
|
|
127
|
+
* `ide.chat.share.grants.<role>` keys), through the CALLER's translate
|
|
128
|
+
* function. One literal `t()` call per {@link ShareRole}, exhaustive (see
|
|
129
|
+
* {@link shareRoleLabel}); the role itself interpolates through `{{role}}`.
|
|
130
|
+
*
|
|
131
|
+
* @param t - The caller's translate function.
|
|
132
|
+
* @param role - The role the link grants.
|
|
133
|
+
* @returns The localized grants sentence.
|
|
134
|
+
*/
|
|
135
|
+
export declare function shareGrantsText(t: TranslateFunction, role: ShareRole): string;
|
|
136
|
+
/**
|
|
137
|
+
* The localized subheading shown under the share dialog's heading for a host
|
|
138
|
+
* offering a single role (the `ide.chat.share.subheading.<role>` keys), through
|
|
139
|
+
* the CALLER's translate function. One literal `t()` call per
|
|
140
|
+
* {@link ShareRole}, exhaustive (see {@link shareRoleLabel}); the role
|
|
141
|
+
* interpolates through `{{role}}`. The multi-role variant is the plain
|
|
142
|
+
* `ide.chat.share.subheading` key the caller uses directly.
|
|
143
|
+
*
|
|
144
|
+
* @param t - The caller's translate function.
|
|
145
|
+
* @param role - The single role the host grants.
|
|
146
|
+
* @returns The localized subheading.
|
|
147
|
+
*/
|
|
148
|
+
export declare function shareSubheading(t: TranslateFunction, role: ShareRole): string;
|
|
110
149
|
//# sourceMappingURL=chat-share-utilities.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-share-utilities.d.ts","sourceRoot":"","sources":["../../src/components/chat-share-utilities.ts"],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,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,SAAS,CAAA;CAAE,GAAG;IAAE,IAAI,EAAE,SAAS,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,CAAA;AAEjG;;;;;;GAMG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,SAAS,CAE7D;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,GAAG,IAAI,CAQpE;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,IAAI,GAAE,SAA8B,GAAG,YAAY,CAEpF;AAED;;;;;;;;GAQG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAI7E;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,iBAAiB,EAAE,IAAI,EAAE,SAAS,GAAG,MAAM,CAe5E;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,iBAAiB,EAAE,IAAI,EAAE,SAAS,GAAG,MAAM,CAmC7E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,iBAAiB,EAAE,IAAI,EAAE,SAAS,GAAG,MAAM,CAmC7E"}
|
|
@@ -87,4 +87,95 @@ export function buildShareUrl(result, origin) {
|
|
|
87
87
|
const trimmedOrigin = origin.replace(/\/+$/, '');
|
|
88
88
|
return `${trimmedOrigin}/share/${result.slug}`;
|
|
89
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* The localized picker label for a share role (the `ide.chat.share.role.<role>`
|
|
92
|
+
* keys), through the CALLER's translate function so a framework port and a
|
|
93
|
+
* live locale switch both get their own text. One literal `t()` call per
|
|
94
|
+
* {@link ShareRole}, chosen by a switch exhaustive over the role union: a new
|
|
95
|
+
* role in {@link SHARE_ROLES} fails to compile until it has a label. Each
|
|
96
|
+
* `defaultValue` equals that role's {@link SHARE_ROLE_LABELS} entry, so the
|
|
97
|
+
* English output is unchanged.
|
|
98
|
+
*
|
|
99
|
+
* @param t - The caller's translate function (React passes `useTranslation()`'s `t`).
|
|
100
|
+
* @param role - The share role.
|
|
101
|
+
* @returns The localized role label.
|
|
102
|
+
*/
|
|
103
|
+
export function shareRoleLabel(t, role) {
|
|
104
|
+
switch (role) {
|
|
105
|
+
case 'viewer':
|
|
106
|
+
return t('ide.chat.share.role.viewer', undefined, { defaultValue: 'Viewer — view only' });
|
|
107
|
+
case 'commenter':
|
|
108
|
+
return t('ide.chat.share.role.commenter', undefined, {
|
|
109
|
+
defaultValue: 'Commenter — view & comment',
|
|
110
|
+
});
|
|
111
|
+
case 'editor':
|
|
112
|
+
return t('ide.chat.share.role.editor', undefined, {
|
|
113
|
+
defaultValue: 'Editor — view & edit',
|
|
114
|
+
});
|
|
115
|
+
case 'owner':
|
|
116
|
+
return t('ide.chat.share.role.owner', undefined, { defaultValue: 'Owner — full access' });
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* The localized sentence saying what a link of the given role grants (the
|
|
121
|
+
* `ide.chat.share.grants.<role>` keys), through the CALLER's translate
|
|
122
|
+
* function. One literal `t()` call per {@link ShareRole}, exhaustive (see
|
|
123
|
+
* {@link shareRoleLabel}); the role itself interpolates through `{{role}}`.
|
|
124
|
+
*
|
|
125
|
+
* @param t - The caller's translate function.
|
|
126
|
+
* @param role - The role the link grants.
|
|
127
|
+
* @returns The localized grants sentence.
|
|
128
|
+
*/
|
|
129
|
+
export function shareGrantsText(t, role) {
|
|
130
|
+
switch (role) {
|
|
131
|
+
case 'viewer':
|
|
132
|
+
return t('ide.chat.share.grants.viewer', { role }, {
|
|
133
|
+
defaultValue: 'Anyone with this link can act as {{role}}.',
|
|
134
|
+
});
|
|
135
|
+
case 'commenter':
|
|
136
|
+
return t('ide.chat.share.grants.commenter', { role }, {
|
|
137
|
+
defaultValue: 'Anyone with this link can act as {{role}}.',
|
|
138
|
+
});
|
|
139
|
+
case 'editor':
|
|
140
|
+
return t('ide.chat.share.grants.editor', { role }, {
|
|
141
|
+
defaultValue: 'Anyone with this link can act as {{role}}.',
|
|
142
|
+
});
|
|
143
|
+
case 'owner':
|
|
144
|
+
return t('ide.chat.share.grants.owner', { role }, {
|
|
145
|
+
defaultValue: 'Anyone with this link can act as {{role}}.',
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* The localized subheading shown under the share dialog's heading for a host
|
|
151
|
+
* offering a single role (the `ide.chat.share.subheading.<role>` keys), through
|
|
152
|
+
* the CALLER's translate function. One literal `t()` call per
|
|
153
|
+
* {@link ShareRole}, exhaustive (see {@link shareRoleLabel}); the role
|
|
154
|
+
* interpolates through `{{role}}`. The multi-role variant is the plain
|
|
155
|
+
* `ide.chat.share.subheading` key the caller uses directly.
|
|
156
|
+
*
|
|
157
|
+
* @param t - The caller's translate function.
|
|
158
|
+
* @param role - The single role the host grants.
|
|
159
|
+
* @returns The localized subheading.
|
|
160
|
+
*/
|
|
161
|
+
export function shareSubheading(t, role) {
|
|
162
|
+
switch (role) {
|
|
163
|
+
case 'viewer':
|
|
164
|
+
return t('ide.chat.share.subheading.viewer', { role }, {
|
|
165
|
+
defaultValue: 'Create a public link. Anyone with the link can act as {{role}}.',
|
|
166
|
+
});
|
|
167
|
+
case 'commenter':
|
|
168
|
+
return t('ide.chat.share.subheading.commenter', { role }, {
|
|
169
|
+
defaultValue: 'Create a public link. Anyone with the link can act as {{role}}.',
|
|
170
|
+
});
|
|
171
|
+
case 'editor':
|
|
172
|
+
return t('ide.chat.share.subheading.editor', { role }, {
|
|
173
|
+
defaultValue: 'Create a public link. Anyone with the link can act as {{role}}.',
|
|
174
|
+
});
|
|
175
|
+
case 'owner':
|
|
176
|
+
return t('ide.chat.share.subheading.owner', { role }, {
|
|
177
|
+
defaultValue: 'Create a public link. Anyone with the link can act as {{role}}.',
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}
|
|
90
181
|
//# sourceMappingURL=chat-share-utilities.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-share-utilities.js","sourceRoot":"","sources":["../../src/components/chat-share-utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;
|
|
1
|
+
{"version":3,"file":"chat-share-utilities.js","sourceRoot":"","sources":["../../src/components/chat-share-utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAIH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,OAAO,CAAU,CAAA;AAK9E,2EAA2E;AAC3E,MAAM,CAAC,MAAM,kBAAkB,GAAc,QAAQ,CAAA;AAErD,oFAAoF;AACpF,MAAM,CAAC,MAAM,iBAAiB,GAA8B;IAC1D,MAAM,EAAE,oBAAoB;IAC5B,SAAS,EAAE,4BAA4B;IACvC,MAAM,EAAE,sBAAsB;IAC9B,KAAK,EAAE,qBAAqB;CAC7B,CAAA;AA0CD;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,OAAQ,WAAiC,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAA;AAC3D,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAA;IAC1D,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IACvB,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAA;IACnC,IAAI,GAAG,KAAK,EAAE;QAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,kBAAk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
|
|
|
18
18
|
*
|
|
19
19
|
* @module
|
|
20
20
|
*/
|
|
21
|
+
import type { InterpolationValues, TranslateFunction } from '@molecule/app-i18n';
|
|
22
|
+
/**
|
|
23
|
+
* The stable id of every tip this module ships ({@link ENTRY_TIP}, the
|
|
24
|
+
* {@link CHAT_TIPS} rotation and {@link VIEWER_TIP}) — also each tip's i18n key
|
|
25
|
+
* suffix (`ide.chat.tip.<id>`). Derived from the tables below, so adding a tip
|
|
26
|
+
* extends the union and the {@link tipText} switch fails to compile until the
|
|
27
|
+
* new tip has its literal `t()` call — a tip can never ship with no
|
|
28
|
+
* translation site.
|
|
29
|
+
*/
|
|
30
|
+
export type TipId = (typeof ENTRY_TIP | typeof VIEWER_TIP | (typeof CHAT_TIPS)[number])['id'];
|
|
21
31
|
/** A single onboarding tip. */
|
|
22
32
|
export interface TipDef {
|
|
23
|
-
/** Stable id (also
|
|
24
|
-
id:
|
|
33
|
+
/** Stable id (also the i18n key suffix; one of {@link TipId}). */
|
|
34
|
+
id: TipId;
|
|
25
35
|
/**
|
|
26
|
-
* English default text, rendered via
|
|
27
|
-
* May contain the `{{agentName}}` interpolation
|
|
28
|
-
* from the host's agent identity (neutral
|
|
36
|
+
* English default text, rendered via {@link tipText} (the caller's `t` with
|
|
37
|
+
* the `ide.chat.tip.<id>` key). May contain the `{{agentName}}` interpolation
|
|
38
|
+
* token, filled in by the caller from the host's agent identity (neutral
|
|
39
|
+
* default: "the assistant"). Must equal that key's English text in the ide
|
|
40
|
+
* locale bond — the render's `defaultValue` is the bond's text, not this field.
|
|
29
41
|
*/
|
|
30
42
|
text: string;
|
|
31
43
|
}
|
|
@@ -37,7 +49,10 @@ export interface TipDef {
|
|
|
37
49
|
* Its `id` is also a locale key (`ide.chat.tip.getStarted`), like every entry in
|
|
38
50
|
* {@link CHAT_TIPS}.
|
|
39
51
|
*/
|
|
40
|
-
export declare const ENTRY_TIP:
|
|
52
|
+
export declare const ENTRY_TIP: {
|
|
53
|
+
readonly id: "getStarted";
|
|
54
|
+
readonly text: "Tip: type / to see every command, or @ a filename to give {{agentName}} a file to work from.";
|
|
55
|
+
};
|
|
41
56
|
/**
|
|
42
57
|
* The idle-rotation tip pool. Each covers a real, shipped slash command or
|
|
43
58
|
* affordance — file mentions, the command menu, plan vs execute, `/undo`,
|
|
@@ -47,7 +62,57 @@ export declare const ENTRY_TIP: TipDef;
|
|
|
47
62
|
* filling with hints. The {@link ENTRY_TIP} (`getStarted`) is shown separately at
|
|
48
63
|
* onboarding and is intentionally NOT part of this rotation.
|
|
49
64
|
*/
|
|
50
|
-
export declare const CHAT_TIPS: readonly
|
|
65
|
+
export declare const CHAT_TIPS: readonly [{
|
|
66
|
+
readonly id: "mention";
|
|
67
|
+
readonly text: "Tip: type @filename to attach a project file as context — {{agentName}} reads it directly.";
|
|
68
|
+
}, {
|
|
69
|
+
readonly id: "slash";
|
|
70
|
+
readonly text: "Tip: type / to browse every command (commit, model, and more).";
|
|
71
|
+
}, {
|
|
72
|
+
readonly id: "plan";
|
|
73
|
+
readonly text: "Tip: use /plan to have {{agentName}} research and propose a plan before it edits any files.";
|
|
74
|
+
}, {
|
|
75
|
+
readonly id: "undo";
|
|
76
|
+
readonly text: "Tip: use /undo to instantly revert the last AI turn's file changes if it went the wrong way.";
|
|
77
|
+
}, {
|
|
78
|
+
readonly id: "compact";
|
|
79
|
+
readonly text: "Tip: long conversation? /compact compresses the context so you keep room to work.";
|
|
80
|
+
}, {
|
|
81
|
+
readonly id: "commit";
|
|
82
|
+
readonly text: "Tip: use /commit to save your changes as a git commit you can always return to.";
|
|
83
|
+
}, {
|
|
84
|
+
readonly id: "report";
|
|
85
|
+
readonly text: "Tip: something off? /report sends a bug or feedback to the team with your recent chat attached.";
|
|
86
|
+
}];
|
|
87
|
+
/**
|
|
88
|
+
* The viewer orientation tip's definition, kept beside the other tips' so its
|
|
89
|
+
* sentence translates the same way — at render, from one key
|
|
90
|
+
* (`ide.chat.tip.viewerTeamOnly`) + the English default, via {@link tipText}.
|
|
91
|
+
* Its `id` is part of the {@link TipId} union, so the bond's key for it is
|
|
92
|
+
* gate-checked like every other tip's.
|
|
93
|
+
*/
|
|
94
|
+
export declare const VIEWER_TIP: {
|
|
95
|
+
readonly id: "viewerTeamOnly";
|
|
96
|
+
readonly text: "View-only access — read along and /teamsay (or just /t) the team. This gold icon marks team-only messages ({{agentName}} ignores them). Running the assistant and changing the model or settings need editor access.";
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* The localized sentence of a tip (the `ide.chat.tip.<id>` keys), through the
|
|
100
|
+
* CALLER's translate function so a framework port and a live locale switch
|
|
101
|
+
* both get their own text — the chat timeline stores the tip's identity and
|
|
102
|
+
* translates it AT RENDER, so a locale switch re-translates every visible tip.
|
|
103
|
+
* One literal `t()` call per {@link TipId}, chosen by a switch exhaustive over
|
|
104
|
+
* the union: adding a tip to {@link CHAT_TIPS} (or {@link ENTRY_TIP} /
|
|
105
|
+
* {@link VIEWER_TIP}) without adding its case here is a compile error, so a
|
|
106
|
+
* tip can never ship with a runtime-built key the i18n gate cannot check.
|
|
107
|
+
* Each `defaultValue` is the same English the tip's `text` field carries (and
|
|
108
|
+
* the ide bond's key holds), so the English output is identical either way.
|
|
109
|
+
*
|
|
110
|
+
* @param t - The caller's translate function (React passes `useTranslation()`'s `t`).
|
|
111
|
+
* @param tip - The tip to render (its `id` picks the case; `text` is not read).
|
|
112
|
+
* @param values - Interpolation values; the tips interpolate `{{agentName}}`.
|
|
113
|
+
* @returns The localized tip sentence.
|
|
114
|
+
*/
|
|
115
|
+
export declare function tipText(t: TranslateFunction, tip: TipDef, values?: InterpolationValues): string;
|
|
51
116
|
/**
|
|
52
117
|
* How long the conversation must sit idle before a rotation tip may surface
|
|
53
118
|
* ("idle for a while"). Kept short enough that a typical pause in a real session
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-tips-utilities.d.ts","sourceRoot":"","sources":["../../src/components/chat-tips-utilities.ts"],"names":[],"mappings":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EAAgE;IAChE,mBAAmB,EAAE,MAAM,CAAA;IAC3B,kEAAkE;IAClE,cAAc,EAAE,MAAM,CAAA;CACvB;AAED;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAK5E;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAK7E;AAED;;;;;;GAMG;AACH,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAI/C"}
|
|
@@ -69,6 +69,74 @@ export const CHAT_TIPS = [
|
|
|
69
69
|
text: 'Tip: something off? /report sends a bug or feedback to the team with your recent chat attached.',
|
|
70
70
|
},
|
|
71
71
|
];
|
|
72
|
+
/**
|
|
73
|
+
* The viewer orientation tip's definition, kept beside the other tips' so its
|
|
74
|
+
* sentence translates the same way — at render, from one key
|
|
75
|
+
* (`ide.chat.tip.viewerTeamOnly`) + the English default, via {@link tipText}.
|
|
76
|
+
* Its `id` is part of the {@link TipId} union, so the bond's key for it is
|
|
77
|
+
* gate-checked like every other tip's.
|
|
78
|
+
*/
|
|
79
|
+
export const VIEWER_TIP = {
|
|
80
|
+
id: 'viewerTeamOnly',
|
|
81
|
+
text: 'View-only access — read along and /teamsay (or just /t) the team. This gold icon marks team-only messages ({{agentName}} ignores them). Running the assistant and changing the model or settings need editor access.',
|
|
82
|
+
};
|
|
83
|
+
/**
|
|
84
|
+
* The localized sentence of a tip (the `ide.chat.tip.<id>` keys), through the
|
|
85
|
+
* CALLER's translate function so a framework port and a live locale switch
|
|
86
|
+
* both get their own text — the chat timeline stores the tip's identity and
|
|
87
|
+
* translates it AT RENDER, so a locale switch re-translates every visible tip.
|
|
88
|
+
* One literal `t()` call per {@link TipId}, chosen by a switch exhaustive over
|
|
89
|
+
* the union: adding a tip to {@link CHAT_TIPS} (or {@link ENTRY_TIP} /
|
|
90
|
+
* {@link VIEWER_TIP}) without adding its case here is a compile error, so a
|
|
91
|
+
* tip can never ship with a runtime-built key the i18n gate cannot check.
|
|
92
|
+
* Each `defaultValue` is the same English the tip's `text` field carries (and
|
|
93
|
+
* the ide bond's key holds), so the English output is identical either way.
|
|
94
|
+
*
|
|
95
|
+
* @param t - The caller's translate function (React passes `useTranslation()`'s `t`).
|
|
96
|
+
* @param tip - The tip to render (its `id` picks the case; `text` is not read).
|
|
97
|
+
* @param values - Interpolation values; the tips interpolate `{{agentName}}`.
|
|
98
|
+
* @returns The localized tip sentence.
|
|
99
|
+
*/
|
|
100
|
+
export function tipText(t, tip, values) {
|
|
101
|
+
switch (tip.id) {
|
|
102
|
+
case 'getStarted':
|
|
103
|
+
return t('ide.chat.tip.getStarted', values, {
|
|
104
|
+
defaultValue: 'Tip: type / to see every command, or @ a filename to give {{agentName}} a file to work from.',
|
|
105
|
+
});
|
|
106
|
+
case 'mention':
|
|
107
|
+
return t('ide.chat.tip.mention', values, {
|
|
108
|
+
defaultValue: 'Tip: type @filename to attach a project file as context — {{agentName}} reads it directly.',
|
|
109
|
+
});
|
|
110
|
+
case 'slash':
|
|
111
|
+
return t('ide.chat.tip.slash', values, {
|
|
112
|
+
defaultValue: 'Tip: type / to browse every command (commit, model, and more).',
|
|
113
|
+
});
|
|
114
|
+
case 'plan':
|
|
115
|
+
return t('ide.chat.tip.plan', values, {
|
|
116
|
+
defaultValue: 'Tip: use /plan to have {{agentName}} research and propose a plan before it edits any files.',
|
|
117
|
+
});
|
|
118
|
+
case 'undo':
|
|
119
|
+
return t('ide.chat.tip.undo', values, {
|
|
120
|
+
defaultValue: "Tip: use /undo to instantly revert the last AI turn's file changes if it went the wrong way.",
|
|
121
|
+
});
|
|
122
|
+
case 'compact':
|
|
123
|
+
return t('ide.chat.tip.compact', values, {
|
|
124
|
+
defaultValue: 'Tip: long conversation? /compact compresses the context so you keep room to work.',
|
|
125
|
+
});
|
|
126
|
+
case 'commit':
|
|
127
|
+
return t('ide.chat.tip.commit', values, {
|
|
128
|
+
defaultValue: 'Tip: use /commit to save your changes as a git commit you can always return to.',
|
|
129
|
+
});
|
|
130
|
+
case 'report':
|
|
131
|
+
return t('ide.chat.tip.report', values, {
|
|
132
|
+
defaultValue: 'Tip: something off? /report sends a bug or feedback to the team with your recent chat attached.',
|
|
133
|
+
});
|
|
134
|
+
case 'viewerTeamOnly':
|
|
135
|
+
return t('ide.chat.tip.viewerTeamOnly', values, {
|
|
136
|
+
defaultValue: 'View-only access — read along and /teamsay (or just /t) the team. This gold icon marks team-only messages ({{agentName}} ignores them). Running the assistant and changing the model or settings need editor access.',
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}
|
|
72
140
|
/**
|
|
73
141
|
* How long the conversation must sit idle before a rotation tip may surface
|
|
74
142
|
* ("idle for a while"). Kept short enough that a typical pause in a real session
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-tips-utilities.js","sourceRoot":"","sources":["../../src/components/chat-tips-utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;
|
|
1
|
+
{"version":3,"file":"chat-tips-utilities.js","sourceRoot":"","sources":["../../src/components/chat-tips-utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AA4BH;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,EAAE,EAAE,YAAY;IAChB,IAAI,EAAE,8FAA8F;CAC5F,CAAA;AAEV;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB;QACE,EAAE,EAAE,SAAS;QACb,IAAI,EAAE,4FAA4F;KACnG;IACD;QACE,EAAE,EAAE,OAAO;QACX,IAAI,EAAE,gEAAgE;KACvE;IACD;QACE,EAAE,EAAE,MAAM;QACV,IAAI,EAAE,6FAA6F;KACpG;IACD;QACE,EAAE,EAAE,MAAM;QACV,IAAI,EAAE,8FAA8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AC,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IAC9E,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAA;AAC7C,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,MAAM,GAAG,GAAG,SAAS,CAAC,MAAM,CAAA;IAC5B,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;IACxE,OAAO,SAAS,CAAC,IAAI,GAAG,GAAG,CAAC,CAAA;AAC9B,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Label helpers for the context-usage breakdown (the `Request composition`
|
|
3
|
+
* table), shared by every framework's chat panel.
|
|
4
|
+
*
|
|
5
|
+
* The context-usage categories come from `@molecule/app-ai-chat`'s
|
|
6
|
+
* {@link ContextCategoryId} union. Their display names used to live in the
|
|
7
|
+
* React component as an English table looked up as a runtime-built
|
|
8
|
+
* `ide.chat.context.category.<id>` default — invisible to the i18n gate, so a
|
|
9
|
+
* category with no key in the locale bond silently rendered English for every
|
|
10
|
+
* non-English user. Here each category is one literal `t()` call, chosen by a
|
|
11
|
+
* switch exhaustive over the union, so a category added to `app-ai-chat`
|
|
12
|
+
* fails to compile until it has a label — and the gate can verify every key
|
|
13
|
+
* the call can produce exists in the bond.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
import type { ContextCategoryId } from '@molecule/app-ai-chat';
|
|
18
|
+
import type { TranslateFunction } from '@molecule/app-i18n';
|
|
19
|
+
/**
|
|
20
|
+
* The localized name of one context-usage category (the
|
|
21
|
+
* `ide.chat.context.category.<id>` keys), through the CALLER's translate
|
|
22
|
+
* function so a framework port and a live locale switch both get their own
|
|
23
|
+
* text. One literal `t()` call per {@link ContextCategoryId}, chosen by a
|
|
24
|
+
* switch exhaustive over the union: a new category in `app-ai-chat` fails to
|
|
25
|
+
* compile until it has a case here.
|
|
26
|
+
*
|
|
27
|
+
* @param t - The caller's translate function (React passes `useTranslation()`'s `t`).
|
|
28
|
+
* @param id - The category id.
|
|
29
|
+
* @returns The localized category name.
|
|
30
|
+
*/
|
|
31
|
+
export declare function contextCategoryLabel(t: TranslateFunction, id: ContextCategoryId): string;
|
|
32
|
+
//# sourceMappingURL=context-usage-utilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-usage-utilities.d.ts","sourceRoot":"","sources":["../../src/components/context-usage-utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAA;AAC9D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAA;AAE3D;;;;;;;;;;;GAWG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,iBAAiB,EAAE,EAAE,EAAE,iBAAiB,GAAG,MAAM,CA+CxF"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Label helpers for the context-usage breakdown (the `Request composition`
|
|
3
|
+
* table), shared by every framework's chat panel.
|
|
4
|
+
*
|
|
5
|
+
* The context-usage categories come from `@molecule/app-ai-chat`'s
|
|
6
|
+
* {@link ContextCategoryId} union. Their display names used to live in the
|
|
7
|
+
* React component as an English table looked up as a runtime-built
|
|
8
|
+
* `ide.chat.context.category.<id>` default — invisible to the i18n gate, so a
|
|
9
|
+
* category with no key in the locale bond silently rendered English for every
|
|
10
|
+
* non-English user. Here each category is one literal `t()` call, chosen by a
|
|
11
|
+
* switch exhaustive over the union, so a category added to `app-ai-chat`
|
|
12
|
+
* fails to compile until it has a label — and the gate can verify every key
|
|
13
|
+
* the call can produce exists in the bond.
|
|
14
|
+
*
|
|
15
|
+
* @module
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* The localized name of one context-usage category (the
|
|
19
|
+
* `ide.chat.context.category.<id>` keys), through the CALLER's translate
|
|
20
|
+
* function so a framework port and a live locale switch both get their own
|
|
21
|
+
* text. One literal `t()` call per {@link ContextCategoryId}, chosen by a
|
|
22
|
+
* switch exhaustive over the union: a new category in `app-ai-chat` fails to
|
|
23
|
+
* compile until it has a case here.
|
|
24
|
+
*
|
|
25
|
+
* @param t - The caller's translate function (React passes `useTranslation()`'s `t`).
|
|
26
|
+
* @param id - The category id.
|
|
27
|
+
* @returns The localized category name.
|
|
28
|
+
*/
|
|
29
|
+
export function contextCategoryLabel(t, id) {
|
|
30
|
+
switch (id) {
|
|
31
|
+
case 'system':
|
|
32
|
+
return t('ide.chat.context.category.system', undefined, {
|
|
33
|
+
defaultValue: 'System instructions',
|
|
34
|
+
});
|
|
35
|
+
case 'summary':
|
|
36
|
+
return t('ide.chat.context.category.summary', undefined, {
|
|
37
|
+
defaultValue: 'Previous summary',
|
|
38
|
+
});
|
|
39
|
+
case 'toolDefinitions':
|
|
40
|
+
return t('ide.chat.context.category.toolDefinitions', undefined, {
|
|
41
|
+
defaultValue: 'Tool definitions',
|
|
42
|
+
});
|
|
43
|
+
case 'serverTools':
|
|
44
|
+
return t('ide.chat.context.category.serverTools', undefined, {
|
|
45
|
+
defaultValue: 'Provider tools',
|
|
46
|
+
});
|
|
47
|
+
case 'userText':
|
|
48
|
+
return t('ide.chat.context.category.userText', undefined, {
|
|
49
|
+
defaultValue: 'User messages',
|
|
50
|
+
});
|
|
51
|
+
case 'assistantText':
|
|
52
|
+
return t('ide.chat.context.category.assistantText', undefined, {
|
|
53
|
+
defaultValue: 'Assistant messages',
|
|
54
|
+
});
|
|
55
|
+
case 'reasoning':
|
|
56
|
+
return t('ide.chat.context.category.reasoning', undefined, { defaultValue: 'Reasoning' });
|
|
57
|
+
case 'toolCalls':
|
|
58
|
+
return t('ide.chat.context.category.toolCalls', undefined, {
|
|
59
|
+
defaultValue: 'Tool arguments',
|
|
60
|
+
});
|
|
61
|
+
case 'toolResults':
|
|
62
|
+
return t('ide.chat.context.category.toolResults', undefined, {
|
|
63
|
+
defaultValue: 'Tool results',
|
|
64
|
+
});
|
|
65
|
+
case 'images':
|
|
66
|
+
return t('ide.chat.context.category.images', undefined, { defaultValue: 'Images' });
|
|
67
|
+
case 'attachments':
|
|
68
|
+
return t('ide.chat.context.category.attachments', undefined, {
|
|
69
|
+
defaultValue: 'Attachments',
|
|
70
|
+
});
|
|
71
|
+
case 'structuralOverhead':
|
|
72
|
+
return t('ide.chat.context.category.structuralOverhead', undefined, {
|
|
73
|
+
defaultValue: 'Request structure',
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=context-usage-utilities.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context-usage-utilities.js","sourceRoot":"","sources":["../../src/components/context-usage-utilities.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,oBAAoB,CAAC,CAAoB,EAAE,EAAqB;IAC9E,QAAQ,EAAE,EAAE,CAAC;QACX,KAAK,QAAQ;YACX,OAAO,CAAC,CAAC,kCAAkC,EAAE,SAAS,EAAE;gBACtD,YAAY,EAAE,qBAAqB;aACpC,CAAC,CAAA;QACJ,KAAK,SAAS;YACZ,OAAO,CAAC,CAAC,mCAAmC,EAAE,SAAS,EAAE;gBACvD,YAAY,EAAE,kBAAkB;aACjC,CAAC,CAAA;QACJ,KAAK,iBAAiB;YACpB,OAAO,CAAC,CAAC,2CAA2C,EAAE,SAAS,EAAE;gBAC/D,YAAY,EAAE,kBAAkB;aACjC,CAAC,CAAA;QACJ,KAAK,aAAa;YAChB,OAAO,CAAC,CAAC,uCAAuC,EAAE,SAAS,EAAE;gBAC3D,YAAY,EAAE,gBAAgB;aAC/B,CAAC,CAAA;QACJ,KAAK,UAAU;YACb,OAAO,CAAC,CAAC,oCAAoC,EAAE,SAAS,EAAE;gBACxD,YAAY,EAAE,eAAe;aAC9B,CAAC,CAAA;QACJ,KAAK,eAAe;YAClB,OAAO,CAAC,CAAC,yCAAyC,EAAE,SAAS,EAAE;gBAC7D,YAAY,EAAE,oBAAoB;aACnC,CAAC,CAAA;QACJ,KAAK,WAAW;YACd,OAAO,CAAC,CAAC,qCAAqC,EAAE,SAAS,EAAE,EAAE,YAAY,EAAE,WAAW,EAAE,CAAC,CAAA;QAC3F,KAAK,WAAW;YACd,OAAO,CAAC,CAAC,qCAAqC,EAAE,SAAS,EAAE;gBACzD,YAAY,EAAE,gBAAgB;aAC/B,CAAC,CAAA;QACJ,KAAK,aAAa;YAChB,OAAO,CAAC,CAAC,uCAAuC,EAAE,SAAS,EAAE;gBAC3D,YAAY,EAAE,cAAc;aAC7B,CAAC,CAAA;QACJ,KAAK,QAAQ;YACX,OAAO,CAAC,CAAC,kCAAkC,EAAE,SAAS,EAAE,EAAE,YAAY,EAAE,QAAQ,EAAE,CAAC,CAAA;QACrF,KAAK,aAAa;YAChB,OAAO,CAAC,CAAC,uCAAuC,EAAE,SAAS,EAAE;gBAC3D,YAAY,EAAE,aAAa;aAC5B,CAAC,CAAA;QACJ,KAAK,oBAAoB;YACvB,OAAO,CAAC,CAAC,8CAA8C,EAAE,SAAS,EAAE;gBAClE,YAAY,EAAE,mBAAmB;aAClC,CAAC,CAAA;IACN,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runs a hook-shaped render function (one written against {@link PrimitiveHooks}) outside React,
|
|
3
|
+
* as a store: `getState` returns the function's latest result, `subscribe` hears every change.
|
|
4
|
+
*
|
|
5
|
+
* Shared IDE behaviour that is naturally written as a React-style hook (see
|
|
6
|
+
* `usePreviewPanelLogic`) is written ONCE against these four primitives. React passes its own
|
|
7
|
+
* hooks and runs that code itself; Vue, Svelte, Solid and Angular run it through
|
|
8
|
+
* {@link createHeadlessHooksSession}, which follows React's rules for the parts that change
|
|
9
|
+
* behaviour:
|
|
10
|
+
*
|
|
11
|
+
* - A setter called with the current value (`Object.is`) changes nothing.
|
|
12
|
+
* - Effects run only while connected (mounted). After each render, every effect whose deps
|
|
13
|
+
* changed first has its previous cleanup run (all cleanups, in declaration order), then its new
|
|
14
|
+
* run (in declaration order). `connect` runs every effect; disconnecting runs every cleanup.
|
|
15
|
+
* - Updates are batched: a handler from the result runs inside {@link HeadlessHooksSession.batch},
|
|
16
|
+
* so its updates produce one render, synchronously, before it returns; updates from a timer,
|
|
17
|
+
* a promise continuation or a DOM listener are batched into one render on the next microtask.
|
|
18
|
+
*
|
|
19
|
+
* @module
|
|
20
|
+
*/
|
|
21
|
+
/** The four primitive hooks a hook-shaped render function may call (React's own satisfy them). */
|
|
22
|
+
export interface PrimitiveHooks {
|
|
23
|
+
/**
|
|
24
|
+
* A value that persists across renders; setting a different value re-renders.
|
|
25
|
+
* @param initial - The first value.
|
|
26
|
+
* @returns The current value and its setter (which also takes an updater function).
|
|
27
|
+
*/
|
|
28
|
+
useState<S>(initial: S): [S, (next: S | ((previous: S) => S)) => void];
|
|
29
|
+
/**
|
|
30
|
+
* A mutable box that persists across renders without re-rendering when written.
|
|
31
|
+
* @param initial - The box's first value.
|
|
32
|
+
* @returns The box.
|
|
33
|
+
*/
|
|
34
|
+
useRef<T>(initial: T): {
|
|
35
|
+
current: T;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Runs `effect` after a render whose `deps` changed (every render when `deps` is omitted),
|
|
39
|
+
* running the previous run's cleanup first; every cleanup runs on disconnect.
|
|
40
|
+
* @param effect - The effect; may return its cleanup.
|
|
41
|
+
* @param deps - The values whose change re-runs it.
|
|
42
|
+
*/
|
|
43
|
+
useEffect(effect: () => void | (() => void), deps?: readonly unknown[]): void;
|
|
44
|
+
/**
|
|
45
|
+
* The same function object across renders until `deps` change.
|
|
46
|
+
* @param fn - The function.
|
|
47
|
+
* @param deps - The values whose change replaces it.
|
|
48
|
+
* @returns The memoized function.
|
|
49
|
+
*/
|
|
50
|
+
useCallback<F extends (...args: never[]) => unknown>(fn: F, deps: readonly unknown[]): F;
|
|
51
|
+
}
|
|
52
|
+
/** A hook-shaped render function run as a store (see the module docs). */
|
|
53
|
+
export interface HeadlessHooksSession<R> {
|
|
54
|
+
/**
|
|
55
|
+
* The render function's latest result. Its function-valued fields are wrapped in
|
|
56
|
+
* {@link HeadlessHooksSession.batch} (the same wrapper while the function is unchanged).
|
|
57
|
+
* @returns The latest result.
|
|
58
|
+
*/
|
|
59
|
+
getState(): R;
|
|
60
|
+
/**
|
|
61
|
+
* Listens for a new result.
|
|
62
|
+
* @param listener - Called after each render that produced a new result.
|
|
63
|
+
* @returns Stops listening.
|
|
64
|
+
*/
|
|
65
|
+
subscribe(listener: () => void): () => void;
|
|
66
|
+
/** Re-renders now (the render function's inputs changed). */
|
|
67
|
+
rerender(): void;
|
|
68
|
+
/**
|
|
69
|
+
* Mounts: runs every effect, and keeps running them as renders change their deps.
|
|
70
|
+
* @returns Unmounts: runs every cleanup and stops running effects.
|
|
71
|
+
*/
|
|
72
|
+
connect(): () => void;
|
|
73
|
+
/**
|
|
74
|
+
* Runs `fn` with updates batched: the renders they cause happen once, when the outermost batch ends.
|
|
75
|
+
* @param fn - The work.
|
|
76
|
+
* @returns What `fn` returns.
|
|
77
|
+
*/
|
|
78
|
+
batch<T>(fn: () => T): T;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Runs `render` as a store (see the module docs). The first render happens here; effects wait
|
|
82
|
+
* for {@link HeadlessHooksSession.connect}.
|
|
83
|
+
*
|
|
84
|
+
* @param render - The hook-shaped render function; it must call the same hooks in the same order
|
|
85
|
+
* on every render.
|
|
86
|
+
* @returns The session.
|
|
87
|
+
*/
|
|
88
|
+
export declare function createHeadlessHooksSession<R>(render: (hooks: PrimitiveHooks) => R): HeadlessHooksSession<R>;
|
|
89
|
+
//# sourceMappingURL=headless-hooks.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headless-hooks.d.ts","sourceRoot":"","sources":["../../src/components/headless-hooks.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,kGAAkG;AAClG,MAAM,WAAW,cAAc;IAC7B;;;;OAIG;IACH,QAAQ,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,IAAI,CAAC,CAAA;IACtE;;;;OAIG;IACH,MAAM,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC,CAAA;KAAE,CAAA;IACrC;;;;;OAKG;IACH,SAAS,CAAC,MAAM,EAAE,MAAM,IAAI,GAAG,CAAC,MAAM,IAAI,CAAC,EAAE,IAAI,CAAC,EAAE,SAAS,OAAO,EAAE,GAAG,IAAI,CAAA;IAC7E;;;;;OAKG;IACH,WAAW,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,OAAO,EAAE,EAAE,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,OAAO,EAAE,GAAG,CAAC,CAAA;CACzF;AAED,0EAA0E;AAC1E,MAAM,WAAW,oBAAoB,CAAC,CAAC;IACrC;;;;OAIG;IACH,QAAQ,IAAI,CAAC,CAAA;IACb;;;;OAIG;IACH,SAAS,CAAC,QAAQ,EAAE,MAAM,IAAI,GAAG,MAAM,IAAI,CAAA;IAC3C,6DAA6D;IAC7D,QAAQ,IAAI,IAAI,CAAA;IAChB;;;OAGG;IACH,OAAO,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