From 36d17de4cd2f1af896d1156fc2f65aaad4c5ca6e Mon Sep 17 00:00:00 2001 From: Stephen Belovarich Date: Fri, 3 Jan 2025 18:43:10 -0800 Subject: [PATCH] release: 3.1.2 --- CHANGELOG.md | 6 ++++++ README.md | 2 +- cypress/integration/unit/core/attach.ts | 12 ++++++------ src/client/app/component/list.ts | 8 ++++---- src/client/app/view/lib/lib.ts | 2 +- src/client/index.ts | 2 +- src/modules/core/decorator/index.ts | 17 ++++++++++------- src/modules/core/package.json | 4 ++-- src/modules/dom/package.json | 4 ++-- src/modules/router/package.json | 4 ++-- src/modules/transmit/index.ts | 8 ++++---- src/modules/transmit/package.json | 4 ++-- src/modules/ui/component/input/button.ts | 1 + src/modules/ui/component/input/radio.ts | 2 +- src/modules/ui/package.json | 4 ++-- vite-env.d.ts | 9 +++++++++ 16 files changed, 54 insertions(+), 35 deletions(-) create mode 100644 vite-env.d.ts diff --git a/CHANGELOG.md b/CHANGELOG.md index 0b787d5f..cfda2329 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,11 @@ # CHANGELOG +### 3.1.2 + +- fix: `RdSlider` should initialize with the correct position when using a control +- fix: control types were not properly exported, prohibiting their use in third-party projects +- fix: various TypeScript issues, mostly internal + ### 3.1.1 - fix: `RdDial` and `RdSlider` handles could appear with incorrect position diff --git a/README.md b/README.md index 7cf39702..9b42002d 100644 --- a/README.md +++ b/README.md @@ -62,4 +62,4 @@ Use `yarn test:open` to open a GUI and run tests interactively. ### Production -To build the library for production, i.e. to use as a local dependency in another project run `yarn build:lib`. +To build the library for production, i.e. to use as a local dependency in another project run `yarn build:library`. diff --git a/cypress/integration/unit/core/attach.ts b/cypress/integration/unit/core/attach.ts index dd3bebbb..0036b568 100644 --- a/cypress/integration/unit/core/attach.ts +++ b/cypress/integration/unit/core/attach.ts @@ -2,7 +2,7 @@ import { attachShadow, attachDOM, - attachStyle + attachStyle, } from '../../../../src/modules/core/element/src/attach'; import { ElementMeta } from './../../../../src/modules/core/decorator'; @@ -23,7 +23,7 @@ describe('attachShadow Test', () => { `; element.elementMeta = { selector: 'x-test', - mode: 'open' + mode: 'open', }; }); @@ -35,7 +35,7 @@ describe('attachShadow Test', () => { it('has a shadow dom template', () => { attachShadow(element, { mode: element.elementMeta.mode }); expect(element.shadowRoot.querySelector('div').innerText).equals( - 'Readymade Test' + 'Readymade Test', ); }); }); @@ -48,7 +48,7 @@ describe('attachDOM Test', () => { selector: 'x-test', template: `
Readymade Test
- ` + `, }; }); @@ -75,13 +75,13 @@ describe('attachStyle Test', () => { :host { background: #ff0000; } - ` + `, }; }); xit('head contains style tag with injected styles', () => { attachShadow(element, { mode: 'open' }); - attachStyle(element, { mode: 'open' }); + attachStyle(element); const style: HTMLElement = document .querySelector('head') .querySelector('[id="x-test-x"]'); diff --git a/src/client/app/component/list.ts b/src/client/app/component/list.ts index d415d60c..c2e14d4a 100644 --- a/src/client/app/component/list.ts +++ b/src/client/app/component/list.ts @@ -48,12 +48,12 @@ class MyListComponent extends CustomElement { } else { this.deactivateElement(li); } - li.addEventListener('click', (clickEv: MouseEvent) => { + li.addEventListener('click', () => { getSiblings(li).forEach((elem: Element) => { this.deactivateElement(elem); }); this.activateElement(li); - this.onSubmit(clickEv); + this.onSubmit(); }); } } @@ -65,7 +65,7 @@ class MyListComponent extends CustomElement { const siblings = getSiblings(currentElement); this.currentIndex = getElementIndex(currentElement); if (ev.keyCode === 13) { - this.onSubmit(ev); + this.onSubmit(); } if (ev.keyCode === 38) { // up @@ -99,7 +99,7 @@ class MyListComponent extends CustomElement { } } public onSubmit() { - // console.log(this, event); + // noop? } } diff --git a/src/client/app/view/lib/lib.ts b/src/client/app/view/lib/lib.ts index 9e968d00..ee6403da 100644 --- a/src/client/app/view/lib/lib.ts +++ b/src/client/app/view/lib/lib.ts @@ -70,7 +70,7 @@ class LibraryComponent extends CustomElement { const controlElement = surface.querySelector( `[name="${control.name}"]`, ); - controlElement.value = control.currentValue; + (controlElement as any).value = control.currentValue; } }; diff --git a/src/client/index.ts b/src/client/index.ts index b046f2e1..fef9c02a 100644 --- a/src/client/index.ts +++ b/src/client/index.ts @@ -1,6 +1,6 @@ import { Router, routing } from './app/routing'; -if (import.meta.env.DEV) { +if (((import.meta) as any).env.DEV) { window['clientRouter'] = new Router('#root', routing, true); } diff --git a/src/modules/core/decorator/index.ts b/src/modules/core/decorator/index.ts index 178c1eaf..3b9dd7ae 100644 --- a/src/modules/core/decorator/index.ts +++ b/src/modules/core/decorator/index.ts @@ -100,14 +100,17 @@ export function Emitter( options?: any, channelName?: string, ) { - return function decorator(target: any) { + return function decorator( + target: any, + propertyKey: string | symbol, + descriptor: PropertyDescriptor, + ) { const channel = channelName ? channelName : 'default'; - let prop: string = ''; if (eventName) { - prop = EMIT_KEY + channel + eventName; + propertyKey = EMIT_KEY + channel + eventName; } else { - prop = EMIT_KEY + channel; + propertyKey = EMIT_KEY + channel; } function addEvent(name?: string, chan?: string) { @@ -130,9 +133,9 @@ export function Emitter( } } - if (!target[prop]) { - target[prop] = function () { - addEvent.call(this, eventName, channelName); + if (!target[propertyKey]) { + target[propertyKey] = function () { + addEvent.call(this, eventName, channelName, descriptor); }; } diff --git a/src/modules/core/package.json b/src/modules/core/package.json index 2e4efb8b..761cf01c 100644 --- a/src/modules/core/package.json +++ b/src/modules/core/package.json @@ -1,6 +1,6 @@ { "name": "@readymade/core", - "version": "3.1.1", + "version": "3.1.2", "description": "JavaScript microlibrary for developing Web Components with TypeScript and Decorators", "type": "module", "module": "./fesm2022/index.js", @@ -36,4 +36,4 @@ "url": "https://github.com/readymade-ui/readymade/issues" }, "homepage": "https://github.com/readymade-ui/readymade#readme" -} +} \ No newline at end of file diff --git a/src/modules/dom/package.json b/src/modules/dom/package.json index 7fcdcc3e..1db1f0a2 100644 --- a/src/modules/dom/package.json +++ b/src/modules/dom/package.json @@ -1,6 +1,6 @@ { "name": "@readymade/dom", - "version": "3.1.1", + "version": "3.1.2", "description": "JavaScript microlibrary for developing Web Components with TypeScript and Decorators", "type": "module", "module": "./fesm2022/index.js", @@ -36,4 +36,4 @@ "url": "https://github.com/readymade-ui/readymade/issues" }, "homepage": "https://github.com/readymade-ui/readymade#readme" -} +} \ No newline at end of file diff --git a/src/modules/router/package.json b/src/modules/router/package.json index 40bef280..8cfd06e6 100644 --- a/src/modules/router/package.json +++ b/src/modules/router/package.json @@ -1,6 +1,6 @@ { "name": "@readymade/router", - "version": "3.1.1", + "version": "3.1.2", "description": "JavaScript microlibrary for developing Web Components with TypeScript and Decorators", "type": "module", "module": "./fesm2022/index.js", @@ -36,4 +36,4 @@ "url": "https://github.com/readymade-ui/readymade/issues" }, "homepage": "https://github.com/readymade-ui/readymade#readme" -} +} \ No newline at end of file diff --git a/src/modules/transmit/index.ts b/src/modules/transmit/index.ts index ff764e39..576956b2 100644 --- a/src/modules/transmit/index.ts +++ b/src/modules/transmit/index.ts @@ -103,6 +103,7 @@ export class Transmitter { public debug: boolean = true; public rtcConfiguration: RTCConfiguration; public config: TransmitterConfiguration; + public channel: RTCDataChannel; public store: { messages: Array; }; @@ -120,15 +121,14 @@ export class Transmitter { this.remotePeerId = null; this.store = { messages: [] }; this.rtcConfiguration = config.rtcConfig - ? config.rtc - : { + ? config.rtcConfig + : ({ iceServers: [ { - url: 'stun:stun.l.google.com:19302', urls: ['stun:stun.l.google.com:19302'], }, ], - }; + } as RTCConfiguration); this.dataChannelConfig = { ordered: false, maxPacketLifeTime: 1000, diff --git a/src/modules/transmit/package.json b/src/modules/transmit/package.json index 84d63c57..fbfa9baa 100644 --- a/src/modules/transmit/package.json +++ b/src/modules/transmit/package.json @@ -1,6 +1,6 @@ { "name": "@readymade/transmit", - "version": "3.1.1", + "version": "3.1.2", "description": "Swiss-army knife for communicating over WebRTC DataChannel, WebSocket or Touch OSC", "type": "module", "module": "./fesm2022/index.js", @@ -37,4 +37,4 @@ "url": "https://github.com/readymade-ui/readymade/issues" }, "homepage": "https://github.com/readymade-ui/readymade#readme" -} +} \ No newline at end of file diff --git a/src/modules/ui/component/input/button.ts b/src/modules/ui/component/input/button.ts index f188af3f..51ae6382 100644 --- a/src/modules/ui/component/input/button.ts +++ b/src/modules/ui/component/input/button.ts @@ -6,6 +6,7 @@ export interface RdButtonAttributes { label?: string; width?: string; height?: string; + style?: Partial; } @Component({ diff --git a/src/modules/ui/component/input/radio.ts b/src/modules/ui/component/input/radio.ts index 673d566d..7c7b55c9 100644 --- a/src/modules/ui/component/input/radio.ts +++ b/src/modules/ui/component/input/radio.ts @@ -251,7 +251,7 @@ class RdRadioGroup extends FormElement { const input = document.createElement('input'); const label = document.createElement('label'); input.setAttribute('type', 'radio'); - input.setAttribute('name', control.attributes.inputs[i].name); + input.setAttribute('name', control.attributes.inputs[i].label); input.setAttribute('value', control.attributes.inputs[i].value); label.setAttribute('for', control.attributes.inputs[i].value); label.textContent = control.attributes.inputs[i].label; diff --git a/src/modules/ui/package.json b/src/modules/ui/package.json index a05fe082..85d72f06 100644 --- a/src/modules/ui/package.json +++ b/src/modules/ui/package.json @@ -1,6 +1,6 @@ { "name": "@readymade/ui", - "version": "3.1.1", + "version": "3.1.2", "description": "UI library of standard elements built with Readymade", "type": "module", "module": "./fesm2022/index.js", @@ -36,4 +36,4 @@ "url": "https://github.com/readymade-ui/readymade/issues" }, "homepage": "https://github.com/readymade-ui/readymade#readme" -} +} \ No newline at end of file diff --git a/vite-env.d.ts b/vite-env.d.ts new file mode 100644 index 00000000..48cd4d75 --- /dev/null +++ b/vite-env.d.ts @@ -0,0 +1,9 @@ +declare module '*.css?raw' { + const content: string; + export default content; +} + +declare module '*.html?raw' { + const content: string; + export default content; +}