@aparte/plugin-model-selector 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 CHANGED
@@ -16,9 +16,25 @@ import '@aparte/plugin-model-selector'; // registers <aparte-model-selector>
16
16
  <aparte-model-selector auto-select persist searchable></aparte-model-selector>
17
17
  ```
18
18
 
19
- `@aparte/core` is the only **peer dependency**. Importing the package registers the
19
+ `@aparte/core` is the only required **peer dependency**. Importing the package registers the
20
20
  `<aparte-model-selector>` element as a side effect.
21
21
 
22
+ ## Typed in your framework
23
+
24
+ The element is typed by this package rather than by the framework wrappers, through one
25
+ subpath per framework — so you get the binding exactly when you have the plugin:
26
+
27
+ ```ts
28
+ import '@aparte/plugin-model-selector/react'; // or /vue, or /svelte — types only, no runtime
29
+ ```
30
+
31
+ ```ts
32
+ // Angular needs a class claiming the selector, so it gets a directive:
33
+ import { AparteModelSelectorDirective } from '@aparte/plugin-model-selector/angular';
34
+ ```
35
+
36
+ `react`, `vue`, `svelte` and `@angular/core` are **optional** peers.
37
+
22
38
  | Attribute | Effect |
23
39
  |---------------|-----------------------------------------------------------|
24
40
  | `auto-select` | Select the first available model on mount |
@@ -0,0 +1,28 @@
1
+ /**
2
+ * `<aparte-model-selector>` as an Angular directive. Import it into a standalone
3
+ * component:
4
+ *
5
+ * ```ts
6
+ * import { AparteModelSelectorDirective } from '@aparte/plugin-model-selector/angular';
7
+ * // @Component({ imports: [AparteModelSelectorDirective], … })
8
+ * ```
9
+ *
10
+ * ## Why this entry point exists at all
11
+ *
12
+ * The other three frameworks learn a tag from a declaration merge, so `./react`, `./vue`
13
+ * and `./svelte` carry no runtime — 0.04 kB each. Angular cannot: its template compiler
14
+ * needs a CLASS claiming the selector, and `[persist]="true"` on a custom element writes
15
+ * a property, which on an attribute-driven element is a silent no-op. So this one is real
16
+ * code, and real code in an Angular library has to be compiled in partial-Ivy mode —
17
+ * which is why the build runs `ngc` for these two files and Vite for everything else.
18
+ *
19
+ * It lives here rather than in `@aparte/angular` for the reason that governs all four:
20
+ * a wrapper types what it depends on, and it depends on no plugin. A third-party plugin's
21
+ * author cannot add a directive to our wrapper, so shipping ours from there would give
22
+ * aparté's packages a privilege theirs could never have.
23
+ *
24
+ * `@angular/core` is an OPTIONAL peer: install this package without Angular and nothing
25
+ * here is reachable, which is the point — you get the binding only if you can use it.
26
+ */
27
+ export { AparteModelSelectorDirective, APARTE_ELEMENT_DIRECTIVES } from './generated/element.directives.js';
28
+ //# sourceMappingURL=angular.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"angular.d.ts","sourceRoot":"","sources":["../src/angular.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,OAAO,EAAE,4BAA4B,EAAE,yBAAyB,EAAE,MAAM,mCAAmC,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * `<aparte-model-selector>` as an Angular directive. Import it into a standalone
3
+ * component:
4
+ *
5
+ * ```ts
6
+ * import { AparteModelSelectorDirective } from '@aparte/plugin-model-selector/angular';
7
+ * // @Component({ imports: [AparteModelSelectorDirective], … })
8
+ * ```
9
+ *
10
+ * ## Why this entry point exists at all
11
+ *
12
+ * The other three frameworks learn a tag from a declaration merge, so `./react`, `./vue`
13
+ * and `./svelte` carry no runtime — 0.04 kB each. Angular cannot: its template compiler
14
+ * needs a CLASS claiming the selector, and `[persist]="true"` on a custom element writes
15
+ * a property, which on an attribute-driven element is a silent no-op. So this one is real
16
+ * code, and real code in an Angular library has to be compiled in partial-Ivy mode —
17
+ * which is why the build runs `ngc` for these two files and Vite for everything else.
18
+ *
19
+ * It lives here rather than in `@aparte/angular` for the reason that governs all four:
20
+ * a wrapper types what it depends on, and it depends on no plugin. A third-party plugin's
21
+ * author cannot add a directive to our wrapper, so shipping ours from there would give
22
+ * aparté's packages a privilege theirs could never have.
23
+ *
24
+ * `@angular/core` is an OPTIONAL peer: install this package without Angular and nothing
25
+ * here is reachable, which is the point — you get the binding only if you can use it.
26
+ */
27
+ export { AparteModelSelectorDirective, APARTE_ELEMENT_DIRECTIVES } from './generated/element.directives.js';
@@ -1,19 +1,29 @@
1
+ import { type AparteConfig, type AparteConfigAware } from '@aparte/core';
1
2
  /**
2
- * Aparté Model Selector
3
+ * Selects an AI provider and a model. Renders an `<aparte-select>` with providers
4
+ * grouped into `<aparte-optgroup>`s — a single provider renders a flat list — which is
5
+ * what makes the BYOK pattern possible without core knowing about any vendor.
3
6
  *
4
- * Web Component for selecting an AI provider + model. Renders an `aparte-select`
5
- * primitive with providers grouped into `aparte-optgroup`s (a single provider
6
- * renders a flat list). Enables the BYOK (Bring Your Own Key) pattern.
7
+ * These tags sat at the top of the file, above the imports and a helper, so nothing
8
+ * read them: TypeScript associates only the comment adjacent to the declaration. This
9
+ * package ships no manifest of its own today (only `@aparte/core` runs `cem analyze`),
10
+ * so the loss was invisible to tooling — but it is also what an editor shows on hover,
11
+ * and what a typed framework wrapper is written from.
7
12
  *
8
13
  * @element aparte-model-selector
9
- * @attr {boolean} auto-select - Auto-select the first model (default: false)
10
- * @attr {boolean} persist - Persist the selection through the config
11
- * @attr {boolean} searchable - Enable search in the dropdown
12
- * @attr {string} placeholder - Override the placeholder text
14
+ * @attr {boolean} auto-select - Selects the first model as soon as one is available.
15
+ * @attr {boolean} persist - Writes the selection back through the config, so it survives a reload.
16
+ * @attr {boolean} searchable - Adds the dropdown's filter field.
17
+ * @attr {string} placeholder - Overrides the text shown while nothing is selected.
18
+ *
19
+ * @fires {CustomEvent<AparteModelChangeEventDetail>} aparte-model-change - The provider or the model changed; carries both ids.
13
20
  *
14
- * @fires aparte-model-change - Fired when the selected model changes
21
+ * @example
22
+ * <!-- Mount it in the composer's toolbar; it reads the models the config already knows. -->
23
+ * <aparte-composer-toolbar>
24
+ * <aparte-model-selector searchable placeholder="Pick a model"></aparte-model-selector>
25
+ * </aparte-composer-toolbar>
15
26
  */
16
- import { type AparteConfig, type AparteConfigAware } from '@aparte/core';
17
27
  export declare class AparteModelSelector extends HTMLElement implements AparteConfigAware {
18
28
  private _currentProviderId;
19
29
  private _currentModelId;
@@ -1 +1 @@
1
- {"version":3,"file":"aparte-model-selector.d.ts","sourceRoot":"","sources":["../src/aparte-model-selector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAIH,KAAK,YAAY,EACjB,KAAK,iBAAiB,EAOzB,MAAM,cAAc,CAAC;AAoBtB,qBAAa,mBAAoB,SAAQ,WAAY,YAAW,iBAAiB;IAC7E,OAAO,CAAC,kBAAkB,CAAuB;IACjD,OAAO,CAAC,eAAe,CAAuB;IAC9C,OAAO,CAAC,eAAe,CAAwB;IAC/C,OAAO,CAAC,aAAa,CAA6B;IAClD,OAAO,CAAC,UAAU,CAAS;IAC3B,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,eAAe,CAA0B;IAEjD;;;;;;;;;;OAUG;IACH,OAAO,CAAC,IAAI,CAAoC;IAEhD,OAAO,CAAC,kBAAkB,CAA6B;IAGvD,OAAO,CAAC,kBAAkB,CAAiC;IAC3D,OAAO,CAAC,qBAAqB,CAA2D;IAExF,MAAM,KAAK,kBAAkB,IAAI,MAAM,EAAE,CAExC;IAEK,iBAAiB,IAAI,OAAO,CAAC,IAAI,CAAC;IAwBxC,uEAAuE;IACvE,OAAO,CAAC,kBAAkB;IAgC1B;;;;;OAKG;IACH,OAAO,CAAC,QAAQ;IAMhB,oBAAoB,IAAI,IAAI;IAM5B;;;;;;;;OAQG;IACH,mBAAmB,CAAC,IAAI,EAAE,YAAY,GAAG,IAAI;IAqB7C,wBAAwB,IAAI,IAAI;IAUhC,2BAA2B;IAC3B,IAAI,UAAU,IAAI,MAAM,GAAG,IAAI,CAE9B;IAED,wBAAwB;IACxB,IAAI,OAAO,IAAI,MAAM,GAAG,IAAI,CAE3B;IAED,0CAA0C;IAC1C,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO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