@aparte/react 0.9.0 → 0.11.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 +4 -2
- package/dist/index.d.ts +38 -12
- package/dist/index.d.ts.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -27,7 +27,9 @@ function Chat() {
|
|
|
27
27
|
The user's message is appended automatically on send — don't add it yourself. `onMessageSent` is
|
|
28
28
|
optional and only for side-effects (scroll, analytics).
|
|
29
29
|
|
|
30
|
-
`@aparte/core`, `react` and `react-dom` are **peer dependencies**.
|
|
31
|
-
|
|
30
|
+
`@aparte/core`, `react` and `react-dom` are **peer dependencies**.
|
|
31
|
+
|
|
32
|
+
Every `<aparte-*>` tag is a **typed JSX intrinsic** — real attributes, checked by the compiler, no
|
|
33
|
+
registration. `<AparteUi name="my-widget" />` remains for an element aparté does not define.
|
|
32
34
|
|
|
33
35
|
> ESM-only. See the docs for the full API. Part of the aparté monorepo.
|
package/dist/index.d.ts
CHANGED
|
@@ -13,18 +13,44 @@ export { useConversationManager } from './hooks/useConversationManager.js';
|
|
|
13
13
|
export type { UseConversationManager } from './hooks/useConversationManager.js';
|
|
14
14
|
export { AparteUi } from './components/AparteUi.js';
|
|
15
15
|
export type { AparteUiProps, AparteUiHandle } from './components/AparteUi.js';
|
|
16
|
-
export type { AparteMessage, AparteSendEventDetail, AparteActionEventDetail, AparteSegment, AparteTextSegment, AparteCodeSegment, AparteThinkingSegment,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
16
|
+
export type { AparteMessage, AparteSendEventDetail, AparteActionEventDetail, AparteSegment, AparteTextSegment, AparteCodeSegment, AparteThinkingSegment, } from './types.js';
|
|
17
|
+
import type { AparteElementAttributes, AparteElementTagName, AparteTemplateAttrs } from '@aparte/core';
|
|
18
|
+
import type * as React from 'react';
|
|
19
|
+
/**
|
|
20
|
+
* One attribute, as React must write it.
|
|
21
|
+
*
|
|
22
|
+
* A presence attribute becomes `'' | undefined`, not `boolean`, and that is not
|
|
23
|
+
* pedantry: React stringifies what it sets on a custom element, so `disabled={false}`
|
|
24
|
+
* would render `disabled="false"` — and an element that tests `hasAttribute` reads
|
|
25
|
+
* that as ON. The wrapper's own bubble rendering already uses this idiom
|
|
26
|
+
* (`streaming={isAwaitingReply(m) ? '' : undefined}`); the type now enforces it.
|
|
27
|
+
*
|
|
28
|
+
* A numeric attribute accepts a number or the string it will become, because both
|
|
29
|
+
* read naturally in JSX.
|
|
30
|
+
*/
|
|
31
|
+
/**
|
|
32
|
+
* An aparté tag in JSX: the standard HTML props, plus the element's own attributes.
|
|
33
|
+
*
|
|
34
|
+
* `Omit` puts the ELEMENT's contract first where the two collide, and one collision is
|
|
35
|
+
* real: `<aparte-chat-bubble role="assistant">` is the message role, while React types
|
|
36
|
+
* `role` as an `AriaRole` union. Intersecting them would leave no assignable value at
|
|
37
|
+
* all, so the element wins and ARIA's narrower type steps aside.
|
|
38
|
+
*/
|
|
39
|
+
type AparteTagProps<T> = Omit<React.DetailedHTMLProps<React.HTMLAttributes<HTMLElement>, HTMLElement>, keyof T> & AparteTemplateAttrs<T>;
|
|
40
|
+
/**
|
|
41
|
+
* Derived from `AparteElementAttributes` rather than listed, so the set cannot drift:
|
|
42
|
+
* an element added to core is typed here the moment it is added to that registry, and
|
|
43
|
+
* one removed from it stops being valid JSX. Listing them by hand is what let nine of
|
|
44
|
+
* eighteen be the whole story.
|
|
45
|
+
*
|
|
46
|
+
* Events are not here on purpose. React has no prop form for a custom event, so a
|
|
47
|
+
* consumer reaches them by ref — and `HTMLElementEventMap` is already augmented by
|
|
48
|
+
* `@aparte/core`, so `el.addEventListener('aparte-select-change', e => e.detail.value)`
|
|
49
|
+
* is typed with nothing further from this package.
|
|
50
|
+
*/
|
|
51
|
+
type AparteIntrinsicElements = {
|
|
52
|
+
[K in AparteElementTagName]: AparteTagProps<AparteElementAttributes[K]>;
|
|
53
|
+
};
|
|
28
54
|
declare global {
|
|
29
55
|
namespace JSX {
|
|
30
56
|
interface IntrinsicElements extends AparteIntrinsicElements {
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAKlE,YAAY,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAG5D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,YAAY,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAG9D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAC3E,YAAY,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,QAAQ,EAAE,MAAM,0BAA0B,CAAC;AACpD,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE9E,YAAY,EACR,aAAa,EACb,qBAAqB,EACrB,uBAAuB,EACvB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AACxD,YAAY,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAKlE,YAAY,EAAE,uBAAu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IAEnB,UAAU,GAAG,CAAC;QACV,UAAU,iBAAkB,SAAQ,uBAAuB;SAAG;KACjE;CACJ"}
|
package/dist/types.d.ts
CHANGED
|
@@ -4,5 +4,5 @@
|
|
|
4
4
|
* WITHOUT `targetId`, which the composer actually sends (multi-instance scoping);
|
|
5
5
|
* re-export the canonical one so the field isn't silently dropped from the type.
|
|
6
6
|
*/
|
|
7
|
-
export type { AparteMessage, AparteSegment, AparteTextSegment, AparteCodeSegment, AparteThinkingSegment,
|
|
7
|
+
export type { AparteMessage, AparteSegment, AparteTextSegment, AparteCodeSegment, AparteThinkingSegment, AparteSendEventDetail, AparteActionEventDetail, } from '@aparte/core';
|
|
8
8
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,YAAY,EACR,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,YAAY,EACR,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,GAC1B,MAAM,cAAc,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aparte/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "React 18+ wrapper for aparté — an ergonomic <AparteChat> component plus hooks over the framework-agnostic web components.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"react-dom": "^19.2.7",
|
|
40
40
|
"typescript": "^5.4.0",
|
|
41
41
|
"vite": "^6.0.0",
|
|
42
|
-
"@aparte/core": "0.
|
|
42
|
+
"@aparte/core": "0.11.0"
|
|
43
43
|
},
|
|
44
44
|
"keywords": [
|
|
45
45
|
"react",
|