Skip to content

Commit 5a20db8

Browse files
authored
Merge pull request #95 from AegisJSProject/bug/sourcemap
Release v1.0.7 with npm workflow and sourcemap fixes
2 parents 297e248 + 6fd6d36 commit 5a20db8

9 files changed

Lines changed: 35 additions & 9 deletions

File tree

.github/workflows/npm-publish.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,11 @@ jobs:
2525
cache: npm
2626
registry-url: https://registry.npmjs.org
2727
- name: Install dependencies
28-
run: npm ci --ignore-scripts --no-audit --fund-no
28+
run: npm ci --no-audit --no-fund
2929
- name: Run tests
3030
run: npm test
3131
- name: Build Package
3232
run: npm run build --if-present
3333
- name: Publish to npm
3434
run: npm publish --provenance --access public
35-
env:
36-
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
3735

.nvmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
20.9.0
1+
24.10.0

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [v1.0.7] - 2025-10-15
11+
12+
### Changed
13+
- Update publishing to comply with new npm policy
14+
15+
### Fixed
16+
- Add missing sourcemap
17+
1018
## [v1.0.6] - 2024-12-02
1119

1220
### Fixed

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@aegisjsproject/state",
3-
"version": "1.0.6",
3+
"version": "1.0.7",
44
"description": "A simple state manager library",
55
"keywords": [
66
"aegis",

rollup.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ export default [{
99
file: 'state.mjs',
1010
format: 'esm',
1111
plugins: [terser()],
12+
sourcemap: true,
1213
}]
1314
}];

state.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const _getState = (key, fallback = null) => history.state?.[key] ?? fallback;
2121

2222
function $$(selector, base = document.documentElement) {
2323
const results = base.querySelectorAll(selector);
24-
return base.matches(selector) ? [base, ...results] : Array.from(results);
24+
return base.matches instanceof Function && base.matches(selector) ? [base, ...results] : Array.from(results);
2525
}
2626

2727
async function _updateElement({ state = history.state ?? {} } = {}) {

test/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
}
1717
}
1818
</script>
19-
<script type="application/javascript" defer="" referrerpolicy="no-referrer" fetchpriority="auto" crossorigin="anonymous" integrity="sha384-uaVA9Le/fIJMMUrQHZyGJ+aAH3EdIhOLxPl+cuBCvvZBltVoc+Kemy4t8KLX3/aF" src="https://unpkg.com/@shgysk8zer0/polyfills@0.4.2/all.min.js"></script>
19+
<script type="application/javascript" defer="" referrerpolicy="no-referrer" fetchpriority="high" crossorigin="anonymous" integrity="sha384-S6IiMVrhK2h8SpNcu3w1ybvXAcAPLcN6DC8dy35bqDEcqIt4wP5zBGTYd96qtGRi" src="https://unpkg.com/@shgysk8zer0/polyfills@0.4.7/browser.min.js"></script>
2020
<script type="module" src="./index.js"></script>
2121
</head>
2222
<body>

test/index.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const [hidden, setHidden] = manageState('hidden', false);
3232
const [open, setOpen] = manageState('open', false);
3333
const [fill, setFill] = manageState('fill', '#ff0000');
3434
const [bg, setBg] = manageState('bg', 'inherit');
35+
const [content, setContent] = manageState('content', 'Bacon Ipsum');
3536
const iter = Iterator.range(list.at(-1) + 1, Infinity);
3637
const pushItem = registerCallback('push:item', () => setList(list.concat(iter.next().value)));
3738
registerCallback('state:fill:set', () => setFill(`#${crypto.getRandomValues(new Uint8Array(3)).toHex()}`));
@@ -106,6 +107,7 @@ class StatefulElemenet extends AegisComponent {
106107
}
107108
}
108109
document.body.append(html`
110+
<button type="button" popovertarget="popover" popovertargetaction="show">Show Popover</button>
109111
<p ${stateKey}="msg" ${statePropertyAttr}="innerHTML">${msg}</p>
110112
<button type="button" ${onClick}="${() => setHidden((state = hidden.valueOf()) => ! state)}" class="btn btn-system-accent">Toggle</button>
111113
<button type="button" ${onClick}="${() => setOpen(true)}" class="btn btn-system-accent">Show Modal</button>
@@ -141,17 +143,34 @@ document.body.append(html`
141143
</dialog>
142144
`);
143145

146+
const popover = html`
147+
<div popover="auto" id="popover">
148+
<template shadowrootmode="open">
149+
<button type="button" popovertarget="popover" popovertargetaction="hide" part="button">Close</button>
150+
<div part="content">
151+
<slot name="content">No Content</slot>
152+
</div>
153+
<p contenteditable="true" ${onInput}="${({ target }) => setContent(target.textContent)}">${content}</p>
154+
</template>
155+
<p ${stateKeyAttribute}="content" slot="content">${content}</p>
156+
</div>
157+
`;
158+
144159
const dialog = document.getElementById('test-dialog');
145160
StatefulElemenet.register('stateful-el');
146161
document.body.dataset[stateKey] = 'bg';
147162
document.body.dataset[stateStyle] = 'background-color';
148163
watchState();
149164
observeEvents(document.documentElement);
150165
observeDOMState(document.documentElement);
166+
observeEvents(popover.firstElementChild.shadowRoot);
167+
observeDOMState(popover.firstChild.shadowRoot);
151168
bindState('#root', 'hidden', { attr: 'hidden' });
152169
bindState('#img-result', 'file', { attr: 'src' });
153170
createStateHandler('#test-dialog', 'open', (open, dialog) => open ? dialog.showModal() : dialog.close());
171+
// popover.firstElementChild.shadowRoot.adoptedStyleSheets =
154172

173+
document.body.append(popover);
155174
if (open.valueOf()) {
156175
dialog.showModal();
157176
}

0 commit comments

Comments
 (0)