@api-viewer/demo
Advanced tools
Comparing version 1.0.0-pre.1 to 1.0.0-pre.2
@@ -279,3 +279,3 @@ { | ||
"type": { | ||
"text": "Knob<ClassField>[]" | ||
"text": "PropertyKnob[]" | ||
} | ||
@@ -294,3 +294,3 @@ }, | ||
"type": { | ||
"text": "Knob<ClassField>[]" | ||
"text": "PropertyKnob[]" | ||
} | ||
@@ -436,3 +436,3 @@ }, | ||
"type": { | ||
"text": "{\n knob: Knob<ClassField>;\n custom?: boolean;\n }" | ||
"text": "{\n knob: PropertyKnob;\n custom?: boolean;\n }" | ||
} | ||
@@ -507,3 +507,3 @@ }, | ||
"type": { | ||
"text": "Knob<ClassField>" | ||
"text": "PropertyKnob" | ||
} | ||
@@ -633,4 +633,10 @@ } | ||
] | ||
}, | ||
{ | ||
"kind": "javascript-module", | ||
"path": "src/types.ts", | ||
"declarations": [], | ||
"exports": [] | ||
} | ||
] | ||
} |
@@ -14,2 +14,3 @@ export class AbstractController { | ||
} | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
updateData(_data) { | ||
@@ -16,0 +17,0 @@ if (this.host.isConnected) { |
import { Event } from '@api-viewer/common/lib/manifest.js'; | ||
import { AbstractController, AbstractControllerHost } from './abstract-controller.js'; | ||
import { HasKnobs } from '../ui/knobs.js'; | ||
import { HasKnobs } from '../types.js'; | ||
export declare class EventsController extends AbstractController<CustomEvent> { | ||
@@ -5,0 +5,0 @@ constructor(host: AbstractControllerHost & HasKnobs, component: HTMLElement, events: Event[]); |
@@ -1,3 +0,4 @@ | ||
import { Slot, SlotValue } from '@api-viewer/common/lib/index.js'; | ||
import { Slot } from '@api-viewer/common/lib/index.js'; | ||
import { AbstractController, AbstractControllerHost } from './abstract-controller.js'; | ||
import { SlotValue } from '../types.js'; | ||
export declare class SlotsController extends AbstractController<SlotValue> { | ||
@@ -4,0 +5,0 @@ enabled: boolean; |
import { hasTemplate, TemplateTypes } from '@api-viewer/common/lib/templates.js'; | ||
import { AbstractController } from './abstract-controller.js'; | ||
const capitalize = (name) => name[0].toUpperCase() + name.slice(1); | ||
const getSlotContent = (name) => capitalize(name === '' ? 'content' : name); | ||
import { formatSlot } from '../ui/controls.js'; | ||
export class SlotsController extends AbstractController { | ||
@@ -22,3 +21,3 @@ constructor(host, component, id, slots) { | ||
...slot, | ||
content: getSlotContent(slot.name) | ||
content: formatSlot(slot.name) | ||
}; | ||
@@ -25,0 +24,0 @@ }); |
@@ -1,3 +0,4 @@ | ||
import { CssCustomProperty, CssCustomPropertyValue } from '@api-viewer/common/lib/index.js'; | ||
import { CssCustomProperty } from '@api-viewer/common/lib/index.js'; | ||
import { AbstractController, AbstractControllerHost } from './abstract-controller.js'; | ||
import { CssCustomPropertyValue } from '../types.js'; | ||
export declare class StylesController extends AbstractController<CssCustomPropertyValue> { | ||
@@ -4,0 +5,0 @@ constructor(host: AbstractControllerHost, component: HTMLElement, cssProps: CssCustomProperty[]); |
import { LitElement, PropertyValues, TemplateResult } from 'lit'; | ||
import { ClassField, CssCustomProperty, Event, Slot } from '@api-viewer/common/lib/index.js'; | ||
import '@api-viewer/tabs'; | ||
import { Knob } from './ui/knobs.js'; | ||
import { Knob, PropertyKnob } from './types.js'; | ||
declare class ApiDemoLayout extends LitElement { | ||
@@ -14,5 +14,5 @@ copyBtnText: string; | ||
vid?: number; | ||
customKnobs: Knob<ClassField>[]; | ||
customKnobs: PropertyKnob[]; | ||
knobs: Record<string, Knob>; | ||
propKnobs: Knob<ClassField>[]; | ||
propKnobs: PropertyKnob[]; | ||
private _whenDefined; | ||
@@ -34,7 +34,7 @@ private eventsController; | ||
getKnob(name: string): { | ||
knob: Knob<ClassField>; | ||
knob: PropertyKnob; | ||
custom?: boolean; | ||
}; | ||
private setKnobs; | ||
syncKnob(component: Element, changed: Knob<ClassField>): void; | ||
syncKnob(component: Element, changed: PropertyKnob): void; | ||
private _onCssChanged; | ||
@@ -41,0 +41,0 @@ private _onPropChanged; |
import { TemplateResult } from 'lit'; | ||
import { Knobable } from './knobs.js'; | ||
import { Knobable } from '../types.js'; | ||
declare type InputRenderer = (item: Knobable, id: string) => TemplateResult; | ||
export declare const formatSlot: (name: string) => string; | ||
export declare const cssPropRenderer: InputRenderer; | ||
@@ -5,0 +6,0 @@ export declare const propRenderer: InputRenderer; |
import { html } from 'lit'; | ||
const capitalize = (name) => name[0].toUpperCase() + name.slice(1); | ||
export const formatSlot = (name) => capitalize(name === '' ? 'content' : name); | ||
export const cssPropRenderer = (knob, id) => { | ||
@@ -65,5 +67,5 @@ const { name, value } = knob; | ||
const rows = items.map((item) => { | ||
const { name, content } = item; | ||
const { name } = item; | ||
const id = `${type}-${name || 'default'}`; | ||
const label = type === 'slot' ? content : name; | ||
const label = type === 'slot' ? formatSlot(name) : name; | ||
return html ` | ||
@@ -70,0 +72,0 @@ <tr> |
@@ -1,25 +0,6 @@ | ||
import { ClassField, CssCustomProperty, SlotValue } from '@api-viewer/common/lib/index.js'; | ||
export declare type KnobValue = string | number | boolean | null | undefined; | ||
export declare type ComponentWithProps = { | ||
[key: string]: KnobValue; | ||
}; | ||
export declare type Knobable = unknown | (CssCustomProperty | ClassField | SlotValue); | ||
export declare type Knob<T extends Knobable = unknown> = T & { | ||
attribute: string | undefined; | ||
value: KnobValue; | ||
custom?: boolean; | ||
options?: string[]; | ||
knobType: string; | ||
content?: string; | ||
}; | ||
export interface HasKnobs { | ||
getKnob(name: string): { | ||
knob: Knob<ClassField>; | ||
custom?: boolean; | ||
}; | ||
syncKnob(component: Element, changed: Knob<ClassField>): void; | ||
} | ||
export declare const getKnobs: (tag: string, props: ClassField[], exclude?: string) => Knob<ClassField>[]; | ||
export declare const getCustomKnobs: (tag: string, vid?: number | undefined) => Knob<ClassField>[]; | ||
export declare const getInitialKnobs: (propKnobs: Knob<ClassField>[], component: HTMLElement) => Knob<ClassField>[]; | ||
import { ClassField } from '@api-viewer/common/lib/index.js'; | ||
import { PropertyKnob } from '../types.js'; | ||
export declare const getKnobs: (tag: string, props: ClassField[], exclude?: string) => PropertyKnob[]; | ||
export declare const getCustomKnobs: (tag: string, vid?: number | undefined) => PropertyKnob[]; | ||
export declare const getInitialKnobs: (propKnobs: PropertyKnob[], component: HTMLElement) => PropertyKnob[]; | ||
//# sourceMappingURL=knobs.d.ts.map |
import { ChildPart, noChange, nothing, TemplateResult } from 'lit'; | ||
import { Directive, PartInfo } from 'lit/directive.js'; | ||
import { Knob } from './knobs.js'; | ||
import { Knob } from '../types.js'; | ||
export declare type ComponentRendererOptions = { | ||
@@ -5,0 +5,0 @@ id: number; |
import { TemplateResult } from 'lit'; | ||
import { CssCustomPropertyValue, SlotValue } from '@api-viewer/common/lib/index.js'; | ||
import { Knob } from './knobs.js'; | ||
import { CssCustomPropertyValue, Knob, SlotValue } from '../types.js'; | ||
export declare const renderSnippet: (id: number, tag: string, values: Record<string, Knob>, slots: SlotValue[], cssProps: CssCustomPropertyValue[]) => TemplateResult; | ||
//# sourceMappingURL=snippet.d.ts.map |
{ | ||
"name": "@api-viewer/demo", | ||
"version": "1.0.0-pre.1", | ||
"version": "1.0.0-pre.2", | ||
"publishConfig": { | ||
@@ -35,4 +35,4 @@ "access": "public" | ||
"dependencies": { | ||
"@api-viewer/common": "^1.0.0-pre.1", | ||
"@api-viewer/tabs": "^1.0.0-pre.1", | ||
"@api-viewer/common": "^1.0.0-pre.2", | ||
"@api-viewer/tabs": "^1.0.0-pre.2", | ||
"highlight-ts": "9.12.1-2", | ||
@@ -39,0 +39,0 @@ "lit": "^2.0.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
146004
63
2001