@ai-ecoverse/slicc-spectrum 1.3.0 → 1.4.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.
@@ -1,3 +1,11 @@
1
1
  export declare const defaultFontBase = "/fonts/";
2
+ export interface FontFile {
3
+ family: string;
4
+ weight: number;
5
+ url: string;
6
+ format: 'woff2' | 'opentype';
7
+ }
8
+ export declare function fontFiles(base: string | null, codeBase: string): FontFile[];
2
9
  export declare function fontFaces(base: string | null, codeBase: string): string;
10
+ export declare function installedFonts(): readonly FontFile[];
3
11
  export declare function installFonts(document: Document, base: string | null, codeBase: string): HTMLStyleElement;
@@ -0,0 +1,24 @@
1
+ import { LitElement, type PropertyValues, type TemplateResult } from 'lit';
2
+ type IconNode = Array<[string, Record<string, string | number>]>;
3
+ type Library = Record<string, unknown> & {
4
+ icons: Record<string, IconNode>;
5
+ };
6
+ export declare function load(): Promise<Library>;
7
+ export declare function pascal(name: string): string;
8
+ export declare function svg(name: string, node: IconNode): string;
9
+ export declare function icons(names: readonly unknown[]): Promise<Record<string, string>>;
10
+ export declare class SliccLucide extends LitElement {
11
+ static properties: {
12
+ name: {};
13
+ markup: {
14
+ state: boolean;
15
+ };
16
+ };
17
+ name: string;
18
+ markup: string;
19
+ static styles: import("lit").CSSResult;
20
+ constructor();
21
+ protected willUpdate(changed: PropertyValues<this>): void;
22
+ render(): TemplateResult;
23
+ }
24
+ export {};
@@ -1,7 +1,8 @@
1
1
  import { nothing, type TemplateResult } from 'lit';
2
- import type { AssistantMessage, ErrorAction, LickChannel, LickMessage, LickState, MessagePart, SystemMessage, ToolCall, ToolMessage, UserMessage } from '../model/types.js';
2
+ import type { AssistantMessage, ErrorAction, LickChannel, LickMessage, LickState, MessagePart, SliccModel, SystemMessage, ToolCall, ToolMessage, UserMessage } from '../model/types.js';
3
3
  export interface Handlers {
4
4
  color: 'light' | 'dark';
5
+ model: SliccModel | null;
5
6
  answer(questionId: string, answer: string): void;
6
7
  resolve(messageId: string, state: Exclude<LickState, 'pending'>): void;
7
8
  action(action: ErrorAction): void;
@@ -1,7 +1,15 @@
1
1
  import { type TemplateResult } from 'lit';
2
2
  import type { SliccModel } from '../model/types.js';
3
3
  import { ThemedElement } from './base.js';
4
- export declare function themed(source: string, color: 'light' | 'dark'): string;
4
+ import { type FontFile } from './fonts.js';
5
+ export declare const bridge = "(() => {\n const post = (message) => parent.postMessage(message, '*');\n window.slicc = {\n name: document.currentScript.dataset.name,\n lick(event) {\n const value = typeof event === 'string' ? { action: event } : event || {};\n post({ type: 'slicc-lick', action: String(value.action || ''), data: value.data ?? null, target: value.target ?? null });\n },\n };\n const wanted = new Set();\n let timer = 0;\n window.LucideIcons = {\n render() {\n for (const node of document.querySelectorAll('i[data-lucide]')) wanted.add(node.dataset.lucide);\n clearTimeout(timer);\n timer = setTimeout(() => post({ type: 'slicc-icons', names: [...wanted] }));\n },\n };\n const swap = (found) => {\n for (const node of document.querySelectorAll('i[data-lucide]')) {\n const markup = found[node.dataset.lucide];\n if (!markup) continue;\n const template = document.createElement('template');\n template.innerHTML = markup;\n const svg = template.content.firstElementChild;\n for (const { name, value } of node.attributes) {\n if (name === 'class') svg.setAttribute('class', svg.getAttribute('class') + ' ' + value);\n else if (name !== 'data-lucide') svg.setAttribute(name, value);\n }\n node.replaceWith(svg);\n }\n };\n const fonts = (list) => {\n for (const font of list) {\n const face = new FontFace(font.family, font.data, { weight: String(font.weight) });\n document.fonts.add(face);\n face.load().catch(() => {});\n }\n };\n addEventListener('message', (event) => {\n if (event.source !== parent) return;\n const message = event.data || {};\n if (message.type === 'slicc-icons') swap(message.icons);\n if (message.type === 'slicc-fonts') fonts(message.fonts);\n });\n const size = () => {\n const style = getComputedStyle(document.body);\n post({ type: 'slicc-size', height: Math.ceil(document.body.offsetHeight + parseFloat(style.marginTop) + parseFloat(style.marginBottom)) });\n };\n document.addEventListener('DOMContentLoaded', () => {\n window.LucideIcons.render();\n new ResizeObserver(size).observe(document.body);\n });\n post({ type: 'slicc-ready' });\n})();";
6
+ export declare function frameDocument(source: string, color: 'light' | 'dark', name: string): string;
7
+ export declare function fontData(url: string): Promise<ArrayBuffer | null>;
8
+ export declare function frameFonts(files: readonly FontFile[], base: string): Promise<Array<{
9
+ family: string;
10
+ weight: number;
11
+ data: ArrayBuffer;
12
+ }>>;
5
13
  export declare class SliccSprinkle extends ThemedElement {
6
14
  #private;
7
15
  static properties: {
@@ -9,8 +17,17 @@ export declare class SliccSprinkle extends ThemedElement {
9
17
  attribute: boolean;
10
18
  };
11
19
  sprinkle: {};
20
+ inline: {
21
+ type: BooleanConstructor;
22
+ reflect: boolean;
23
+ };
24
+ height: {
25
+ state: boolean;
26
+ };
12
27
  };
13
28
  sprinkle: string;
29
+ inline: boolean;
30
+ height: number;
14
31
  constructor();
15
32
  static styles: import("lit").CSSResult;
16
33
  protected subscribe(model: SliccModel): Array<() => void>;
@@ -123,6 +123,9 @@ export type MessagePart = {
123
123
  url: string;
124
124
  title: string;
125
125
  description: string;
126
+ } | {
127
+ type: 'sprinkle';
128
+ sprinkle: string;
126
129
  } | {
127
130
  type: 'error';
128
131
  message: string;
@@ -402,6 +405,7 @@ export interface Sprinkle {
402
405
  icon: string;
403
406
  agentId: string;
404
407
  html: string;
408
+ inline?: boolean;
405
409
  }
406
410
  export interface SprinkleEvents {
407
411
  sprinkles: readonly Sprinkle[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-ecoverse/slicc-spectrum",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Web components for SLICC on Spectrum Web Components: the terminal, the app shell and its surfaces",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -66,7 +66,7 @@
66
66
  }
67
67
  },
68
68
  "devDependencies": {
69
- "@ai-ecoverse/slicc-kernel": "1.7.2",
69
+ "@ai-ecoverse/slicc-kernel": "1.8.2",
70
70
  "@ai-ecoverse/slicc-shared-web": "1.4.1",
71
71
  "@ai-ecoverse/wasm-bash": "5.3.0-7",
72
72
  "@ai-ecoverse/wasm-coreutils": "9.7.0-3",
@@ -95,6 +95,7 @@
95
95
  "esbuild": "0.28.2",
96
96
  "happy-dom": "20.14.5",
97
97
  "lefthook": "2.1.17",
98
+ "lucide": "1.52.0",
98
99
  "monocart-coverage-reports": "2.13.0",
99
100
  "playwright-core": "1.63.0",
100
101
  "semantic-release": "25.0.9",