Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Webcomponents #2

Merged
merged 5 commits into from
Oct 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .storybook/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ module.exports = {
"@storybook/addon-storyshots",
],
framework: "@storybook/react",
staticDirs: ["../src/stories/assets"],
staticDirs: ["../src/stories/assets", "../src/webaudio-controls/images"],
};
24 changes: 24 additions & 0 deletions src/Knob.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React, { FC, DOMAttributes } from "react";
import { WebAudioKnob } from "./webaudio-controls/webaudio-knob";
console.log("WebAudioKnob", WebAudioKnob);
import "./webaudio-controls/webaudio-knob.js";
import { KnobProps } from "./Knob.types";

export type CustomEvents<K extends string> = {
[key in K]: (event: CustomEvent) => void;
};
export type CustomElement<T, K extends string = ""> = Partial<
T & DOMAttributes<T> & { children: any } & CustomEvents<`on${K}`>
>;

declare global {
namespace JSX {
interface IntrinsicElements {
["webaudio-knob"]: CustomElement<WebAudioKnob>;
}
}
}

export const Knob: FC<KnobProps> = (props) => {
return <webaudio-knob {...props}></webaudio-knob>;
};
12 changes: 12 additions & 0 deletions src/Knob.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
export interface KnobProps {
src?: string;
sprites?: number;
value?: number;
knobColors?: string; //example: "#e00;#000;#fff"
knobWidth?: number;
knobHeight?: number;
knobDiameter?: number;
outline?: number;
valueTip?: string;
midilearn?: boolean;
}
8 changes: 8 additions & 0 deletions src/stories/Knob.stories.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { Meta } from "@storybook/addon-docs";

<Meta title="UI/Knob/Docs" />

# webaudio-controls

- [webaudio-controls](https://g200kg.github.io/webaudio-controls/docs/)
- Check out WebKnobMan at [g200kg KnobGallery](https://www.g200kg.com/en/webknobman/gallery.php)
55 changes: 55 additions & 0 deletions src/stories/Knob.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import React from "react";
import { ComponentMeta, ComponentStory } from "@storybook/react";
import { Knob } from "../Knob";

export default {
title: "UI/Knob",
component: Knob,
} as ComponentMeta<typeof Knob>;

export const Gallery = () => {
return (
<>
<Knob></Knob>
<Knob src={"./knobs/lineshadow.png"}></Knob>
<Knob src={"./knobs/Aqua.png"}></Knob>
<Knob src={"./knobs/Carbon.png"}></Knob>
<Knob src={"./knobs/Chromed.png"}></Knob>
<Knob src={"./knobs/Jambalaya.png"}></Knob>
<Knob src={"./knobs/JP8000.png"}></Knob>
<Knob src={"./knobs/lineshadow2.png"}></Knob>
<Knob src={"./knobs/LittlePhatty.png"}></Knob>
<Knob src={"./knobs/m400.png"}></Knob>
<Knob src={"./knobs/MiniMoog_Main.png"}></Knob>
<Knob src={"./knobs/nice_lamp_knob.png"}></Knob>
<Knob src={"./knobs/plastic_knob.png"}></Knob>
<Knob src={"./knobs/SimpleFlat3.png"}></Knob>
<Knob src={"./knobs/simplegray.png"}></Knob>
<Knob src={"./knobs/vernier.png"}></Knob>
<Knob src={"./knobs/Vintage_Knob.png"}></Knob>
<Knob
src={"./knobs/WOK_vintage_AbbeyRoad_PAN_Knob.png"}
sprites={127}
value={50}
></Knob>
<Knob src={"./knobs/yellow.png"} sprites={127}></Knob>
</>
);
};

const Template: ComponentStory<typeof Knob> = (args) => <Knob {...args} />;

export const Default = Template.bind({});

Default.args = {
src: "",
sprites: 100,
value: 0,
/* knobColors: "#000;#fff;#e00;",
knobWidth: 100,
knobHeight: 100,
knobDiameter: 100,
outline: 0,
valueTip: "info here",
midilearn: false,*/
};
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/webaudio-controls/images/img/bg.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/webaudio-controls/images/img/defknob2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/webaudio-controls/images/img/demo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/webaudio-controls/images/img/hsliderbody.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/webaudio-controls/images/img/hsliderknob.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/webaudio-controls/images/img/hsw5.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/webaudio-controls/images/img/midilearn.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/webaudio-controls/images/img/sample3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/webaudio-controls/images/img/testknob.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/webaudio-controls/images/img/vsliderbody.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/webaudio-controls/images/img/vsliderknob.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/webaudio-controls/images/knobs/Aqua.knob
Binary file not shown.
Binary file added src/webaudio-controls/images/knobs/Aqua.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/webaudio-controls/images/knobs/Carbon.knob
Binary file not shown.
Binary file added src/webaudio-controls/images/knobs/Carbon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/webaudio-controls/images/knobs/Chromed.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/webaudio-controls/images/knobs/JP8000.knob
Binary file not shown.
Binary file added src/webaudio-controls/images/knobs/JP8000.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/webaudio-controls/images/knobs/Jambalaya.knob
Binary file not shown.
Binary file added src/webaudio-controls/images/knobs/Jambalaya.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/webaudio-controls/images/knobs/controls.skin
Binary file not shown.
Binary file added src/webaudio-controls/images/knobs/hsw5.png
Binary file not shown.
Binary file not shown.
Binary file added src/webaudio-controls/images/knobs/m400.knob
Binary file not shown.
Binary file added src/webaudio-controls/images/knobs/m400.png
Binary file not shown.
Binary file not shown.
Binary file added src/webaudio-controls/images/knobs/vernier.knob
Binary file not shown.
Binary file added src/webaudio-controls/images/knobs/vernier.png
Binary file added src/webaudio-controls/images/knobs/yellow.png
Loading