@esportsplus/reactivity 0.29.2 → 0.29.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -31,7 +31,7 @@
31
31
  },
32
32
  "type": "module",
33
33
  "types": "build/index.d.ts",
34
- "version": "0.29.2",
34
+ "version": "0.29.3",
35
35
  "scripts": {
36
36
  "build": "tsc",
37
37
  "build:test": "pnpm build && vite build --config test/vite.config.ts",
package/accordion.js DELETED
@@ -1,45 +0,0 @@
1
- import * as reactivity_1ihsmodgjbfar0 from '@esportsplus/reactivity';
2
- import { omit } from '@esportsplus/utilities';
3
- import template from '../../components/template/index.js';
4
- import './scss/index.scss';
5
- class ReactiveObject_xy8kflxy8kfl2 extends reactivity_1ihsmodgjbfar0.ReactiveObject {
6
- #active = this[reactivity_1ihsmodgjbfar0.SIGNAL](0);
7
- constructor() {
8
- super(null);
9
- }
10
- get active() {
11
- return reactivity_1ihsmodgjbfar0.read(this.#active);
12
- }
13
- set active(_v0) {
14
- reactivity_1ihsmodgjbfar0.write(this.#active, _v0);
15
- }
16
- }
17
- const OMIT = ['state'];
18
- let key = Symbol();
19
- export default template.factory(function (attributes, content) {
20
- let ref, state = attributes.state || reactivity_1ihsmodgjbfar0.reactive({
21
- active: 0
22
- }), n, html;
23
- `
24
- <div
25
- ${omit(attributes, OMIT)}
26
- ${{
27
- class: () => {
28
- return state.active && '--active';
29
- },
30
- onrender: (element) => {
31
- (ref = element)[key] = state;
32
- },
33
- style: () => {
34
- let parent = ref.closest('accordion');
35
- if (parent && key in parent) {
36
- parent[key].active = (+parent[key].active) + 1;
37
- }
38
- return state.active && `--max-height: ${ref.scrollHeight}`;
39
- }
40
- }}
41
- >
42
- ${content}
43
- </div>
44
- `;
45
- });
package/accordion.ts DELETED
@@ -1,51 +0,0 @@
1
- import { reactive } from '@esportsplus/reactivity';
2
- import { html, Attributes } from '@esportsplus/template';
3
- import { omit } from '@esportsplus/utilities';
4
- import template from '~/components/template';
5
- import './scss/index.scss';
6
-
7
-
8
- type A = Attributes & { state?: { active: boolean | number } };
9
-
10
- type Accordion = HTMLElement & { [key: symbol]: { active: boolean | number } };
11
-
12
-
13
- const OMIT = ['state'];
14
-
15
-
16
- let key = Symbol();
17
-
18
-
19
- export default template.factory(
20
- function(attributes: A, content) {
21
- let ref: Accordion,
22
- state = attributes.state || reactive({
23
- active: 0
24
- });
25
-
26
- return html`
27
- <div
28
- ${omit(attributes, OMIT)}
29
- ${{
30
- class: () => {
31
- return state.active && '--active';
32
- },
33
- onrender: (element) => {
34
- ( ref = element as Accordion )[key] = state;
35
- },
36
- style: () => {
37
- let parent = ref.closest<Accordion>('accordion');
38
-
39
- if (parent && key in parent) {
40
- parent[key].active = (+parent[key].active) + 1;
41
- }
42
-
43
- return state.active && `--max-height: ${ref.scrollHeight}`;
44
- }
45
- }}
46
- >
47
- ${content}
48
- </div>
49
- `;
50
- }
51
- );