@oscarpalmer/abydon 0.16.0 → 0.17.0
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/dist/{abydon.full.js → abydon.full.mjs} +307 -186
- package/dist/constants.d.mts +20 -0
- package/dist/{constants.js → constants.mjs} +2 -0
- package/dist/fragment-9qTBAvtR.d.mts +82 -0
- package/dist/fragment.d.mts +2 -0
- package/dist/{fragment.js → fragment.mjs} +35 -6
- package/dist/fragments.d.mts +16 -0
- package/dist/{fragments.js → fragments.mjs} +8 -3
- package/dist/helpers/dom.d.mts +6 -0
- package/dist/helpers/{dom.js → dom.mjs} +3 -1
- package/dist/helpers/index.d.mts +9 -0
- package/dist/helpers/{index.js → index.mjs} +6 -4
- package/dist/index.d.mts +21 -0
- package/dist/index.mjs +24 -0
- package/dist/models.d.mts +2 -0
- package/dist/models.mjs +1 -0
- package/dist/node/attribute/index.d.mts +6 -0
- package/dist/node/attribute/{index.js → index.mjs} +5 -3
- package/dist/node/attribute/value.d.mts +6 -0
- package/dist/node/attribute/{value.js → value.mjs} +11 -8
- package/dist/node/event.d.mts +4 -0
- package/dist/node/{event.js → event.mjs} +3 -1
- package/dist/node/index.d.mts +6 -0
- package/dist/node/{index.js → index.mjs} +9 -7
- package/dist/node/value.d.mts +7 -0
- package/dist/node/{value.js → value.mjs} +7 -5
- package/dist/parse.d.mts +6 -0
- package/dist/{parse.js → parse.mjs} +3 -1
- package/package.json +42 -40
- package/src/node/attribute/value.ts +8 -5
- package/dist/index.js +0 -11
- package/dist/models.js +0 -0
- package/types/constants.d.ts +0 -17
- package/types/fragment.d.ts +0 -38
- package/types/fragments.d.ts +0 -13
- package/types/helpers/dom.d.ts +0 -3
- package/types/helpers/index.d.ts +0 -5
- package/types/index.d.ts +0 -20
- package/types/models.d.ts +0 -41
- package/types/node/attribute/index.d.ts +0 -2
- package/types/node/attribute/value.d.ts +0 -2
- package/types/node/event.d.ts +0 -1
- package/types/node/index.d.ts +0 -2
- package/types/node/value.d.ts +0 -3
- package/types/parse.d.ts +0 -2
package/package.json
CHANGED
|
@@ -1,34 +1,6 @@
|
|
|
1
1
|
{
|
|
2
|
-
"
|
|
3
|
-
|
|
4
|
-
"url": "https://oscarpalmer.se"
|
|
5
|
-
},
|
|
6
|
-
"dependencies": {
|
|
7
|
-
"@oscarpalmer/atoms": "^0.118",
|
|
8
|
-
"@oscarpalmer/mora": "^0.25",
|
|
9
|
-
"@oscarpalmer/toretto": "^0.32"
|
|
10
|
-
},
|
|
11
|
-
"devDependencies": {
|
|
12
|
-
"@oscarpalmer/oui": "^0.18",
|
|
13
|
-
"@types/node": "^25",
|
|
14
|
-
"@vitest/coverage-istanbul": "^4",
|
|
15
|
-
"jsdom": "^27.3",
|
|
16
|
-
"oxfmt": "^0.19",
|
|
17
|
-
"oxlint": "^1.34",
|
|
18
|
-
"rolldown": "1.0.0-beta.56",
|
|
19
|
-
"tslib": "^2.8",
|
|
20
|
-
"typescript": "^5.9",
|
|
21
|
-
"vite": "8.0.0-beta.2",
|
|
22
|
-
"vitest": "^4"
|
|
23
|
-
},
|
|
24
|
-
"exports": {
|
|
25
|
-
"./package.json": "./package.json",
|
|
26
|
-
".": {
|
|
27
|
-
"types": "./types/index.d.ts",
|
|
28
|
-
"default": "./dist/index.js"
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"files": ["dist", "src", "types"],
|
|
2
|
+
"name": "@oscarpalmer/abydon",
|
|
3
|
+
"version": "0.17.0",
|
|
32
4
|
"keywords": [
|
|
33
5
|
"components",
|
|
34
6
|
"dom",
|
|
@@ -40,21 +12,51 @@
|
|
|
40
12
|
"vanilla"
|
|
41
13
|
],
|
|
42
14
|
"license": "MIT",
|
|
43
|
-
"
|
|
44
|
-
|
|
15
|
+
"author": {
|
|
16
|
+
"name": "Oscar Palmér",
|
|
17
|
+
"url": "https://oscarpalmer.se"
|
|
18
|
+
},
|
|
45
19
|
"repository": {
|
|
46
20
|
"type": "git",
|
|
47
21
|
"url": "git+https://github.com/oscarpalmer/abydon.git"
|
|
48
22
|
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist",
|
|
25
|
+
"src"
|
|
26
|
+
],
|
|
27
|
+
"type": "module",
|
|
28
|
+
"module": "./dist/index.mjs",
|
|
29
|
+
"types": "./dist/index.d.mts",
|
|
30
|
+
"exports": {
|
|
31
|
+
"./package.json": "./package.json",
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./dist/index.d.mts",
|
|
34
|
+
"default": "./dist/index.mjs"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
49
37
|
"scripts": {
|
|
50
|
-
"build": "npm run
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"test": "npx
|
|
38
|
+
"build": "npm run tsdown:build && npx vp pack",
|
|
39
|
+
"tsdown:build": "npx tsdown -c ./tsdown.config.ts",
|
|
40
|
+
"tsdown:watch": "npx tsdown -c ./tsdown.config.ts --watch",
|
|
41
|
+
"test": "npx vp test run --coverage",
|
|
42
|
+
"test:leak": "npx vp test run --detect-async-leaks --coverage",
|
|
55
43
|
"watch": "npx vite build --watch"
|
|
56
44
|
},
|
|
57
|
-
"
|
|
58
|
-
|
|
59
|
-
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@oscarpalmer/atoms": "^0.165",
|
|
47
|
+
"@oscarpalmer/mora": "^0.26",
|
|
48
|
+
"@oscarpalmer/toretto": "^0.41"
|
|
49
|
+
},
|
|
50
|
+
"devDependencies": {
|
|
51
|
+
"@oscarpalmer/oui": "^0.19",
|
|
52
|
+
"@types/node": "^25.5",
|
|
53
|
+
"@vitest/coverage-istanbul": "^4.1",
|
|
54
|
+
"jsdom": "^28.1",
|
|
55
|
+
"tsdown": "^0.21",
|
|
56
|
+
"typescript": "^5.9",
|
|
57
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@latest",
|
|
58
|
+
"vite-plus": "latest",
|
|
59
|
+
"vitest": "npm:@voidzero-dev/vite-plus-test@latest"
|
|
60
|
+
},
|
|
61
|
+
"packageManager": "npm@11.11.1"
|
|
60
62
|
}
|
|
@@ -2,8 +2,7 @@ import type {PlainObject} from '@oscarpalmer/atoms/models';
|
|
|
2
2
|
import {isReactive} from '@oscarpalmer/mora';
|
|
3
3
|
import {
|
|
4
4
|
isBooleanAttribute,
|
|
5
|
-
setAttribute as
|
|
6
|
-
setProperty,
|
|
5
|
+
setAttribute as setTorettoAttribute,
|
|
7
6
|
} from '@oscarpalmer/toretto/attribute';
|
|
8
7
|
import {
|
|
9
8
|
ATTRIBUTE_CLASS_PREFIX_LENGTH,
|
|
@@ -18,7 +17,7 @@ function getCallback(element: HTMLElement | SVGElement, name: string) {
|
|
|
18
17
|
return name === 'checked' ? updateChecked : updateProperty;
|
|
19
18
|
}
|
|
20
19
|
|
|
21
|
-
return name === 'value' ? updateValue :
|
|
20
|
+
return name === 'value' ? updateValue : setTorettoAttribute;
|
|
22
21
|
}
|
|
23
22
|
|
|
24
23
|
export function setAttribute(
|
|
@@ -127,7 +126,11 @@ function updateElement(
|
|
|
127
126
|
return;
|
|
128
127
|
}
|
|
129
128
|
|
|
130
|
-
|
|
129
|
+
setTorettoAttribute(element, name, value);
|
|
130
|
+
|
|
131
|
+
if ((element as unknown as PlainObject)[property] === next) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
131
134
|
|
|
132
135
|
(element as unknown as PlainObject)[property] = next;
|
|
133
136
|
|
|
@@ -135,7 +138,7 @@ function updateElement(
|
|
|
135
138
|
}
|
|
136
139
|
|
|
137
140
|
function updateProperty(element: HTMLElement | SVGElement, name: string, value: unknown): void {
|
|
138
|
-
|
|
141
|
+
setTorettoAttribute(element, name, value === true);
|
|
139
142
|
}
|
|
140
143
|
|
|
141
144
|
function updateValue(element: HTMLElement | SVGElement, name: string, value: unknown): void {
|
package/dist/index.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { Fragments } from "./fragments.js";
|
|
2
|
-
import { Fragment } from "./fragment.js";
|
|
3
|
-
import "@oscarpalmer/mora";
|
|
4
|
-
export * from "@oscarpalmer/mora";
|
|
5
|
-
function fragments(array$1, identify, fragment) {
|
|
6
|
-
return new Fragments(array$1, identify, fragment);
|
|
7
|
-
}
|
|
8
|
-
function html(template, ...values) {
|
|
9
|
-
return new Fragment(template, values);
|
|
10
|
-
}
|
|
11
|
-
export { fragments, html };
|
package/dist/models.js
DELETED
|
File without changes
|
package/types/constants.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export declare const ATTRIBUTE_CLASS_PREFIX_LENGTH = 6;
|
|
2
|
-
export declare const EVENT_DEFAULTS: Record<string, string>;
|
|
3
|
-
export declare const EXPRESSION_ABYDON_ATTRIBUTE_FULL: RegExp;
|
|
4
|
-
export declare const EXPRESSION_ABYDON_ATTRIBUTE_PREFIX: RegExp;
|
|
5
|
-
export declare const EXPRESSION_ABYDON_CONTENT: RegExp;
|
|
6
|
-
export declare const EXPRESSION_ATTRIBUTE_CLASS: RegExp;
|
|
7
|
-
export declare const EXPRESSION_ATTRIBUTE_STYLE_FULL: RegExp;
|
|
8
|
-
export declare const EXPRESSION_ATTRIBUTE_STYLE_PREFIX: RegExp;
|
|
9
|
-
export declare const EXPRESSION_EVENT_CHANGE_TYPES: RegExp;
|
|
10
|
-
export declare const EXPRESSION_EVENT_NAME: RegExp;
|
|
11
|
-
export declare const EXPRESSION_EVENT_OPTIONS_ACTIVE: RegExp;
|
|
12
|
-
export declare const EXPRESSION_EVENT_OPTIONS_CAPTURE: RegExp;
|
|
13
|
-
export declare const EXPRESSION_EVENT_OPTIONS_ONCE: RegExp;
|
|
14
|
-
export declare const EXPRESSION_EVENT_PREFIX: RegExp;
|
|
15
|
-
export declare const EXPRESSION_PERIOD: RegExp;
|
|
16
|
-
export declare const NAME_FRAGMENT = "$fragment";
|
|
17
|
-
export declare const NAME_FRAGMENTS = "$fragments";
|
package/types/fragment.d.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { FragmentConfiguration } from './models';
|
|
2
|
-
export declare class Fragment {
|
|
3
|
-
#private;
|
|
4
|
-
/**
|
|
5
|
-
* Fragment identifier
|
|
6
|
-
*/
|
|
7
|
-
get identifier(): unknown;
|
|
8
|
-
constructor(strings: TemplateStringsArray, expressions: unknown[]);
|
|
9
|
-
/**
|
|
10
|
-
* Append the fragment to the given element
|
|
11
|
-
* @param element Element to append to
|
|
12
|
-
*/
|
|
13
|
-
appendTo(element: Element): void;
|
|
14
|
-
/**
|
|
15
|
-
* Configure the fragment
|
|
16
|
-
* @param configuration Configuration options
|
|
17
|
-
* @returns Fragment
|
|
18
|
-
*/
|
|
19
|
-
configure(configuration: FragmentConfiguration): Fragment;
|
|
20
|
-
/**
|
|
21
|
-
* Get a list of the fragment's nodes
|
|
22
|
-
* @returns List of nodes
|
|
23
|
-
*/
|
|
24
|
-
get(): ChildNode[];
|
|
25
|
-
/**
|
|
26
|
-
* Set an identifier for the fragment
|
|
27
|
-
*
|
|
28
|
-
* _An identifier can be used to uniquely identify a fragment,
|
|
29
|
-
* which helps prevent re-rendering in certain scenarios._
|
|
30
|
-
* @param identifier Identifier
|
|
31
|
-
* @returns Fragment
|
|
32
|
-
*/
|
|
33
|
-
identify(identifier: unknown): Fragment;
|
|
34
|
-
/**
|
|
35
|
-
* Remove the fragment from the DOM
|
|
36
|
-
*/
|
|
37
|
-
remove(): void;
|
|
38
|
-
}
|
package/types/fragments.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { type ReactiveArray } from '@oscarpalmer/mora';
|
|
2
|
-
import type { Fragment } from './fragment';
|
|
3
|
-
import type { FragmentsState } from './models';
|
|
4
|
-
export declare class Fragments {
|
|
5
|
-
#private;
|
|
6
|
-
/**
|
|
7
|
-
* Fragment items
|
|
8
|
-
*/
|
|
9
|
-
get items(): ReactiveArray<Fragment>;
|
|
10
|
-
constructor(items: ReactiveArray<unknown>, identify: (item: unknown) => unknown, fragment: (item: unknown) => Fragment);
|
|
11
|
-
}
|
|
12
|
-
export declare function handleFragments(item: Fragments | FragmentsState, remove: boolean): void;
|
|
13
|
-
export declare function initializeFragments(state: FragmentsState): void;
|
package/types/helpers/dom.d.ts
DELETED
package/types/helpers/index.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { Fragment } from '../fragment';
|
|
2
|
-
import type { Fragments } from '../fragments';
|
|
3
|
-
export declare function compareArrays(first: unknown[], second: unknown[]): 'added' | 'dissimilar' | 'removed';
|
|
4
|
-
export declare function isFragment(value: unknown): value is Fragment;
|
|
5
|
-
export declare function isFragments(value: unknown): value is Fragments;
|
package/types/index.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import '@oscarpalmer/mora';
|
|
2
|
-
import type { ReactiveArray } from '@oscarpalmer/mora';
|
|
3
|
-
import { Fragment } from './fragment';
|
|
4
|
-
import { Fragments } from './fragments';
|
|
5
|
-
/**
|
|
6
|
-
* Create Fragments from a reactive array
|
|
7
|
-
* @param array Reactive array
|
|
8
|
-
* @param identify Function to identify item
|
|
9
|
-
* @param fragment Function to create fragment from item
|
|
10
|
-
* @returns Fragments
|
|
11
|
-
*/
|
|
12
|
-
export declare function fragments<Item>(array: ReactiveArray<Item>, identify: (item: Item) => unknown, fragment: (item: Item) => Fragment): Fragments;
|
|
13
|
-
/**
|
|
14
|
-
* Create Fragment from a template
|
|
15
|
-
* @returns Fragment
|
|
16
|
-
*/
|
|
17
|
-
export declare function html(template: TemplateStringsArray, ...values: unknown[]): Fragment;
|
|
18
|
-
export * from '@oscarpalmer/mora';
|
|
19
|
-
export type { Fragment } from './fragment';
|
|
20
|
-
export type { Fragments } from './fragments';
|
package/types/models.d.ts
DELETED
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import type { Reactive, ReactiveArray, Unsubscribe } from '@oscarpalmer/mora';
|
|
2
|
-
import type { Fragment } from './fragment';
|
|
3
|
-
export type FragmentConfiguration = {
|
|
4
|
-
/**
|
|
5
|
-
* Should the template be cached? _(defaults to `true`)_
|
|
6
|
-
*/
|
|
7
|
-
cache?: boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Identifier for the fragment
|
|
10
|
-
*
|
|
11
|
-
* _(An identifier can be used to uniquely identify a fragment,
|
|
12
|
-
* which helps prevent re-rendering in certain scenarios)_
|
|
13
|
-
*/
|
|
14
|
-
identifier?: unknown;
|
|
15
|
-
};
|
|
16
|
-
export type FragmentData = {
|
|
17
|
-
expressions: unknown[];
|
|
18
|
-
items: FragmentItem[];
|
|
19
|
-
mora: MoraData;
|
|
20
|
-
strings: TemplateStringsArray;
|
|
21
|
-
template?: string;
|
|
22
|
-
values: unknown[];
|
|
23
|
-
};
|
|
24
|
-
export type FragmentItem = {
|
|
25
|
-
fragments?: Fragment[];
|
|
26
|
-
nodes?: ChildNode[];
|
|
27
|
-
text?: Text;
|
|
28
|
-
};
|
|
29
|
-
export type FragmentsState = {
|
|
30
|
-
array: ReactiveArray<unknown>;
|
|
31
|
-
fragment: (item: unknown) => Fragment;
|
|
32
|
-
identify: (item: unknown) => unknown;
|
|
33
|
-
instances: Record<string, Fragment>;
|
|
34
|
-
mapped: ReactiveArray<Fragment>;
|
|
35
|
-
subscriber: Unsubscribe | undefined;
|
|
36
|
-
};
|
|
37
|
-
type MoraData = {
|
|
38
|
-
subscribers: Set<() => void>;
|
|
39
|
-
values: Set<Reactive<unknown>>;
|
|
40
|
-
};
|
|
41
|
-
export {};
|
package/types/node/event.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare function mapEvent(element: HTMLElement | SVGElement, name: string, value: unknown): void;
|
package/types/node/index.d.ts
DELETED
package/types/node/value.d.ts
DELETED
package/types/parse.d.ts
DELETED