@vielzeug/ore 1.2.3 → 2.0.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/README.md +11 -8
- package/dist/_component-class.cjs +2 -0
- package/dist/_component-class.cjs.map +1 -0
- package/dist/_component-class.d.ts +2 -0
- package/dist/_component-class.d.ts.map +1 -0
- package/dist/_component-class.js +2 -0
- package/dist/_component-class.js.map +1 -0
- package/dist/_dev.cjs +1 -1
- package/dist/_dev.cjs.map +1 -1
- package/dist/_dev.js +1 -1
- package/dist/_dev.js.map +1 -1
- package/dist/base-element.cjs +1 -1
- package/dist/base-element.cjs.map +1 -1
- package/dist/base-element.d.ts +9 -15
- package/dist/base-element.d.ts.map +1 -1
- package/dist/base-element.js +1 -1
- package/dist/base-element.js.map +1 -1
- package/dist/component-types.d.ts +3 -14
- package/dist/component-types.d.ts.map +1 -1
- package/dist/context.cjs +1 -1
- package/dist/context.cjs.map +1 -1
- package/dist/context.d.ts +13 -0
- package/dist/context.d.ts.map +1 -1
- package/dist/context.js +1 -1
- package/dist/context.js.map +1 -1
- package/dist/define.cjs +1 -1
- package/dist/define.cjs.map +1 -1
- package/dist/define.d.ts +6 -5
- package/dist/define.d.ts.map +1 -1
- package/dist/define.js +1 -1
- package/dist/define.js.map +1 -1
- package/dist/directives/classMap.cjs +1 -1
- package/dist/directives/classMap.cjs.map +1 -1
- package/dist/directives/classMap.d.ts.map +1 -1
- package/dist/directives/classMap.js +1 -1
- package/dist/directives/classMap.js.map +1 -1
- package/dist/directives/each.cjs +1 -1
- package/dist/directives/each.cjs.map +1 -1
- package/dist/directives/each.d.ts +9 -2
- package/dist/directives/each.d.ts.map +1 -1
- package/dist/directives/each.js +1 -1
- package/dist/directives/each.js.map +1 -1
- package/dist/directives/live.cjs +1 -1
- package/dist/directives/live.cjs.map +1 -1
- package/dist/directives/live.d.ts +10 -12
- package/dist/directives/live.d.ts.map +1 -1
- package/dist/directives/live.js +1 -1
- package/dist/directives/live.js.map +1 -1
- package/dist/directives/styleMap.cjs +1 -1
- package/dist/directives/styleMap.cjs.map +1 -1
- package/dist/directives/styleMap.d.ts +1 -1
- package/dist/directives/styleMap.d.ts.map +1 -1
- package/dist/directives/styleMap.js +1 -1
- package/dist/directives/styleMap.js.map +1 -1
- package/dist/directives/unsafe-html.cjs +2 -0
- package/dist/directives/unsafe-html.cjs.map +1 -0
- package/dist/directives/unsafe-html.d.ts +14 -0
- package/dist/directives/unsafe-html.d.ts.map +1 -0
- package/dist/directives/unsafe-html.js +2 -0
- package/dist/directives/unsafe-html.js.map +1 -0
- package/dist/directives/when.cjs +1 -1
- package/dist/directives/when.cjs.map +1 -1
- package/dist/directives/when.d.ts +1 -1
- package/dist/directives/when.d.ts.map +1 -1
- package/dist/directives/when.js +1 -1
- package/dist/directives/when.js.map +1 -1
- package/dist/errors.cjs +2 -2
- package/dist/errors.cjs.map +1 -1
- package/dist/errors.d.ts +21 -6
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +2 -2
- package/dist/errors.js.map +1 -1
- package/dist/forms/field.cjs +1 -1
- package/dist/forms/field.cjs.map +1 -1
- package/dist/forms/field.d.ts +5 -1
- package/dist/forms/field.d.ts.map +1 -1
- package/dist/forms/field.js +1 -1
- package/dist/forms/field.js.map +1 -1
- package/dist/host-bind.cjs +1 -1
- package/dist/host-bind.cjs.map +1 -1
- package/dist/host-bind.d.ts +6 -0
- package/dist/host-bind.d.ts.map +1 -1
- package/dist/host-bind.js +1 -1
- package/dist/host-bind.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +15 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/observers/intersection-observe.cjs +1 -1
- package/dist/observers/intersection-observe.cjs.map +1 -1
- package/dist/observers/intersection-observe.d.ts.map +1 -1
- package/dist/observers/intersection-observe.js +1 -1
- package/dist/observers/intersection-observe.js.map +1 -1
- package/dist/observers/media-observe.cjs +1 -1
- package/dist/observers/media-observe.cjs.map +1 -1
- package/dist/observers/media-observe.d.ts.map +1 -1
- package/dist/observers/media-observe.js +1 -1
- package/dist/observers/media-observe.js.map +1 -1
- package/dist/observers/mutation-observe.cjs +1 -1
- package/dist/observers/mutation-observe.cjs.map +1 -1
- package/dist/observers/mutation-observe.d.ts.map +1 -1
- package/dist/observers/mutation-observe.js +1 -1
- package/dist/observers/mutation-observe.js.map +1 -1
- package/dist/observers/resize-observe.cjs +1 -1
- package/dist/observers/resize-observe.cjs.map +1 -1
- package/dist/observers/resize-observe.d.ts.map +1 -1
- package/dist/observers/resize-observe.js +1 -1
- package/dist/observers/resize-observe.js.map +1 -1
- package/dist/ore.cjs +2 -2
- package/dist/ore.cjs.map +1 -1
- package/dist/ore.iife.js +2 -2
- package/dist/ore.iife.js.map +1 -1
- package/dist/ore.js +2 -2
- package/dist/ore.js.map +1 -1
- package/dist/props.cjs +1 -1
- package/dist/props.cjs.map +1 -1
- package/dist/props.d.ts +1 -6
- package/dist/props.d.ts.map +1 -1
- package/dist/props.js +1 -1
- package/dist/props.js.map +1 -1
- package/dist/runtime.cjs +1 -1
- package/dist/runtime.cjs.map +1 -1
- package/dist/runtime.d.ts +7 -10
- package/dist/runtime.d.ts.map +1 -1
- package/dist/runtime.js +1 -1
- package/dist/runtime.js.map +1 -1
- package/dist/slots.cjs +1 -1
- package/dist/slots.cjs.map +1 -1
- package/dist/slots.d.ts.map +1 -1
- package/dist/slots.js +1 -1
- package/dist/slots.js.map +1 -1
- package/dist/template/binding-types.cjs +1 -0
- package/dist/template/binding-types.d.ts +59 -0
- package/dist/template/binding-types.d.ts.map +1 -0
- package/dist/template/binding-types.js +1 -0
- package/dist/template/bindings.cjs +1 -1
- package/dist/template/bindings.cjs.map +1 -1
- package/dist/template/bindings.d.ts +18 -3
- package/dist/template/bindings.d.ts.map +1 -1
- package/dist/template/bindings.js +1 -1
- package/dist/template/bindings.js.map +1 -1
- package/dist/template/compiler.cjs +1 -1
- package/dist/template/compiler.cjs.map +1 -1
- package/dist/template/compiler.d.ts +0 -4
- package/dist/template/compiler.d.ts.map +1 -1
- package/dist/template/compiler.js +1 -1
- package/dist/template/compiler.js.map +1 -1
- package/dist/template/instantiator.cjs +1 -1
- package/dist/template/instantiator.cjs.map +1 -1
- package/dist/template/instantiator.d.ts +6 -1
- package/dist/template/instantiator.d.ts.map +1 -1
- package/dist/template/instantiator.js +1 -1
- package/dist/template/instantiator.js.map +1 -1
- package/dist/template/result.cjs +2 -0
- package/dist/template/result.cjs.map +1 -0
- package/dist/template/result.d.ts +42 -0
- package/dist/template/result.d.ts.map +1 -0
- package/dist/template/result.js +2 -0
- package/dist/template/result.js.map +1 -0
- package/dist/testing/flush.cjs +1 -1
- package/dist/testing/flush.cjs.map +1 -1
- package/dist/testing/flush.d.ts +30 -26
- package/dist/testing/flush.d.ts.map +1 -1
- package/dist/testing/flush.js +1 -1
- package/dist/testing/flush.js.map +1 -1
- package/dist/testing/form-internals-polyfill.cjs +1 -1
- package/dist/testing/form-internals-polyfill.cjs.map +1 -1
- package/dist/testing/form-internals-polyfill.d.ts +9 -7
- package/dist/testing/form-internals-polyfill.d.ts.map +1 -1
- package/dist/testing/form-internals-polyfill.js +1 -1
- package/dist/testing/form-internals-polyfill.js.map +1 -1
- package/dist/testing/index.d.ts +35 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/mount.cjs +1 -1
- package/dist/testing/mount.cjs.map +1 -1
- package/dist/testing/mount.d.ts +10 -19
- package/dist/testing/mount.d.ts.map +1 -1
- package/dist/testing/mount.js +1 -1
- package/dist/testing/mount.js.map +1 -1
- package/dist/testing/render-hook.cjs +1 -1
- package/dist/testing/render-hook.cjs.map +1 -1
- package/dist/testing/render-hook.js +1 -1
- package/dist/testing/render-hook.js.map +1 -1
- package/dist/testing/reset.cjs +2 -0
- package/dist/testing/reset.cjs.map +1 -0
- package/dist/testing/reset.d.ts +12 -0
- package/dist/testing/reset.d.ts.map +1 -0
- package/dist/testing/reset.js +2 -0
- package/dist/testing/reset.js.map +1 -0
- package/dist/testing.cjs +2 -1
- package/dist/testing.cjs.map +1 -0
- package/dist/testing.js +2 -1
- package/dist/testing.js.map +1 -0
- package/dist/utils/aria.cjs.map +1 -1
- package/dist/utils/aria.d.ts +1 -1
- package/dist/utils/aria.js.map +1 -1
- package/dist/utils/brand.cjs +2 -0
- package/dist/utils/brand.cjs.map +1 -0
- package/dist/utils/brand.d.ts +16 -0
- package/dist/utils/brand.d.ts.map +1 -0
- package/dist/utils/brand.js +2 -0
- package/dist/utils/brand.js.map +1 -0
- package/dist/utils/css.cjs +1 -1
- package/dist/utils/css.cjs.map +1 -1
- package/dist/utils/css.d.ts.map +1 -1
- package/dist/utils/css.js +1 -1
- package/dist/utils/css.js.map +1 -1
- package/dist/utils/dom.cjs +1 -1
- package/dist/utils/dom.cjs.map +1 -1
- package/dist/utils/dom.d.ts +34 -0
- package/dist/utils/dom.d.ts.map +1 -1
- package/dist/utils/dom.js +1 -1
- package/dist/utils/dom.js.map +1 -1
- package/dist/utils/emit.cjs.map +1 -1
- package/dist/utils/emit.d.ts +10 -3
- package/dist/utils/emit.d.ts.map +1 -1
- package/dist/utils/emit.js.map +1 -1
- package/dist/utils/id.cjs +1 -1
- package/dist/utils/id.cjs.map +1 -1
- package/dist/utils/id.d.ts +11 -2
- package/dist/utils/id.d.ts.map +1 -1
- package/dist/utils/id.js +1 -1
- package/dist/utils/id.js.map +1 -1
- package/package.json +15 -30
- package/dist/aria.cjs +0 -2
- package/dist/aria.cjs.map +0 -1
- package/dist/aria.d.ts +0 -20
- package/dist/aria.d.ts.map +0 -1
- package/dist/aria.js +0 -2
- package/dist/aria.js.map +0 -1
- package/dist/devtools.cjs +0 -2
- package/dist/devtools.cjs.map +0 -1
- package/dist/devtools.d.ts +0 -32
- package/dist/devtools.d.ts.map +0 -1
- package/dist/devtools.js +0 -2
- package/dist/devtools.js.map +0 -1
- package/dist/directives/index.d.ts +0 -8
- package/dist/directives/index.d.ts.map +0 -1
- package/dist/directives/model.cjs +0 -2
- package/dist/directives/model.cjs.map +0 -1
- package/dist/directives/model.d.ts +0 -28
- package/dist/directives/model.d.ts.map +0 -1
- package/dist/directives/model.js +0 -2
- package/dist/directives/model.js.map +0 -1
- package/dist/directives/raw.cjs +0 -2
- package/dist/directives/raw.cjs.map +0 -1
- package/dist/directives/raw.d.ts +0 -16
- package/dist/directives/raw.d.ts.map +0 -1
- package/dist/directives/raw.js +0 -2
- package/dist/directives/raw.js.map +0 -1
- package/dist/directives.cjs +0 -1
- package/dist/directives.js +0 -1
- package/dist/forms/context.cjs +0 -2
- package/dist/forms/context.cjs.map +0 -1
- package/dist/forms/context.d.ts +0 -56
- package/dist/forms/context.d.ts.map +0 -1
- package/dist/forms/context.js +0 -2
- package/dist/forms/context.js.map +0 -1
- package/dist/forms/index.d.ts +0 -11
- package/dist/forms/index.d.ts.map +0 -1
- package/dist/forms.cjs +0 -1
- package/dist/forms.js +0 -1
- package/dist/observers/index.d.ts +0 -5
- package/dist/observers/index.d.ts.map +0 -1
- package/dist/observers.cjs +0 -1
- package/dist/observers.js +0 -1
- package/dist/template.cjs +0 -1
- package/dist/template.d.ts +0 -4
- package/dist/template.d.ts.map +0 -1
- package/dist/template.js +0 -1
- package/dist/testing/events.cjs +0 -2
- package/dist/testing/events.cjs.map +0 -1
- package/dist/testing/events.d.ts +0 -37
- package/dist/testing/events.d.ts.map +0 -1
- package/dist/testing/events.js +0 -2
- package/dist/testing/events.js.map +0 -1
- package/dist/testing/interactions.cjs +0 -2
- package/dist/testing/interactions.cjs.map +0 -1
- package/dist/testing/interactions.d.ts +0 -27
- package/dist/testing/interactions.d.ts.map +0 -1
- package/dist/testing/interactions.js +0 -2
- package/dist/testing/interactions.js.map +0 -1
- package/dist/testing/query.cjs +0 -2
- package/dist/testing/query.cjs.map +0 -1
- package/dist/testing/query.d.ts +0 -24
- package/dist/testing/query.d.ts.map +0 -1
- package/dist/testing/query.js +0 -2
- package/dist/testing/query.js.map +0 -1
- package/dist/testing/testing.cjs +0 -2
- package/dist/testing/testing.cjs.map +0 -1
- package/dist/testing/testing.d.ts +0 -32
- package/dist/testing/testing.d.ts.map +0 -1
- package/dist/testing/testing.js +0 -2
- package/dist/testing/testing.js.map +0 -1
- package/dist/testing/wait.cjs +0 -2
- package/dist/testing/wait.cjs.map +0 -1
- package/dist/testing/wait.d.ts +0 -35
- package/dist/testing/wait.d.ts.map +0 -1
- package/dist/testing/wait.js +0 -2
- package/dist/testing/wait.js.map +0 -1
- package/dist/types/bindings.cjs +0 -2
- package/dist/types/bindings.cjs.map +0 -1
- package/dist/types/bindings.d.ts +0 -125
- package/dist/types/bindings.d.ts.map +0 -1
- package/dist/types/bindings.js +0 -2
- package/dist/types/bindings.js.map +0 -1
- package/dist/types.cjs +0 -2
- package/dist/types.cjs.map +0 -1
- package/dist/types.d.ts +0 -19
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/utils/event-modifiers.cjs +0 -2
- package/dist/utils/event-modifiers.cjs.map +0 -1
- package/dist/utils/event-modifiers.d.ts +0 -11
- package/dist/utils/event-modifiers.d.ts.map +0 -1
- package/dist/utils/event-modifiers.js +0 -2
- package/dist/utils/event-modifiers.js.map +0 -1
package/dist/types/bindings.d.ts
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Core type definitions for the template binding and rendering system.
|
|
3
|
-
*
|
|
4
|
-
* All bindings reference actual DOM nodes directly (no UID-based lookup).
|
|
5
|
-
* This eliminates the TreeWalker indexing pass and the string-based ID remapping
|
|
6
|
-
* that the previous design required.
|
|
7
|
-
*/
|
|
8
|
-
import { type Readable, type Signal } from '@vielzeug/ripple';
|
|
9
|
-
export type Ref<T extends Element> = Signal<T | null>;
|
|
10
|
-
export declare function ref<T extends Element>(): Ref<T>;
|
|
11
|
-
export type RefCallback<T extends Element> = (el: T | null) => void;
|
|
12
|
-
export type TextBinding = {
|
|
13
|
-
node: Text;
|
|
14
|
-
signal: Readable<unknown>;
|
|
15
|
-
type: 'text';
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* Minimal prop metadata needed by the attr binding layer.
|
|
19
|
-
* Populated at binding creation time from propRegistry, so template-bindings.ts
|
|
20
|
-
* has no direct dependency on props.ts.
|
|
21
|
-
*/
|
|
22
|
-
export type AttrPropMeta = {
|
|
23
|
-
parse: (v: string | null) => unknown;
|
|
24
|
-
reflect: boolean;
|
|
25
|
-
signal: {
|
|
26
|
-
value: unknown;
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
type AttrBaseFields = {
|
|
30
|
-
el: HTMLElement;
|
|
31
|
-
/**
|
|
32
|
-
* When true the binding uses live-write semantics: stale app-state writes are
|
|
33
|
-
* skipped if the DOM value has diverged from the last programmatic write.
|
|
34
|
-
*/
|
|
35
|
-
live?: true;
|
|
36
|
-
mode: 'attr' | 'bool';
|
|
37
|
-
name: string;
|
|
38
|
-
/** Pre-resolved prop metadata (if the target element is an ore component). */
|
|
39
|
-
propMeta?: AttrPropMeta;
|
|
40
|
-
type: 'attr';
|
|
41
|
-
};
|
|
42
|
-
/** Attribute binding with a static value (no signal). */
|
|
43
|
-
export type AttrStaticBinding = AttrBaseFields & {
|
|
44
|
-
value: unknown;
|
|
45
|
-
};
|
|
46
|
-
/** Attribute binding driven by a reactive signal. */
|
|
47
|
-
export type AttrReactiveBinding = AttrBaseFields & {
|
|
48
|
-
signal: Readable<unknown>;
|
|
49
|
-
};
|
|
50
|
-
export type AttrBinding = AttrStaticBinding | AttrReactiveBinding;
|
|
51
|
-
export type EventBinding = {
|
|
52
|
-
el: HTMLElement;
|
|
53
|
-
handler: (e: Event) => void;
|
|
54
|
-
name: string;
|
|
55
|
-
options?: AddEventListenerOptions;
|
|
56
|
-
type: 'event';
|
|
57
|
-
};
|
|
58
|
-
export type RefBinding = {
|
|
59
|
-
el: HTMLElement;
|
|
60
|
-
ref: Ref<Element> | RefCallback<Element>;
|
|
61
|
-
type: 'ref';
|
|
62
|
-
};
|
|
63
|
-
/** Value types a reactive HTML slot can produce. */
|
|
64
|
-
export type HtmlBindingValue = HTMLResult | string | number | boolean | null | undefined;
|
|
65
|
-
export type HtmlBinding = {
|
|
66
|
-
anchor: Comment;
|
|
67
|
-
signal: Readable<HtmlBindingValue[]>;
|
|
68
|
-
type: 'html';
|
|
69
|
-
};
|
|
70
|
-
export type DirectiveBinding = {
|
|
71
|
-
anchor: Comment;
|
|
72
|
-
directive: DirectiveResult;
|
|
73
|
-
type: 'directive';
|
|
74
|
-
};
|
|
75
|
-
/** Element-spread binding applied by model() and similar helpers. */
|
|
76
|
-
export type SpreadBinding = {
|
|
77
|
-
el: HTMLElement;
|
|
78
|
-
spread: SpreadObject;
|
|
79
|
-
type: 'spread';
|
|
80
|
-
};
|
|
81
|
-
export type Binding = TextBinding | AttrBinding | EventBinding | RefBinding | HtmlBinding | DirectiveBinding | SpreadBinding;
|
|
82
|
-
export type DirectiveResult = {
|
|
83
|
-
mount: (anchor: Comment, registerCleanup: (fn: () => void) => void) => void;
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* Creates a registered DirectiveResult. All directive factories must use this
|
|
87
|
-
* function — only objects created here pass `isDirectiveResult()`.
|
|
88
|
-
*/
|
|
89
|
-
export declare const createDirectiveResult: (mount: DirectiveResult["mount"]) => DirectiveResult;
|
|
90
|
-
export declare const isDirectiveResult: (value: unknown) => value is DirectiveResult;
|
|
91
|
-
export type SpreadObject = {
|
|
92
|
-
apply(el: HTMLElement, registerCleanup: (fn: () => void) => void): void;
|
|
93
|
-
};
|
|
94
|
-
/**
|
|
95
|
-
* Creates a registered SpreadObject. Used by model() to attach multiple bindings
|
|
96
|
-
* (value sync + input event) to an element via a single template expression.
|
|
97
|
-
*/
|
|
98
|
-
export declare const createSpreadObject: (apply: SpreadObject["apply"]) => SpreadObject;
|
|
99
|
-
export declare const isSpreadObject: (value: unknown) => value is SpreadObject;
|
|
100
|
-
/**
|
|
101
|
-
* The output of an `html` tagged template call.
|
|
102
|
-
*
|
|
103
|
-
* Each `html` call produces an independent fragment — there is no shared mutable
|
|
104
|
-
* state between instances, so the same template can be safely rendered multiple
|
|
105
|
-
* times (e.g. inside `each()`).
|
|
106
|
-
*/
|
|
107
|
-
export interface HTMLResult {
|
|
108
|
-
/** The DOM fragment ready to insert into the document. Consumed on insertion. */
|
|
109
|
-
readonly fragment: DocumentFragment;
|
|
110
|
-
/** Wire up reactive effects to the fragment's nodes. Call after insertion. */
|
|
111
|
-
apply(registerCleanup: (fn: () => void) => void): void;
|
|
112
|
-
/**
|
|
113
|
-
* Insert the fragment before `anchor` (or append to `parent` when no anchor)
|
|
114
|
-
* and immediately wire up all reactive effects.
|
|
115
|
-
*
|
|
116
|
-
* This is the preferred single-step API — it is impossible to forget calling
|
|
117
|
-
* `apply` separately. Use the lower-level `fragment` + `apply` only when you
|
|
118
|
-
* need precise control over insertion (e.g. inside directive implementations).
|
|
119
|
-
*/
|
|
120
|
-
mount(parent: ParentNode, anchor: Node | null, registerCleanup: (fn: () => void) => void): Node[];
|
|
121
|
-
}
|
|
122
|
-
export declare const isHtmlResult: (value: unknown) => value is HTMLResult;
|
|
123
|
-
export declare function createHtmlResult(fragment: DocumentFragment, applyFn: (registerCleanup: (fn: () => void) => void) => void): HTMLResult;
|
|
124
|
-
export {};
|
|
125
|
-
//# sourceMappingURL=bindings.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bindings.d.ts","sourceRoot":"","sources":["../../src/types/bindings.ts"],"names":[],"mappings":"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"}
|
package/dist/types/bindings.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{signal as e}from"@vielzeug/ripple";function t(){return e(null)}var n=e=>{let t=Symbol.for(e);return{is:e=>typeof e==`object`&&!!e&&t in e,stamp:e=>Object.assign(e,{[t]:!0})}},r=n(`ore:directive`),i=e=>r.stamp({mount:e}),a=r.is,o=n(`ore:spread`),s=e=>o.stamp({apply:e}),c=o.is,l=n(`ore:html-result`),u=l.is;function d(e,t){return l.stamp({apply:t,fragment:e,mount:(n,r,i)=>{let a=Array.from(e.childNodes);return n.insertBefore(e,r),t(i),a}})}export{i as createDirectiveResult,d as createHtmlResult,s as createSpreadObject,a as isDirectiveResult,u as isHtmlResult,c as isSpreadObject,t as ref};
|
|
2
|
-
//# sourceMappingURL=bindings.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bindings.js","names":[],"sources":["../../src/types/bindings.ts"],"sourcesContent":["/**\n * Core type definitions for the template binding and rendering system.\n *\n * All bindings reference actual DOM nodes directly (no UID-based lookup).\n * This eliminates the TreeWalker indexing pass and the string-based ID remapping\n * that the previous design required.\n */\n\nimport { type Readable, signal, type Signal } from '@vielzeug/ripple';\n\n// ─── REF TYPES ───────────────────────────────────────────────────────────────\n\nexport type Ref<T extends Element> = Signal<T | null>;\n\nexport function ref<T extends Element>(): Ref<T> {\n return signal<T | null>(null);\n}\n\nexport type RefCallback<T extends Element> = (el: T | null) => void;\n\n// ─── BINDING VARIANTS ────────────────────────────────────────────────────────\n// All bindings hold direct references to the DOM node they manage.\n\nexport type TextBinding = {\n node: Text;\n signal: Readable<unknown>;\n type: 'text';\n};\n\n/**\n * Minimal prop metadata needed by the attr binding layer.\n * Populated at binding creation time from propRegistry, so template-bindings.ts\n * has no direct dependency on props.ts.\n */\nexport type AttrPropMeta = {\n parse: (v: string | null) => unknown;\n reflect: boolean;\n signal: { value: unknown };\n};\n\ntype AttrBaseFields = {\n el: HTMLElement;\n /**\n * When true the binding uses live-write semantics: stale app-state writes are\n * skipped if the DOM value has diverged from the last programmatic write.\n */\n live?: true;\n mode: 'attr' | 'bool';\n name: string;\n /** Pre-resolved prop metadata (if the target element is an ore component). */\n propMeta?: AttrPropMeta;\n type: 'attr';\n};\n\n/** Attribute binding with a static value (no signal). */\nexport type AttrStaticBinding = AttrBaseFields & { value: unknown };\n\n/** Attribute binding driven by a reactive signal. */\nexport type AttrReactiveBinding = AttrBaseFields & { signal: Readable<unknown> };\n\nexport type AttrBinding = AttrStaticBinding | AttrReactiveBinding;\n\nexport type EventBinding = {\n el: HTMLElement;\n handler: (e: Event) => void;\n name: string;\n options?: AddEventListenerOptions;\n type: 'event';\n};\n\nexport type RefBinding = {\n el: HTMLElement;\n ref: Ref<Element> | RefCallback<Element>;\n type: 'ref';\n};\n\n/** Value types a reactive HTML slot can produce. */\nexport type HtmlBindingValue = HTMLResult | string | number | boolean | null | undefined;\n\nexport type HtmlBinding = {\n anchor: Comment;\n signal: Readable<HtmlBindingValue[]>;\n type: 'html';\n};\n\nexport type DirectiveBinding = {\n anchor: Comment;\n directive: DirectiveResult;\n type: 'directive';\n};\n\n/** Element-spread binding applied by model() and similar helpers. */\nexport type SpreadBinding = {\n el: HTMLElement;\n spread: SpreadObject;\n type: 'spread';\n};\n\nexport type Binding =\n TextBinding | AttrBinding | EventBinding | RefBinding | HtmlBinding | DirectiveBinding | SpreadBinding;\n\n// ─── BRAND UTILITY ───────────────────────────────────────────────────────────\n// Cross-realm–safe brand for branded types. Avoids repeating the symbol+guard boilerplate.\n\nconst makeBrand = <T extends object>(key: string) => {\n const BRAND = Symbol.for(key);\n const stamp = (obj: T): T => Object.assign(obj, { [BRAND]: true });\n const is = (value: unknown): value is T => typeof value === 'object' && value !== null && BRAND in (value as object);\n\n return { is, stamp };\n};\n\n// ─── DIRECTIVE RESULT ────────────────────────────────────────────────────────\n\nexport type DirectiveResult = {\n mount: (anchor: Comment, registerCleanup: (fn: () => void) => void) => void;\n};\n\nconst directiveBrand = makeBrand<DirectiveResult>('ore:directive');\n\n/**\n * Creates a registered DirectiveResult. All directive factories must use this\n * function — only objects created here pass `isDirectiveResult()`.\n */\nexport const createDirectiveResult = (mount: DirectiveResult['mount']): DirectiveResult =>\n directiveBrand.stamp({ mount });\n\nexport const isDirectiveResult = directiveBrand.is;\n\n// ─── SPREAD OBJECT ───────────────────────────────────────────────────────────\n// Returned by model() and similar helpers that apply multiple bindings to one element.\n\nexport type SpreadObject = {\n apply(el: HTMLElement, registerCleanup: (fn: () => void) => void): void;\n};\n\nconst spreadBrand = makeBrand<SpreadObject>('ore:spread');\n\n/**\n * Creates a registered SpreadObject. Used by model() to attach multiple bindings\n * (value sync + input event) to an element via a single template expression.\n */\nexport const createSpreadObject = (apply: SpreadObject['apply']): SpreadObject => spreadBrand.stamp({ apply });\n\nexport const isSpreadObject = spreadBrand.is;\n\n// ─── HTML RESULT ─────────────────────────────────────────────────────────────\n\n/**\n * The output of an `html` tagged template call.\n *\n * Each `html` call produces an independent fragment — there is no shared mutable\n * state between instances, so the same template can be safely rendered multiple\n * times (e.g. inside `each()`).\n */\nexport interface HTMLResult {\n /** The DOM fragment ready to insert into the document. Consumed on insertion. */\n readonly fragment: DocumentFragment;\n /** Wire up reactive effects to the fragment's nodes. Call after insertion. */\n apply(registerCleanup: (fn: () => void) => void): void;\n /**\n * Insert the fragment before `anchor` (or append to `parent` when no anchor)\n * and immediately wire up all reactive effects.\n *\n * This is the preferred single-step API — it is impossible to forget calling\n * `apply` separately. Use the lower-level `fragment` + `apply` only when you\n * need precise control over insertion (e.g. inside directive implementations).\n */\n mount(parent: ParentNode, anchor: Node | null, registerCleanup: (fn: () => void) => void): Node[];\n}\n\nconst htmlResultBrand = makeBrand<HTMLResult>('ore:html-result');\n\nexport const isHtmlResult = htmlResultBrand.is;\n\nexport function createHtmlResult(\n fragment: DocumentFragment,\n applyFn: (registerCleanup: (fn: () => void) => void) => void,\n): HTMLResult {\n const mount = (parent: ParentNode, anchor: Node | null, registerCleanup: (fn: () => void) => void): Node[] => {\n const nodes = Array.from(fragment.childNodes);\n\n parent.insertBefore(fragment, anchor);\n applyFn(registerCleanup);\n\n return nodes;\n };\n\n return htmlResultBrand.stamp({ apply: applyFn, fragment, mount });\n}\n"],"mappings":"0CAcA,SAAgB,GAAiC,CAC/C,OAAO,EAAiB,IAAI,CAC9B,CAwFA,IAAM,EAA+B,GAAgB,CACnD,IAAM,EAAQ,OAAO,IAAI,CAAG,EAI5B,MAAO,CAAE,GAFG,GAA+B,OAAO,GAAU,YAAY,GAAkB,KAAU,EAEvF,MAHE,GAAc,OAAO,OAAO,EAAK,EAAG,GAAQ,EAAK,CAAC,CAG9C,CACrB,EAQM,EAAiB,EAA2B,eAAe,EAMpD,EAAyB,GACpC,EAAe,MAAM,CAAE,OAAM,CAAC,EAEnB,EAAoB,EAAe,GAS1C,EAAc,EAAwB,YAAY,EAM3C,EAAsB,GAA+C,EAAY,MAAM,CAAE,OAAM,CAAC,EAEhG,EAAiB,EAAY,GA2BpC,EAAkB,EAAsB,iBAAiB,EAElD,EAAe,EAAgB,GAE5C,SAAgB,EACd,EACA,EACY,CAUZ,OAAO,EAAgB,MAAM,CAAE,MAAO,EAAS,WAAU,OAT1C,EAAoB,EAAqB,IAAsD,CAC5G,IAAM,EAAQ,MAAM,KAAK,EAAS,UAAU,EAK5C,OAHA,EAAO,aAAa,EAAU,CAAM,EACpC,EAAQ,CAAe,EAEhB,CACT,CAE+D,CAAC,CAClE"}
|
package/dist/types.cjs
DELETED
package/dist/types.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.cjs","names":[],"sources":["../src/types.ts"],"sourcesContent":["/**\n * Shared component phase and lifecycle event constants.\n * Extracted to a standalone module to break the circular dependency\n * between registration.ts and errors.ts.\n */\n\n// ─── ComponentPhase ───────────────────────────────────────────────────────────\n\nexport const ComponentPhase = {\n LOADING: 'loading',\n SETUP_DONE: 'setup_done',\n SETUP_RUNNING: 'setup_running',\n UNINITIALIZED: 'uninitialized',\n UNMOUNTED: 'unmounted',\n} as const;\n\nexport type ComponentPhase = (typeof ComponentPhase)[keyof typeof ComponentPhase];\n\n// ─── Lifecycle events ─────────────────────────────────────────────────────────\n\nexport const LIFECYCLE_EVENTS = {\n CONNECT: 'ore:connect',\n DISCONNECT: 'ore:disconnect',\n} as const;\n\nexport type LifecycleEventName = (typeof LIFECYCLE_EVENTS)[keyof typeof LIFECYCLE_EVENTS];\n"],"mappings":"AAQA,IAAa,EAAiB,CAC5B,QAAS,UACT,WAAY,aACZ,cAAe,gBACf,cAAe,gBACf,UAAW,WACb,EAMa,EAAmB,CAC9B,QAAS,cACT,WAAY,gBACd"}
|
package/dist/types.d.ts
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared component phase and lifecycle event constants.
|
|
3
|
-
* Extracted to a standalone module to break the circular dependency
|
|
4
|
-
* between registration.ts and errors.ts.
|
|
5
|
-
*/
|
|
6
|
-
export declare const ComponentPhase: {
|
|
7
|
-
readonly LOADING: "loading";
|
|
8
|
-
readonly SETUP_DONE: "setup_done";
|
|
9
|
-
readonly SETUP_RUNNING: "setup_running";
|
|
10
|
-
readonly UNINITIALIZED: "uninitialized";
|
|
11
|
-
readonly UNMOUNTED: "unmounted";
|
|
12
|
-
};
|
|
13
|
-
export type ComponentPhase = (typeof ComponentPhase)[keyof typeof ComponentPhase];
|
|
14
|
-
export declare const LIFECYCLE_EVENTS: {
|
|
15
|
-
readonly CONNECT: "ore:connect";
|
|
16
|
-
readonly DISCONNECT: "ore:disconnect";
|
|
17
|
-
};
|
|
18
|
-
export type LifecycleEventName = (typeof LIFECYCLE_EVENTS)[keyof typeof LIFECYCLE_EVENTS];
|
|
19
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,eAAO,MAAM,cAAc;;;;;;CAMjB,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,OAAO,cAAc,CAAC,CAAC;AAIlF,eAAO,MAAM,gBAAgB;;;CAGnB,CAAC;AAEX,MAAM,MAAM,kBAAkB,GAAG,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC"}
|
package/dist/types.js
DELETED
package/dist/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","names":[],"sources":["../src/types.ts"],"sourcesContent":["/**\n * Shared component phase and lifecycle event constants.\n * Extracted to a standalone module to break the circular dependency\n * between registration.ts and errors.ts.\n */\n\n// ─── ComponentPhase ───────────────────────────────────────────────────────────\n\nexport const ComponentPhase = {\n LOADING: 'loading',\n SETUP_DONE: 'setup_done',\n SETUP_RUNNING: 'setup_running',\n UNINITIALIZED: 'uninitialized',\n UNMOUNTED: 'unmounted',\n} as const;\n\nexport type ComponentPhase = (typeof ComponentPhase)[keyof typeof ComponentPhase];\n\n// ─── Lifecycle events ─────────────────────────────────────────────────────────\n\nexport const LIFECYCLE_EVENTS = {\n CONNECT: 'ore:connect',\n DISCONNECT: 'ore:disconnect',\n} as const;\n\nexport type LifecycleEventName = (typeof LIFECYCLE_EVENTS)[keyof typeof LIFECYCLE_EVENTS];\n"],"mappings":"AAQA,IAAa,EAAiB,CAC5B,QAAS,UACT,WAAY,aACZ,cAAe,gBACf,cAAe,gBACf,UAAW,WACb,EAMa,EAAmB,CAC9B,QAAS,cACT,WAAY,gBACd"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var e={prevent:e=>t=>{t.preventDefault(),e(t)},self:e=>t=>{t.target===t.currentTarget&&e(t)},stop:e=>t=>{t.stopPropagation(),e(t)}},t=(t,n)=>{let r=t;for(let t of n){let n=e[t];n&&(r=n(r))}let i={};return n.includes(`capture`)&&(i.capture=!0),n.includes(`once`)&&(i.once=!0),n.includes(`passive`)&&(i.passive=!0),{handler:r,...Object.keys(i).length?{options:i}:{}}};exports.applyModifiers=t;
|
|
2
|
-
//# sourceMappingURL=event-modifiers.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"event-modifiers.cjs","names":[],"sources":["../../src/utils/event-modifiers.ts"],"sourcesContent":["type EventHandler = (e: Event) => void;\n\nconst behaviorModifiers: Record<string, (h: EventHandler) => EventHandler> = {\n prevent: (h) => (e) => {\n e.preventDefault();\n h(e);\n },\n self: (h) => (e) => {\n if (e.target === e.currentTarget) h(e);\n },\n stop: (h) => (e) => {\n e.stopPropagation();\n h(e);\n },\n};\n\n/**\n * Apply event listener modifiers (prevent, stop, self, capture, once, passive).\n * Behavior modifiers wrap the handler; listener options are extracted separately.\n */\nexport const applyModifiers = (\n handler: EventHandler,\n modifiers: string[],\n): { handler: EventHandler; options?: AddEventListenerOptions } => {\n let wrappedHandler = handler;\n\n for (const modifier of modifiers) {\n const wrap = behaviorModifiers[modifier];\n\n if (wrap) wrappedHandler = wrap(wrappedHandler);\n }\n\n const options: AddEventListenerOptions = {};\n\n if (modifiers.includes('capture')) options.capture = true;\n\n if (modifiers.includes('once')) options.once = true;\n\n if (modifiers.includes('passive')) options.passive = true;\n\n return { handler: wrappedHandler, ...(Object.keys(options).length ? { options } : {}) };\n};\n"],"mappings":"AAEA,IAAM,EAAuE,CAC3E,QAAU,GAAO,GAAM,CACrB,EAAE,eAAe,EACjB,EAAE,CAAC,CACL,EACA,KAAO,GAAO,GAAM,CACd,EAAE,SAAW,EAAE,eAAe,EAAE,CAAC,CACvC,EACA,KAAO,GAAO,GAAM,CAClB,EAAE,gBAAgB,EAClB,EAAE,CAAC,CACL,CACF,EAMa,GACX,EACA,IACiE,CACjE,IAAI,EAAiB,EAErB,IAAK,IAAM,KAAY,EAAW,CAChC,IAAM,EAAO,EAAkB,GAE3B,IAAM,EAAiB,EAAK,CAAc,EAChD,CAEA,IAAM,EAAmC,CAAC,EAQ1C,OANI,EAAU,SAAS,SAAS,IAAG,EAAQ,QAAU,IAEjD,EAAU,SAAS,MAAM,IAAG,EAAQ,KAAO,IAE3C,EAAU,SAAS,SAAS,IAAG,EAAQ,QAAU,IAE9C,CAAE,QAAS,EAAgB,GAAI,OAAO,KAAK,CAAO,CAAC,CAAC,OAAS,CAAE,SAAQ,EAAI,CAAC,CAAG,CACxF"}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
type EventHandler = (e: Event) => void;
|
|
2
|
-
/**
|
|
3
|
-
* Apply event listener modifiers (prevent, stop, self, capture, once, passive).
|
|
4
|
-
* Behavior modifiers wrap the handler; listener options are extracted separately.
|
|
5
|
-
*/
|
|
6
|
-
export declare const applyModifiers: (handler: EventHandler, modifiers: string[]) => {
|
|
7
|
-
handler: EventHandler;
|
|
8
|
-
options?: AddEventListenerOptions;
|
|
9
|
-
};
|
|
10
|
-
export {};
|
|
11
|
-
//# sourceMappingURL=event-modifiers.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"event-modifiers.d.ts","sourceRoot":"","sources":["../../src/utils/event-modifiers.ts"],"names":[],"mappings":"AAAA,KAAK,YAAY,GAAG,CAAC,CAAC,EAAE,KAAK,KAAK,IAAI,CAAC;AAgBvC;;;GAGG;AACH,eAAO,MAAM,cAAc,GACzB,SAAS,YAAY,EACrB,WAAW,MAAM,EAAE,KAClB;IAAE,OAAO,EAAE,YAAY,CAAC;IAAC,OAAO,CAAC,EAAE,uBAAuB,CAAA;CAkB5D,CAAC"}
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
var e={prevent:e=>t=>{t.preventDefault(),e(t)},self:e=>t=>{t.target===t.currentTarget&&e(t)},stop:e=>t=>{t.stopPropagation(),e(t)}},t=(t,n)=>{let r=t;for(let t of n){let n=e[t];n&&(r=n(r))}let i={};return n.includes(`capture`)&&(i.capture=!0),n.includes(`once`)&&(i.once=!0),n.includes(`passive`)&&(i.passive=!0),{handler:r,...Object.keys(i).length?{options:i}:{}}};export{t as applyModifiers};
|
|
2
|
-
//# sourceMappingURL=event-modifiers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"event-modifiers.js","names":[],"sources":["../../src/utils/event-modifiers.ts"],"sourcesContent":["type EventHandler = (e: Event) => void;\n\nconst behaviorModifiers: Record<string, (h: EventHandler) => EventHandler> = {\n prevent: (h) => (e) => {\n e.preventDefault();\n h(e);\n },\n self: (h) => (e) => {\n if (e.target === e.currentTarget) h(e);\n },\n stop: (h) => (e) => {\n e.stopPropagation();\n h(e);\n },\n};\n\n/**\n * Apply event listener modifiers (prevent, stop, self, capture, once, passive).\n * Behavior modifiers wrap the handler; listener options are extracted separately.\n */\nexport const applyModifiers = (\n handler: EventHandler,\n modifiers: string[],\n): { handler: EventHandler; options?: AddEventListenerOptions } => {\n let wrappedHandler = handler;\n\n for (const modifier of modifiers) {\n const wrap = behaviorModifiers[modifier];\n\n if (wrap) wrappedHandler = wrap(wrappedHandler);\n }\n\n const options: AddEventListenerOptions = {};\n\n if (modifiers.includes('capture')) options.capture = true;\n\n if (modifiers.includes('once')) options.once = true;\n\n if (modifiers.includes('passive')) options.passive = true;\n\n return { handler: wrappedHandler, ...(Object.keys(options).length ? { options } : {}) };\n};\n"],"mappings":"AAEA,IAAM,EAAuE,CAC3E,QAAU,GAAO,GAAM,CACrB,EAAE,eAAe,EACjB,EAAE,CAAC,CACL,EACA,KAAO,GAAO,GAAM,CACd,EAAE,SAAW,EAAE,eAAe,EAAE,CAAC,CACvC,EACA,KAAO,GAAO,GAAM,CAClB,EAAE,gBAAgB,EAClB,EAAE,CAAC,CACL,CACF,EAMa,GACX,EACA,IACiE,CACjE,IAAI,EAAiB,EAErB,IAAK,IAAM,KAAY,EAAW,CAChC,IAAM,EAAO,EAAkB,GAE3B,IAAM,EAAiB,EAAK,CAAc,EAChD,CAEA,IAAM,EAAmC,CAAC,EAQ1C,OANI,EAAU,SAAS,SAAS,IAAG,EAAQ,QAAU,IAEjD,EAAU,SAAS,MAAM,IAAG,EAAQ,KAAO,IAE3C,EAAU,SAAS,SAAS,IAAG,EAAQ,QAAU,IAE9C,CAAE,QAAS,EAAgB,GAAI,OAAO,KAAK,CAAO,CAAC,CAAC,OAAS,CAAE,SAAQ,EAAI,CAAC,CAAG,CACxF"}
|