Skip to content

Commit a28abd8

Browse files
committed
wip
1 parent 1dc67e7 commit a28abd8

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

packages/signals/signals/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"build:bundle": "NODE_ENV=production yarn run webpack",
3434
"workerbox": "node scripts/build-workerbox.js",
3535
"assert-generated": "sh scripts/assert-workerbox-built.sh",
36-
"watch": "yarn concurrently 'yarn build:bundle --watch' 'yarn build:esm --watch'",
36+
"watch": "rm -rf dist && yarn concurrently 'yarn build:bundle --watch' 'yarn build:esm --watch'",
3737
"version": "sh scripts/version.sh",
3838
"watch:test": "yarn test --watch",
3939
"tsc": "yarn run -T tsc",

packages/signals/signals/src/core/signal-generators/dom-gen/dom-gen.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -263,14 +263,16 @@ export class OnChangeGenerator implements SignalGenerator {
263263
if (this.shouldIgnore(target)) {
264264
return
265265
}
266-
266+
const el = parseElement(ev.element)
267267
emitter.emit(
268268
createInteractionSignal({
269269
eventType: 'change',
270-
target: parseElement(ev.element),
271-
metadata: {
270+
target: {
271+
...el,
272+
changedValue: ev.newValue,
272273
changedAttribute: ev.attributeName,
273-
changeAttributeVal: ev.newValue,
274+
},
275+
metadata: {
274276
listener: 'mutation-observer',
275277
},
276278
})
@@ -285,10 +287,15 @@ export class OnChangeGenerator implements SignalGenerator {
285287
return
286288
}
287289

290+
const el = parseElement(target)
288291
emitter.emit(
289292
createInteractionSignal({
290293
eventType: 'change',
291-
target: parseElement(target),
294+
target: {
295+
...el,
296+
changedValue: el.value,
297+
changedAttribute: 'value',
298+
},
292299
metadata: {
293300
listener: 'on-change',
294301
},

packages/signals/signals/src/core/signal-generators/dom-gen/mutation-observer.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ const defaultElementAttributesMap = {
4040
type AttributeChangedEvent = {
4141
type: 'interaction' | 'alert'
4242
element: HTMLElement
43-
describedElement: HTMLElement | null
4443
attributeName: string
4544
newValue: string | null
4645
}
@@ -99,15 +98,10 @@ export class ElementChangeObservable {
9998
if (newValue === null) {
10099
return console.warn('New value is null?', attributeName)
101100
}
102-
const describedElement = element.getAttribute('aria-describedby')
103101
const event: AttributeChangedEvent = {
104102
type: 'interaction',
105103
element: element as HTMLElement,
106104
attributeName,
107-
// this is innacurate
108-
describedElement: describedElement
109-
? document.getElementById(describedElement)
110-
: null,
111105
newValue,
112106
}
113107
emitter.emit('attributeChanged', event)

0 commit comments

Comments
 (0)