@aparte/svelte 0.11.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/dist/index.d.ts CHANGED
@@ -15,18 +15,33 @@ 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
17
  import type { HTMLAttributes } from 'svelte/elements';
18
- import type { AparteElementAttributes, AparteElementTagName, AparteTemplateAttrs } from '@aparte/core';
18
+ import type { AparteElementAttributes, AparteElementTagName, AparteTemplateAttrs, AparteUiEventName } from '@aparte/core';
19
19
  /**
20
20
  * Svelte's `on:` handlers, for every event aparté dispatches.
21
21
  *
22
- * Derived from `HTMLElementEventMap`, which `@aparte/core` augments — so this needs no
23
- * list of its own and cannot fall behind. Declaring the elements without it made the
24
- * wrapper's OWN component stop type-checking (`on:aparte-send` on `<aparte-composer>`),
25
- * which is how the gap surfaced.
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.
26
38
  */
27
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>;
28
43
  type AparteSvelteHandlers = {
29
- [K in AparteEventName as `on:${K}`]?: (event: HTMLElementEventMap[K]) => void;
44
+ [K in AparteAnyEventName as `on:${K}`]?: (event: AparteEventFor<K>) => void;
30
45
  };
31
46
  type AparteSvelteElements = {
32
47
  [K in AparteElementTagName]: HTMLAttributes<HTMLElement> & AparteTemplateAttrs<AparteElementAttributes[K]> & AparteSvelteHandlers;
@@ -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;AAgBpB,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,u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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.11.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.11.0"
54
+ "@aparte/core": "0.12.0"
55
55
  },
56
56
  "keywords": [
57
57
  "svelte",