Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Machy8 committed Nov 18, 2023
1 parent 77429e5 commit 0c3c71e
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 6 deletions.
10 changes: 9 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,18 @@
<script type="module">
import Signalize from 'signalizejs';
import directives from 'signalizejs/directives';
import dialog from 'signalizejs/dialog';

// Use the directives plugin
const { scope, on } = new Signalize({ plugins: [directives()] });
const { scope, on } = new Signalize({ plugins: [directives(), dialog()] });
</script>
<dialog dialog="hello-world">
Hello World!<br><br>
<button dialog-close="hello-world">Close</button>
</dialog>

<button dialog-open="hello-world">Open Dialog</button>

<!-- <div id="test" $code="'Hello World'">
<div $fu="" scope="code">
</div>
Expand Down
10 changes: 5 additions & 5 deletions packages/signalizejs/src/Signalize.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import bind from './plugins/bind';
import dispatch from './plugins/dispatch'
import domReady from './plugins/domReady';
import domReady from './plugins/dom-ready';
import merge from './plugins/merge';
import mutationsObserver from './plugins/mutation-observer';
import off from './plugins/off';
Expand All @@ -14,7 +14,7 @@ import traverseDom from './plugins/traverse-dom';

export * from './plugins/bind';
export * from './plugins/dispatch'
export * from './plugins/domReady';
export * from './plugins/dom-ready';
export * from './plugins/merge';
export * from './plugins/mutation-observer';
export * from './plugins/off';
Expand Down Expand Up @@ -61,7 +61,7 @@ export class Signalize {
readonly #init = (options: Partial<SignalizeOptions>): void => {
this.root = options?.root ?? document;
this.attributePrefix = options?.attributePrefix ?? '';
this.attributeSeparator = options?.attributeSeparator ?? '';
this.attributeSeparator = options?.attributeSeparator ?? '-';

merge(this);

Expand All @@ -71,7 +71,7 @@ export class Signalize {
select(this);
dispatch(this);
on(this);
this.customEventListener('signalize:ready', ({ listener }) => {
this.customEventListener('signalize:ready', ({ listener }) => {
readyListeners.push(listener);
});
domReady(this);
Expand All @@ -86,7 +86,7 @@ export class Signalize {
plugin(this);
}

while(readyListeners.length > 0) {
while (readyListeners.length > 0) {
readyListeners.shift()();
}

Expand Down
1 change: 1 addition & 0 deletions packages/signalizejs/src/plugins/dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export default (): SignalizePlugin => {
}

on('dom:ready', () => {
console.log(dialogCloseButtonAttribute);
on('click', `[${dialogCloseButtonAttribute}]`, ({ target }) => {
const dialog = target.getAttribute[`${dialogCloseButtonAttribute}`] ?? target.closest(`[${dialogAttribute}]`);

Expand Down

0 comments on commit 0c3c71e

Please sign in to comment.