llm-testrunner-components 1.0.0 → 1.0.2
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 +139 -81
- package/dist/cjs/{index-CCrH7f-W.js → index-CY2lQip_.js} +190 -33
- package/dist/cjs/index-CY2lQip_.js.map +1 -0
- package/dist/cjs/index.cjs.js +391 -5
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/llm-test-runner.cjs.entry.js +9 -0
- package/dist/cjs/llm-test-runner.entry.cjs.js.map +1 -0
- package/dist/cjs/{llm-testrunner-components.cjs.js → llm-testrunner.cjs.js} +5 -7
- package/dist/cjs/llm-testrunner.cjs.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -4
- package/dist/collection/collection-manifest.json +3 -4
- package/dist/collection/components/error-message/error-message.js +8 -0
- package/dist/collection/components/error-message/error-message.js.map +1 -0
- package/dist/collection/components/llm-test-runner/llm-test-runner.css +671 -0
- package/dist/collection/components/llm-test-runner/llm-test-runner.js +310 -0
- package/dist/collection/components/llm-test-runner/llm-test-runner.js.map +1 -0
- package/dist/collection/index.js +4 -10
- package/dist/collection/index.js.map +1 -1
- package/dist/collection/lib/evaluation/evaluation-engine.js +61 -0
- package/dist/collection/lib/evaluation/evaluation-engine.js.map +1 -0
- package/dist/collection/lib/evaluation/index.js +7 -0
- package/dist/collection/lib/evaluation/index.js.map +1 -0
- package/dist/collection/lib/evaluation/types.js +2 -0
- package/dist/collection/lib/evaluation/types.js.map +1 -0
- package/dist/components/index.js +1652 -4
- package/dist/components/index.js.map +1 -1
- package/dist/components/{current-time.d.ts → llm-test-runner.d.ts} +4 -4
- package/dist/components/llm-test-runner.js +9 -0
- package/dist/components/llm-test-runner.js.map +1 -0
- package/dist/esm/{index-0jlGA6MK.js → index-DBp-rMPb.js} +190 -33
- package/dist/esm/index-DBp-rMPb.js.map +1 -0
- package/dist/esm/index.js +391 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/llm-test-runner.entry.js +3 -0
- package/dist/esm/llm-test-runner.entry.js.map +1 -0
- package/dist/esm/{llm-testrunner-components.js → llm-testrunner.js} +5 -7
- package/dist/esm/llm-testrunner.js.map +1 -0
- package/dist/esm/loader.js +3 -5
- package/dist/llm-testrunner/index.esm.js +2 -0
- package/dist/llm-testrunner/index.esm.js.map +1 -0
- package/dist/llm-testrunner/llm-test-runner.entry.esm.js.map +1 -0
- package/dist/llm-testrunner/llm-testrunner.esm.js +2 -0
- package/dist/llm-testrunner/llm-testrunner.esm.js.map +1 -0
- package/dist/llm-testrunner/p-DBp-rMPb.js +3 -0
- package/dist/llm-testrunner/p-DBp-rMPb.js.map +1 -0
- package/dist/llm-testrunner/p-ed2ea423.entry.js +2 -0
- package/dist/llm-testrunner/p-ed2ea423.entry.js.map +1 -0
- package/dist/react/components.d.ts +9 -0
- package/dist/react/components.d.ts.map +1 -0
- package/dist/react/components.js +12 -0
- package/dist/react/index.d.ts +2 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/react/index.js +2 -0
- package/dist/types/components/error-message/error-message.d.ts +7 -0
- package/dist/types/components/llm-test-runner/llm-test-runner.d.ts +42 -0
- package/dist/types/components.d.ts +11 -46
- package/dist/types/index.d.ts +2 -10
- package/dist/types/lib/evaluation/evaluation-engine.d.ts +8 -0
- package/dist/types/lib/evaluation/index.d.ts +5 -0
- package/dist/types/lib/evaluation/types.d.ts +23 -0
- package/dist/types/stencil-public-runtime.d.ts +41 -3
- package/package.json +33 -12
- package/dist/cjs/current-time.my-component.entry.cjs.js.map +0 -1
- package/dist/cjs/current-time_2.cjs.entry.js +0 -67
- package/dist/cjs/current-time_2.cjs.entry.js.map +0 -1
- package/dist/cjs/index-CCrH7f-W.js.map +0 -1
- package/dist/cjs/llm-testrunner-components.cjs.js.map +0 -1
- package/dist/collection/components/my-component/current-time.js +0 -35
- package/dist/collection/components/my-component/current-time.js.map +0 -1
- package/dist/collection/components/my-component/my-component.css +0 -3
- package/dist/collection/components/my-component/my-component.js +0 -96
- package/dist/collection/components/my-component/my-component.js.map +0 -1
- package/dist/collection/utils/utils.js +0 -4
- package/dist/collection/utils/utils.js.map +0 -1
- package/dist/components/current-time.js +0 -9
- package/dist/components/current-time.js.map +0 -1
- package/dist/components/my-component.d.ts +0 -11
- package/dist/components/my-component.js +0 -63
- package/dist/components/my-component.js.map +0 -1
- package/dist/components/p-CbvWSaCI.js +0 -53
- package/dist/components/p-CbvWSaCI.js.map +0 -1
- package/dist/components/p-DnDi6fKi.js +0 -1101
- package/dist/components/p-DnDi6fKi.js.map +0 -1
- package/dist/esm/current-time.my-component.entry.js.map +0 -1
- package/dist/esm/current-time_2.entry.js +0 -64
- package/dist/esm/current-time_2.entry.js.map +0 -1
- package/dist/esm/index-0jlGA6MK.js.map +0 -1
- package/dist/esm/llm-testrunner-components.js.map +0 -1
- package/dist/llm-testrunner-components/current-time.my-component.entry.esm.js.map +0 -1
- package/dist/llm-testrunner-components/index.esm.js +0 -2
- package/dist/llm-testrunner-components/index.esm.js.map +0 -1
- package/dist/llm-testrunner-components/llm-testrunner-components.esm.js +0 -2
- package/dist/llm-testrunner-components/llm-testrunner-components.esm.js.map +0 -1
- package/dist/llm-testrunner-components/p-0jlGA6MK.js +0 -3
- package/dist/llm-testrunner-components/p-0jlGA6MK.js.map +0 -1
- package/dist/llm-testrunner-components/p-15e5e0fe.entry.js +0 -2
- package/dist/llm-testrunner-components/p-15e5e0fe.entry.js.map +0 -1
- package/dist/types/components/my-component/current-time.d.ts +0 -7
- package/dist/types/components/my-component/my-component.d.ts +0 -16
- package/dist/types/utils/utils.d.ts +0 -1
- /package/dist/{llm-testrunner-components → llm-testrunner}/loader.esm.js.map +0 -0
- /package/dist/{llm-testrunner-components → llm-testrunner}/p-DQuL1Twl.js +0 -0
- /package/dist/{llm-testrunner-components → llm-testrunner}/p-DQuL1Twl.js.map +0 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { createComponent } from '@stencil/react-output-target/runtime';
|
|
3
|
+
import { LlmTestRunner as LlmTestRunnerElement, defineCustomElement as defineLlmTestRunner } from "llm-testrunner-components/dist/components/llm-test-runner.js";
|
|
4
|
+
import React from 'react';
|
|
5
|
+
export const LlmTestRunner = /*@__PURE__*/ createComponent({
|
|
6
|
+
tagName: 'llm-test-runner',
|
|
7
|
+
elementClass: LlmTestRunnerElement,
|
|
8
|
+
// @ts-ignore - ignore potential React type mismatches between the Stencil Output Target and your project.
|
|
9
|
+
react: React,
|
|
10
|
+
events: {},
|
|
11
|
+
defineCustomElement: defineLlmTestRunner
|
|
12
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../generated/react/index.ts"],"names":[],"mappings":"AACA,cAAc,cAAc,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { EvaluationResult } from '../../lib/evaluation/types';
|
|
2
|
+
export interface TestCase {
|
|
3
|
+
id: string;
|
|
4
|
+
question: string;
|
|
5
|
+
expectedKeywords: string[];
|
|
6
|
+
expectedSourceLinks: string[];
|
|
7
|
+
output?: string;
|
|
8
|
+
isRunning?: boolean;
|
|
9
|
+
error?: string;
|
|
10
|
+
evaluationResult?: EvaluationResult;
|
|
11
|
+
}
|
|
12
|
+
export declare class LLMTestRunner {
|
|
13
|
+
apiKey: string;
|
|
14
|
+
testCases: TestCase[];
|
|
15
|
+
isRunningAll: boolean;
|
|
16
|
+
error: string;
|
|
17
|
+
private fileInput;
|
|
18
|
+
isExportingTestSuite: boolean;
|
|
19
|
+
private evaluationEngine;
|
|
20
|
+
private apiUrl;
|
|
21
|
+
componentWillLoad(): Promise<void>;
|
|
22
|
+
componentDidLoad(): void;
|
|
23
|
+
disconnectedCallback(): void;
|
|
24
|
+
private addNewTestCase;
|
|
25
|
+
private updateTestCase;
|
|
26
|
+
private runSingleTest;
|
|
27
|
+
private deleteTestCase;
|
|
28
|
+
private addKeyword;
|
|
29
|
+
private removeKeyword;
|
|
30
|
+
private addSourceLink;
|
|
31
|
+
private removeSourceLink;
|
|
32
|
+
private callGeminiAPI;
|
|
33
|
+
private evaluateResponse;
|
|
34
|
+
private runAllTests;
|
|
35
|
+
private generateId;
|
|
36
|
+
private handleFileSelect;
|
|
37
|
+
private handleFileChange;
|
|
38
|
+
private readFileAsync;
|
|
39
|
+
private downloadFile;
|
|
40
|
+
private handleExportTestSuite;
|
|
41
|
+
render(): any;
|
|
42
|
+
}
|
|
@@ -6,69 +6,34 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { HTMLStencilElement, JSXBase } from "./stencil-public-runtime";
|
|
8
8
|
export namespace Components {
|
|
9
|
-
interface
|
|
10
|
-
|
|
11
|
-
interface MyComponent {
|
|
12
|
-
/**
|
|
13
|
-
* The first name
|
|
14
|
-
*/
|
|
15
|
-
"first": string;
|
|
16
|
-
/**
|
|
17
|
-
* The last name
|
|
18
|
-
*/
|
|
19
|
-
"last": string;
|
|
20
|
-
/**
|
|
21
|
-
* The middle name
|
|
22
|
-
*/
|
|
23
|
-
"middle": string;
|
|
9
|
+
interface LlmTestRunner {
|
|
10
|
+
"apiKey": string;
|
|
24
11
|
}
|
|
25
12
|
}
|
|
26
13
|
declare global {
|
|
27
|
-
interface
|
|
28
|
-
}
|
|
29
|
-
var HTMLCurrentTimeElement: {
|
|
30
|
-
prototype: HTMLCurrentTimeElement;
|
|
31
|
-
new (): HTMLCurrentTimeElement;
|
|
32
|
-
};
|
|
33
|
-
interface HTMLMyComponentElement extends Components.MyComponent, HTMLStencilElement {
|
|
14
|
+
interface HTMLLlmTestRunnerElement extends Components.LlmTestRunner, HTMLStencilElement {
|
|
34
15
|
}
|
|
35
|
-
var
|
|
36
|
-
prototype:
|
|
37
|
-
new ():
|
|
16
|
+
var HTMLLlmTestRunnerElement: {
|
|
17
|
+
prototype: HTMLLlmTestRunnerElement;
|
|
18
|
+
new (): HTMLLlmTestRunnerElement;
|
|
38
19
|
};
|
|
39
20
|
interface HTMLElementTagNameMap {
|
|
40
|
-
"
|
|
41
|
-
"my-component": HTMLMyComponentElement;
|
|
21
|
+
"llm-test-runner": HTMLLlmTestRunnerElement;
|
|
42
22
|
}
|
|
43
23
|
}
|
|
44
24
|
declare namespace LocalJSX {
|
|
45
|
-
interface
|
|
46
|
-
|
|
47
|
-
interface MyComponent {
|
|
48
|
-
/**
|
|
49
|
-
* The first name
|
|
50
|
-
*/
|
|
51
|
-
"first"?: string;
|
|
52
|
-
/**
|
|
53
|
-
* The last name
|
|
54
|
-
*/
|
|
55
|
-
"last"?: string;
|
|
56
|
-
/**
|
|
57
|
-
* The middle name
|
|
58
|
-
*/
|
|
59
|
-
"middle"?: string;
|
|
25
|
+
interface LlmTestRunner {
|
|
26
|
+
"apiKey"?: string;
|
|
60
27
|
}
|
|
61
28
|
interface IntrinsicElements {
|
|
62
|
-
"
|
|
63
|
-
"my-component": MyComponent;
|
|
29
|
+
"llm-test-runner": LlmTestRunner;
|
|
64
30
|
}
|
|
65
31
|
}
|
|
66
32
|
export { LocalJSX as JSX };
|
|
67
33
|
declare module "@stencil/core" {
|
|
68
34
|
export namespace JSX {
|
|
69
35
|
interface IntrinsicElements {
|
|
70
|
-
"
|
|
71
|
-
"my-component": LocalJSX.MyComponent & JSXBase.HTMLAttributes<HTMLMyComponentElement>;
|
|
36
|
+
"llm-test-runner": LocalJSX.LlmTestRunner & JSXBase.HTMLAttributes<HTMLLlmTestRunnerElement>;
|
|
72
37
|
}
|
|
73
38
|
}
|
|
74
39
|
}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* This is the entry point for your component library. Use this file to export utilities,
|
|
5
|
-
* constants or data structure that accompany your components.
|
|
6
|
-
*
|
|
7
|
-
* DO NOT use this file to export your components. Instead, use the recommended approaches
|
|
8
|
-
* to consume components of this package as outlined in the `README.md`.
|
|
9
|
-
*/
|
|
10
|
-
export { format } from './utils/utils';
|
|
1
|
+
export { LLMTestRunner } from './components/llm-test-runner/llm-test-runner';
|
|
2
|
+
export type { TestCase } from './components/llm-test-runner/llm-test-runner';
|
|
11
3
|
export type * from './components.d.ts';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { EvaluationRequest, EvaluationCallback } from './types';
|
|
2
|
+
export declare class LLMEvaluationEngine {
|
|
3
|
+
constructor();
|
|
4
|
+
evaluateResponse(request: EvaluationRequest, callback: EvaluationCallback): Promise<void>;
|
|
5
|
+
private performEvaluation;
|
|
6
|
+
private evaluateKeywords;
|
|
7
|
+
private evaluateSourceLinks;
|
|
8
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { LLMEvaluationEngine } from './evaluation-engine';
|
|
2
|
+
import type { EvaluationRequest, EvaluationResult, KeywordMatch, SourceLinkMatch, EvaluationCallback } from './types';
|
|
3
|
+
export { LLMEvaluationEngine };
|
|
4
|
+
export type { EvaluationRequest, EvaluationResult, KeywordMatch, SourceLinkMatch, EvaluationCallback };
|
|
5
|
+
export declare function evaluateLLMResponse(request: EvaluationRequest, callback: EvaluationCallback): Promise<void>;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export interface EvaluationRequest {
|
|
2
|
+
testCaseId: string;
|
|
3
|
+
question: string;
|
|
4
|
+
expectedKeywords: string[];
|
|
5
|
+
expectedSourceLinks: string[];
|
|
6
|
+
actualResponse: string;
|
|
7
|
+
}
|
|
8
|
+
export interface EvaluationResult {
|
|
9
|
+
testCaseId: string;
|
|
10
|
+
passed: boolean;
|
|
11
|
+
keywordMatches: KeywordMatch[];
|
|
12
|
+
sourceLinkMatches: SourceLinkMatch[];
|
|
13
|
+
timestamp?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface KeywordMatch {
|
|
16
|
+
keyword: string;
|
|
17
|
+
found: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface SourceLinkMatch {
|
|
20
|
+
link: string;
|
|
21
|
+
found: boolean;
|
|
22
|
+
}
|
|
23
|
+
export type EvaluationCallback = (result: EvaluationResult) => void;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
type CustomMethodDecorator<T> = (target: object, propertyKey: string | symbol, descriptor: TypedPropertyDescriptor<T>) => TypedPropertyDescriptor<T> | void;
|
|
2
|
+
type UnionToIntersection<U> = (U extends any ? (x: U) => void : never) extends (x: infer I) => void ? I : never;
|
|
2
3
|
export interface ComponentDecorator {
|
|
3
4
|
(opts?: ComponentOptions): ClassDecorator;
|
|
4
5
|
}
|
|
@@ -151,7 +152,13 @@ export interface StateDecorator {
|
|
|
151
152
|
(): PropertyDecorator;
|
|
152
153
|
}
|
|
153
154
|
export interface WatchDecorator {
|
|
154
|
-
(propName:
|
|
155
|
+
(propName: any): CustomMethodDecorator<(newValue?: any, oldValue?: any, propName?: any, ...args: any[]) => any | void>;
|
|
156
|
+
}
|
|
157
|
+
export interface PropSerializeDecorator {
|
|
158
|
+
(propName: any): CustomMethodDecorator<(newValue?: any, propName?: string, ...args: any[]) => string | null>;
|
|
159
|
+
}
|
|
160
|
+
export interface AttrDeserializeDecorator {
|
|
161
|
+
(propName: any): CustomMethodDecorator<(newValue?: any, propName?: string, ...args: any[]) => any>;
|
|
155
162
|
}
|
|
156
163
|
export interface UserBuildConditionals {
|
|
157
164
|
isDev: boolean;
|
|
@@ -233,6 +240,14 @@ export declare const State: StateDecorator;
|
|
|
233
240
|
* https://stenciljs.com/docs/reactive-data#watch-decorator
|
|
234
241
|
*/
|
|
235
242
|
export declare const Watch: WatchDecorator;
|
|
243
|
+
/**
|
|
244
|
+
* Decorator to serialize a property to an attribute string.
|
|
245
|
+
*/
|
|
246
|
+
export declare const PropSerialize: PropSerializeDecorator;
|
|
247
|
+
/**
|
|
248
|
+
* Decorator to deserialize an attribute string to a property.
|
|
249
|
+
*/
|
|
250
|
+
export declare const AttrDeserialize: AttrDeserializeDecorator;
|
|
236
251
|
export type ResolutionHandler = (elm: HTMLElement) => string | undefined | null;
|
|
237
252
|
export type ErrorHandler = (err: any, element?: HTMLElement) => void;
|
|
238
253
|
/**
|
|
@@ -323,8 +338,9 @@ export declare function forceUpdate(ref: any): void;
|
|
|
323
338
|
* @returns the rendering ref
|
|
324
339
|
*/
|
|
325
340
|
export declare function getRenderingRef(): any;
|
|
326
|
-
export interface HTMLStencilElement extends HTMLElement {
|
|
341
|
+
export interface HTMLStencilElement extends Omit<HTMLElement, 'autocorrect'> {
|
|
327
342
|
componentOnReady(): Promise<this>;
|
|
343
|
+
autocorrect: 'on' | 'off';
|
|
328
344
|
}
|
|
329
345
|
/**
|
|
330
346
|
* Schedules a DOM-write task. The provided callback will be executed
|
|
@@ -349,6 +365,28 @@ export declare function readTask(task: RafCallback): void;
|
|
|
349
365
|
* Unhandled exception raised while rendering, during event handling, or lifecycles will trigger the custom event handler.
|
|
350
366
|
*/
|
|
351
367
|
export declare const setErrorHandler: (handler: ErrorHandler) => void;
|
|
368
|
+
export type MixinFactory = <TBase extends new (...args: any[]) => any>(base: TBase) => abstract new (...args: ConstructorParameters<TBase>) => any;
|
|
369
|
+
/**
|
|
370
|
+
* Compose multiple mixin classes into a single constructor.
|
|
371
|
+
* The resulting class has the combined instance types of all mixed-in classes.
|
|
372
|
+
*
|
|
373
|
+
* Example:
|
|
374
|
+
* ```
|
|
375
|
+
* import { Mixin, MixinFactory } from '@stencil/core';
|
|
376
|
+
*
|
|
377
|
+
* const AWrap: MixinFactory = (Base) => {class A extends Base { propA = A }; return A;}
|
|
378
|
+
* const BWrap: MixinFactory = (Base) => {class B extends Base { propB = B }; return B;}
|
|
379
|
+
* const CWrap: MixinFactory = (Base) => {class C extends Base { propC = C }; return C;}
|
|
380
|
+
*
|
|
381
|
+
* class X extends Mixin(AWrap, BWrap, CWrap) {
|
|
382
|
+
* render() { return <div>{this.propA} {this.propB} {this.propC}</div>; }
|
|
383
|
+
* }
|
|
384
|
+
* ```
|
|
385
|
+
*
|
|
386
|
+
* @param mixinFactories mixin factory functions that return a class which extends from the provided class.
|
|
387
|
+
* @returns a class that that is composed from extending each of the provided classes in the order they were provided.
|
|
388
|
+
*/
|
|
389
|
+
export declare function Mixin<TMixins extends readonly MixinFactory[]>(...mixinFactories: TMixins): abstract new (...args: any[]) => UnionToIntersection<InstanceType<ReturnType<TMixins[number]>>>;
|
|
352
390
|
/**
|
|
353
391
|
* This file gets copied to all distributions of stencil component collections.
|
|
354
392
|
* - no imports
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "llm-testrunner-components",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "A Stencil web component library
|
|
3
|
+
"version": "1.0.2",
|
|
4
|
+
"description": "A Stencil web component library for LLM test runner functionality",
|
|
5
5
|
"main": "dist/index.cjs.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
7
7
|
"types": "dist/types/index.d.ts",
|
|
@@ -9,18 +9,19 @@
|
|
|
9
9
|
"collection:main": "dist/collection/index.js",
|
|
10
10
|
"unpkg": "dist/llm-testrunner-components/llm-testrunner-components.esm.js",
|
|
11
11
|
"exports": {
|
|
12
|
-
"
|
|
13
|
-
"import": "./dist/
|
|
14
|
-
"require": "./dist/
|
|
15
|
-
|
|
16
|
-
"./my-component": {
|
|
17
|
-
"import": "./dist/components/my-component.js",
|
|
18
|
-
"types": "./dist/components/my-component.d.ts"
|
|
12
|
+
"./react": {
|
|
13
|
+
"import": "./dist/react/index.js",
|
|
14
|
+
"require": "./dist/react/index.js",
|
|
15
|
+
"types": "./dist/react/index.d.ts"
|
|
19
16
|
},
|
|
20
17
|
"./loader": {
|
|
21
18
|
"import": "./loader/index.js",
|
|
22
19
|
"require": "./loader/index.cjs",
|
|
23
20
|
"types": "./loader/index.d.ts"
|
|
21
|
+
},
|
|
22
|
+
"./dist/*": {
|
|
23
|
+
"import": "./dist/*",
|
|
24
|
+
"types": "./dist/*"
|
|
24
25
|
}
|
|
25
26
|
},
|
|
26
27
|
"repository": {
|
|
@@ -32,20 +33,40 @@
|
|
|
32
33
|
"loader/"
|
|
33
34
|
],
|
|
34
35
|
"scripts": {
|
|
35
|
-
"build": "stencil build",
|
|
36
|
+
"build": "stencil build && npm run build:react",
|
|
37
|
+
"build:react": "tsc --project tsconfig.react.json",
|
|
36
38
|
"start": "stencil build --dev --watch --serve",
|
|
37
39
|
"test": "stencil test --spec --e2e",
|
|
38
40
|
"test.watch": "stencil test --spec --e2e --watchAll",
|
|
39
|
-
"generate": "stencil generate"
|
|
41
|
+
"generate": "stencil generate",
|
|
42
|
+
"publish": "npm publish",
|
|
43
|
+
"publish:public": "npm publish --access=public"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@types/uuid": "^10.0.0",
|
|
47
|
+
"uuid": "^10.0.0"
|
|
40
48
|
},
|
|
41
49
|
"devDependencies": {
|
|
42
50
|
"@stencil/core": "^4.27.1",
|
|
51
|
+
"@stencil/react-output-target": "^1.2.0",
|
|
43
52
|
"@types/jest": "^29.5.14",
|
|
44
53
|
"@types/node": "^22.13.5",
|
|
45
54
|
"jest": "^29.7.0",
|
|
46
55
|
"jest-cli": "^29.7.0",
|
|
47
56
|
"puppeteer": "^24.3.0"
|
|
48
57
|
},
|
|
58
|
+
"peerDependencies": {
|
|
59
|
+
"react": ">=16.8.0",
|
|
60
|
+
"react-dom": ">=16.8.0"
|
|
61
|
+
},
|
|
62
|
+
"peerDependenciesMeta": {
|
|
63
|
+
"react": {
|
|
64
|
+
"optional": true
|
|
65
|
+
},
|
|
66
|
+
"react-dom": {
|
|
67
|
+
"optional": true
|
|
68
|
+
}
|
|
69
|
+
},
|
|
49
70
|
"license": "MIT",
|
|
50
71
|
"keywords": [
|
|
51
72
|
"web-components",
|
|
@@ -53,4 +74,4 @@
|
|
|
53
74
|
"react",
|
|
54
75
|
"typescript"
|
|
55
76
|
]
|
|
56
|
-
}
|
|
77
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"current-time.my-component.entry.cjs.js","sources":["src/components/my-component/current-time.tsx","src/components/my-component/my-component.css?tag=my-component&encapsulation=shadow","src/components/my-component/my-component.tsx"],"sourcesContent":["// First, we import State from '@stencil/core'\nimport { Component, State, h } from '@stencil/core';\n\n@Component({\n tag: 'current-time',\n})\nexport class CurrentTime {\n // `timer` is not decorated with `@State()`, as\n // we do not wish to trigger a rerender when its\n // value changes\n timer: number;\n\n // `currentTime` is decorated with `@State()`,\n // as we need to trigger a rerender when its\n // value changes to show the latest time\n @State() currentTime: number = Date.now();\n\n connectedCallback() {\n // the assignment to `this.timer` will not\n // trigger a re-render\n this.timer = window.setInterval(() => {\n // the assignment to `this.currentTime`\n // will trigger a re-render\n this.currentTime = Date.now();\n }, 1000);\n }\n\n disconnectedCallback() {\n window.clearInterval(this.timer);\n }\n\n render() {\n const time = new Date(this.currentTime).toLocaleTimeString();\n\n return (\n <span>{time}</span>\n );\n }\n}",":host {\n display: block;\n}\n","import { Component, Prop, h } from '@stencil/core';\nimport { format } from '../../utils/utils';\n\n@Component({\n tag: 'my-component',\n styleUrl: 'my-component.css',\n shadow: true,\n})\nexport class MyComponent {\n /**\n * The first name\n */\n @Prop() first: string;\n\n /**\n * The middle name\n */\n @Prop() middle: string;\n\n /**\n * The last name\n */\n @Prop() last: string;\n\n private getText(): string {\n return format(this.first, this.middle, this.last);\n }\n\n render() {\n return (\n <div>\n Hello, World! I'm {this.getText()} <br />\n Current time: <current-time />\n </div>\n );\n }\n}\n"],"names":["h","format"],"mappings":";;;;;MAMa,WAAW,GAAA,MAAA;;;;;;;AAIpB,IAAA,KAAK;;;;AAKI,IAAA,WAAW,GAAW,IAAI,CAAC,GAAG,EAAE;IAEzC,iBAAiB,GAAA;;;QAGb,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC,MAAK;;;AAGjC,YAAA,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE;SAChC,EAAE,IAAI,CAAC;;IAGZ,oBAAoB,GAAA;AAChB,QAAA,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC;;IAGpC,MAAM,GAAA;AACF,QAAA,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,kBAAkB,EAAE;AAE5D,QAAA,QACIA,OAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,EAAO,IAAI,CAAQ;;;;ACnC/B,MAAM,cAAc,GAAG,sBAAsB;;MCQhC,WAAW,GAAA,MAAA;;;;AACtB;;AAEG;AACK,IAAA,KAAK;AAEb;;AAEG;AACK,IAAA,MAAM;AAEd;;AAEG;AACK,IAAA,IAAI;IAEJ,OAAO,GAAA;AACb,QAAA,OAAOC,cAAM,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC;;IAGnD,MAAM,GAAA;QACJ,QACED,OAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,wBACqB,IAAI,CAAC,OAAO,EAAE,OAAEA,OAAM,CAAA,IAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,CAAA,oBAC3BA,OAAgB,CAAA,cAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,CAAA,CAC1B;;;;;;;;"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var index = require('./index-CCrH7f-W.js');
|
|
4
|
-
var index$1 = require('./index.cjs.js');
|
|
5
|
-
|
|
6
|
-
const CurrentTime = class {
|
|
7
|
-
constructor(hostRef) {
|
|
8
|
-
index.registerInstance(this, hostRef);
|
|
9
|
-
}
|
|
10
|
-
// `timer` is not decorated with `@State()`, as
|
|
11
|
-
// we do not wish to trigger a rerender when its
|
|
12
|
-
// value changes
|
|
13
|
-
timer;
|
|
14
|
-
// `currentTime` is decorated with `@State()`,
|
|
15
|
-
// as we need to trigger a rerender when its
|
|
16
|
-
// value changes to show the latest time
|
|
17
|
-
currentTime = Date.now();
|
|
18
|
-
connectedCallback() {
|
|
19
|
-
// the assignment to `this.timer` will not
|
|
20
|
-
// trigger a re-render
|
|
21
|
-
this.timer = window.setInterval(() => {
|
|
22
|
-
// the assignment to `this.currentTime`
|
|
23
|
-
// will trigger a re-render
|
|
24
|
-
this.currentTime = Date.now();
|
|
25
|
-
}, 1000);
|
|
26
|
-
}
|
|
27
|
-
disconnectedCallback() {
|
|
28
|
-
window.clearInterval(this.timer);
|
|
29
|
-
}
|
|
30
|
-
render() {
|
|
31
|
-
const time = new Date(this.currentTime).toLocaleTimeString();
|
|
32
|
-
return (index.h("span", { key: '45b0df3ce3817ac64d22582b1a45c188b61656a4' }, time));
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const myComponentCss = ":host{display:block}";
|
|
37
|
-
|
|
38
|
-
const MyComponent = class {
|
|
39
|
-
constructor(hostRef) {
|
|
40
|
-
index.registerInstance(this, hostRef);
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* The first name
|
|
44
|
-
*/
|
|
45
|
-
first;
|
|
46
|
-
/**
|
|
47
|
-
* The middle name
|
|
48
|
-
*/
|
|
49
|
-
middle;
|
|
50
|
-
/**
|
|
51
|
-
* The last name
|
|
52
|
-
*/
|
|
53
|
-
last;
|
|
54
|
-
getText() {
|
|
55
|
-
return index$1.format(this.first, this.middle, this.last);
|
|
56
|
-
}
|
|
57
|
-
render() {
|
|
58
|
-
return (index.h("div", { key: '538552b1fa1db142ea88eb71047cd1da9fbfb224' }, "Hello, World! I'm ", this.getText(), " ", index.h("br", { key: 'f27acd01ea5f08223805a7f79b0763d45a2e70bf' }), "Current time: ", index.h("current-time", { key: '615f447c114321de1a748703672a3cf9217df591' })));
|
|
59
|
-
}
|
|
60
|
-
};
|
|
61
|
-
MyComponent.style = myComponentCss;
|
|
62
|
-
|
|
63
|
-
exports.current_time = CurrentTime;
|
|
64
|
-
exports.my_component = MyComponent;
|
|
65
|
-
//# sourceMappingURL=current-time.my-component.entry.cjs.js.map
|
|
66
|
-
|
|
67
|
-
//# sourceMappingURL=current-time_2.cjs.entry.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"file":"current-time.my-component.entry.cjs.js","mappings":";;;;;MAMa,WAAW,GAAA,MAAA;;;;;;;AAIpB,IAAA,KAAK;;;;AAKI,IAAA,WAAW,GAAW,IAAI,CAAC,GAAG,EAAE;IAEzC,iBAAiB,GAAA;;;QAGb,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC,MAAK;;;AAGjC,YAAA,IAAI,CAAC,WAAW,GAAG,IAAI,CAAC,GAAG,EAAE;SAChC,EAAE,IAAI,CAAC;;IAGZ,oBAAoB,GAAA;AAChB,QAAA,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,KAAK,CAAC;;IAGpC,MAAM,GAAA;AACF,QAAA,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,kBAAkB,EAAE;AAE5D,QAAA,QACIA,OAAA,CAAA,MAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,EAAO,IAAI,CAAQ;;;;ACnC/B,MAAM,cAAc,GAAG,sBAAsB;;MCQhC,WAAW,GAAA,MAAA;;;;AACtB;;AAEG;AACK,IAAA,KAAK;AAEb;;AAEG;AACK,IAAA,MAAM;AAEd;;AAEG;AACK,IAAA,IAAI;IAEJ,OAAO,GAAA;AACb,QAAA,OAAOC,cAAM,CAAC,IAAI,CAAC,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC;;IAGnD,MAAM,GAAA;QACJ,QACED,OAAA,CAAA,KAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,wBACqB,IAAI,CAAC,OAAO,EAAE,OAAEA,OAAM,CAAA,IAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,CAAA,oBAC3BA,OAAgB,CAAA,cAAA,EAAA,EAAA,GAAA,EAAA,0CAAA,EAAA,CAAA,CAC1B;;;;;;;;","names":["h","format"],"sources":["src/components/my-component/current-time.tsx","src/components/my-component/my-component.css?tag=my-component&encapsulation=shadow","src/components/my-component/my-component.tsx"],"sourcesContent":["// First, we import State from '@stencil/core'\nimport { Component, State, h } from '@stencil/core';\n\n@Component({\n tag: 'current-time',\n})\nexport class CurrentTime {\n // `timer` is not decorated with `@State()`, as\n // we do not wish to trigger a rerender when its\n // value changes\n timer: number;\n\n // `currentTime` is decorated with `@State()`,\n // as we need to trigger a rerender when its\n // value changes to show the latest time\n @State() currentTime: number = Date.now();\n\n connectedCallback() {\n // the assignment to `this.timer` will not\n // trigger a re-render\n this.timer = window.setInterval(() => {\n // the assignment to `this.currentTime`\n // will trigger a re-render\n this.currentTime = Date.now();\n }, 1000);\n }\n\n disconnectedCallback() {\n window.clearInterval(this.timer);\n }\n\n render() {\n const time = new Date(this.currentTime).toLocaleTimeString();\n\n return (\n <span>{time}</span>\n );\n }\n}",":host {\n display: block;\n}\n","import { Component, Prop, h } from '@stencil/core';\nimport { format } from '../../utils/utils';\n\n@Component({\n tag: 'my-component',\n styleUrl: 'my-component.css',\n shadow: true,\n})\nexport class MyComponent {\n /**\n * The first name\n */\n @Prop() first: string;\n\n /**\n * The middle name\n */\n @Prop() middle: string;\n\n /**\n * The last name\n */\n @Prop() last: string;\n\n private getText(): string {\n return format(this.first, this.middle, this.last);\n }\n\n render() {\n return (\n <div>\n Hello, World! I'm {this.getText()} <br />\n Current time: <current-time />\n </div>\n );\n }\n}\n"],"version":3}
|