@aparte/svelte 0.10.0 → 0.12.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 +5 -2
- package/dist/index.d.ts +36 -0
- package/dist/index.d.ts.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -42,7 +42,10 @@ npm install @aparte/svelte @aparte/core svelte
|
|
|
42
42
|
The user's message is appended automatically on send — don't add it yourself. `on:messageSent` is
|
|
43
43
|
optional and only for side-effects (scroll, analytics).
|
|
44
44
|
|
|
45
|
-
`@aparte/core` and `svelte` are **peer dependencies**.
|
|
46
|
-
|
|
45
|
+
`@aparte/core` and `svelte` are **peer dependencies**.
|
|
46
|
+
|
|
47
|
+
Every `<aparte-*>` tag is declared through `SvelteHTMLElements`, so `svelte-check` covers its
|
|
48
|
+
attributes and its `on:` handlers. `<AparteUi name="my-widget" />` remains for an element aparté does
|
|
49
|
+
not define.
|
|
47
50
|
|
|
48
51
|
> ESM-only. See the docs for the full API. Part of the aparté monorepo.
|
package/dist/index.d.ts
CHANGED
|
@@ -14,4 +14,40 @@ export { createConversationManager } from './stores/conversationManager.js';
|
|
|
14
14
|
export { default as AparteUi } from './AparteUi.svelte';
|
|
15
15
|
export type { AparteUiProps, AparteUiHandle } from './types.js';
|
|
16
16
|
export type { AparteMessage, AparteSendEventDetail, AparteActionEventDetail, AparteSegment, AparteTextSegment, AparteCodeSegment, AparteThinkingSegment } from './types.js';
|
|
17
|
+
import type { HTMLAttributes } from 'svelte/elements';
|
|
18
|
+
import type { AparteElementAttributes, AparteElementTagName, AparteTemplateAttrs, AparteUiEventName } from '@aparte/core';
|
|
19
|
+
/**
|
|
20
|
+
* Svelte's `on:` handlers, for every event aparté dispatches.
|
|
21
|
+
*
|
|
22
|
+
* Derived from TWO sources, and it needs both. `HTMLElementEventMap` — which
|
|
23
|
+
* `@aparte/core` augments — carries the events with a detail. It deliberately omits the
|
|
24
|
+
* five that have none (`aparte-cancel`, `aparte-composer-submit`, `aparte-reset-done`,
|
|
25
|
+
* `aparte-select-open`, `aparte-select-close`), because a map entry would type
|
|
26
|
+
* `e.detail` as `null` and gain nothing.
|
|
27
|
+
*
|
|
28
|
+
* That omission was harmless while it only governed `addEventListener`. Declaring the
|
|
29
|
+
* tags here made it a regression: `SvelteHTMLElements` used to end in a catch-all index
|
|
30
|
+
* signature that accepted any `on:` name, and narrowing the tags removed it — so
|
|
31
|
+
* `on:aparte-cancel`, the STOP BUTTON, stopped type-checking. A typed surface that takes
|
|
32
|
+
* a capability away is worse than no typed surface.
|
|
33
|
+
*
|
|
34
|
+
* `AparteUiEventName` closes it: core's proxy list already enumerates every event an
|
|
35
|
+
* element dispatches on itself, those five included, and it is the list `AparteUi`
|
|
36
|
+
* forwards — so the two are the same set by construction. Still no hand-written list
|
|
37
|
+
* here, which is the property that mattered.
|
|
38
|
+
*/
|
|
39
|
+
type AparteEventName = Extract<keyof HTMLElementEventMap, `aparte-${string}`>;
|
|
40
|
+
type AparteAnyEventName = AparteEventName | AparteUiEventName;
|
|
41
|
+
/** The typed event for a name, or a detail-free `CustomEvent` when the map has none. */
|
|
42
|
+
type AparteEventFor<K extends string> = K extends keyof HTMLElementEventMap ? HTMLElementEventMap[K] : CustomEvent<null>;
|
|
43
|
+
type AparteSvelteHandlers = {
|
|
44
|
+
[K in AparteAnyEventName as `on:${K}`]?: (event: AparteEventFor<K>) => void;
|
|
45
|
+
};
|
|
46
|
+
type AparteSvelteElements = {
|
|
47
|
+
[K in AparteElementTagName]: HTMLAttributes<HTMLElement> & AparteTemplateAttrs<AparteElementAttributes[K]> & AparteSvelteHandlers;
|
|
48
|
+
};
|
|
49
|
+
declare module 'svelte/elements' {
|
|
50
|
+
interface SvelteHTMLElements extends AparteSvelteElements {
|
|
51
|
+
}
|
|
52
|
+
}
|
|
17
53
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAG5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAK9D,YAAY,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAG5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACxD,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEhE,YAAY,EACR,aAAa,EACb,qBAAqB,EACrB,uBAAuB,EACvB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACxB,MAAM,YAAY,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/lib/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAG5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAK9D,YAAY,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAG5D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,yBAAyB,EAAE,MAAM,iCAAiC,CAAC;AAC5E,OAAO,EAAE,OAAO,IAAI,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AACxD,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAEhE,YAAY,EACR,aAAa,EACb,qBAAqB,EACrB,uBAAuB,EACvB,aAAa,EACb,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACxB,MAAM,YAAY,CAAC;AAiBpB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,uBAAuB,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAE1H;;;;;;;;;;;;;;;;;;;GAmBG;AACH,KAAK,eAAe,GAAG,OAAO,CAAC,MAAM,mBAAmB,EAAE,UAAU,MAAM,EAAE,CAAC,CAAC;AAC9E,KAAK,kBAAkB,GAAG,eAAe,GAAG,iBAAiB,CAAC;AAE9D,wFAAwF;AACxF,KAAK,cAAc,CAAC,CAAC,SAAS,MAAM,IAChC,CAAC,SAAS,MAAM,mBAAmB,GAAG,mBAAmB,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC;AAErF,KAAK,oBAAoB,GAAG;KACvB,CAAC,IAAI,kBAAkB,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,cAAc,CAAC,CAAC,CAAC,KAAK,IAAI;CAC9E,CAAC;AAEF,KAAK,oBAAoB,GAAG;KACvB,CAAC,IAAI,oBAAoB,GACtB,cAAc,CAAC,WAAW,CAAC,GACzB,mBAAmB,CAAC,uBAAuB,CAAC,CAAC,CAAC,CAAC,GAC/C,oBAAoB;CAC7B,CAAC;AAEF,OAAO,QAAQ,iBAAiB,CAAC;IAC7B,UAAU,kBAAmB,SAAQ,oBAAoB;KAAG;CAC/D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aparte/svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "Svelte wrapper for aparté — an ergonomic <AparteChat> component plus stores over the framework-agnostic web components. Works on Svelte 4 and 5.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"svelte2tsx": "^0.7.61",
|
|
52
52
|
"typescript": "^5.4.0",
|
|
53
53
|
"vite": "^6.0.0",
|
|
54
|
-
"@aparte/core": "0.
|
|
54
|
+
"@aparte/core": "0.12.0"
|
|
55
55
|
},
|
|
56
56
|
"keywords": [
|
|
57
57
|
"svelte",
|