@raphy-js/dom 0.0.0-stage → 1.0.0-dev.88
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/LICENSE +202 -0
- package/README.md +187 -2
- package/dist/DOMBlueprintMaterializer-C-icNhvm.cjs +1 -0
- package/dist/DOMBlueprintMaterializer-CxzM_TX5.js +201 -0
- package/dist/FullDOMOperations-BOlf0_0L.js +2781 -0
- package/dist/FullDOMOperations-Dschwj33.cjs +1 -0
- package/dist/api/renderer.d.ts +12 -0
- package/dist/applicationIdentity-CHbuUlsE.cjs +1 -0
- package/dist/applicationIdentity-DjVgpsQq.js +11 -0
- package/dist/bind-BEmkQdaL.cjs +1 -0
- package/dist/bind-OakIMWpC.js +52 -0
- package/dist/binding/DOMValueWriter.d.ts +59 -0
- package/dist/binding/materializeComponentProps.d.ts +38 -0
- package/dist/binding/mountDOMBinding.d.ts +9 -0
- package/dist/binding/mountDOMProps.d.ts +22 -0
- package/dist/capture.cjs +1 -0
- package/dist/capture.d.ts +7 -0
- package/dist/capture.js +166 -0
- package/dist/channels-Bs8GHVWn.cjs +1 -0
- package/dist/channels-DqAQt-NH.js +33 -0
- package/dist/compact/hydration.cjs +1 -0
- package/dist/compact/hydration.d.ts +9 -0
- package/dist/compact/hydration.js +12 -0
- package/dist/compact/index.d.ts +19 -0
- package/dist/compact/targetRuntime.d.ts +1 -0
- package/dist/compact.cjs +1 -0
- package/dist/compact.js +34 -0
- package/dist/contracts/freezeGeneratedContract.d.ts +5 -0
- package/dist/contracts/manifest.json +25 -0
- package/dist/contracts/node.cjs +1 -0
- package/dist/contracts/node.contract.json +36889 -0
- package/dist/contracts/node.d.ts +6 -0
- package/dist/contracts/node.js +19 -0
- package/dist/contracts/stylesheet.cjs +1 -0
- package/dist/contracts/stylesheet.contract.json +11887 -0
- package/dist/contracts/stylesheet.d.ts +6 -0
- package/dist/contracts/stylesheet.js +22 -0
- package/dist/createDOMDataEventInput-B82pnIav.cjs +1 -0
- package/dist/createDOMDataEventInput-BDX50jhu.js +3010 -0
- package/dist/createDOMNodeRuntime-BHcsbeO1.cjs +1 -0
- package/dist/createDOMNodeRuntime-DIKOUQP7.js +3006 -0
- package/dist/createHydrationRenderer-C7srF-66.js +289 -0
- package/dist/createHydrationRenderer-DKybWTj4.cjs +1 -0
- package/dist/elementRef-D8Ir8tXA.cjs +1 -0
- package/dist/elementRef-YPBBElV9.js +32 -0
- package/dist/event/DOMEventHub.d.ts +303 -0
- package/dist/freezeGeneratedContract-0EZt85o4.js +10 -0
- package/dist/freezeGeneratedContract-g_Op1hGY.cjs +1 -0
- package/dist/hydration/HydrationEvents.d.ts +20 -0
- package/dist/hydration/HydrationSession.d.ts +107 -0
- package/dist/hydration/HydrationStream.d.ts +30 -0
- package/dist/hydration/activateHydration.d.ts +2 -0
- package/dist/hydration/createHydrationRenderer.d.ts +25 -0
- package/dist/hydration/index.d.ts +8 -0
- package/dist/hydration.cjs +1 -0
- package/dist/hydration.js +12 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.js +24 -0
- package/dist/interaction/clipboard.d.ts +2 -0
- package/dist/interaction/contextAction.d.ts +3 -0
- package/dist/interaction/contracts/node.cjs +1 -0
- package/dist/interaction/contracts/node.d.ts +15 -0
- package/dist/interaction/contracts/node.js +60 -0
- package/dist/interaction/dragDrop.d.ts +13 -0
- package/dist/interaction/focus.d.ts +4 -0
- package/dist/interaction/geometry.d.ts +39 -0
- package/dist/interaction/hover.d.ts +4 -0
- package/dist/interaction/index.d.ts +2 -0
- package/dist/interaction/interaction.d.ts +4 -0
- package/dist/interaction/internal/DOMInputModality.d.ts +20 -0
- package/dist/interaction/internal/DOMInteraction.types.d.ts +29 -0
- package/dist/interaction/internal/applicationIdentity.d.ts +3 -0
- package/dist/interaction/internal/dragDataTransfer.d.ts +4 -0
- package/dist/interaction/internal/solvePosition.d.ts +5 -0
- package/dist/interaction/keyboard.d.ts +3 -0
- package/dist/interaction/move.d.ts +3 -0
- package/dist/interaction/nativeDragDrop.d.ts +18 -0
- package/dist/interaction/outside.d.ts +3 -0
- package/dist/interaction/press.d.ts +3 -0
- package/dist/interaction/profile.cjs +1 -0
- package/dist/interaction/profile.d.ts +2 -0
- package/dist/interaction/profile.js +48 -0
- package/dist/interaction/rovingFocus.d.ts +4 -0
- package/dist/interaction/runtime.d.ts +7 -0
- package/dist/interaction/textEditing.d.ts +4 -0
- package/dist/interaction.cjs +1 -0
- package/dist/interaction.js +1603 -0
- package/dist/internal/dev.d.ts +20 -0
- package/dist/motion/channels.d.ts +5 -0
- package/dist/motion/index.d.ts +8 -0
- package/dist/motion-scroll/index.d.ts +19 -0
- package/dist/motion-scroll.cjs +1 -0
- package/dist/motion-scroll.js +169 -0
- package/dist/motion.cjs +1 -0
- package/dist/motion.js +187 -0
- package/dist/operations.cjs +1 -0
- package/dist/operations.d.ts +3 -0
- package/dist/operations.js +10 -0
- package/dist/profile/DOMProfile.d.ts +4 -0
- package/dist/profile/index.d.ts +1 -0
- package/dist/profile.cjs +1 -0
- package/dist/profile.js +23 -0
- package/dist/renderer/DOMEffectScope.d.ts +13 -0
- package/dist/renderer/DOMPresentation.d.ts +8 -0
- package/dist/renderer/DOMRenderer.d.ts +35 -0
- package/dist/renderer/DOMRenderer.types.d.ts +12 -0
- package/dist/renderer/DOMRendererExtension.types.d.ts +33 -0
- package/dist/renderer/DOMRuntimeProfile.d.ts +15 -0
- package/dist/renderer/DOMTargetRuntime.d.ts +1 -0
- package/dist/renderer/createDOMTargetRuntime.d.ts +3 -0
- package/dist/renderer/installAuxiliaryViews.d.ts +8 -0
- package/dist/renderer/installDOMRendererExtensions.d.ts +10 -0
- package/dist/renderer/resolveDOMMountTarget.d.ts +7 -0
- package/dist/renderer-4Wbid5nE.js +30 -0
- package/dist/renderer-DHK3lLG-.cjs +1 -0
- package/dist/resolveDOMMountTarget-C75JWc5x.cjs +1 -0
- package/dist/resolveDOMMountTarget-D944H05N.js +19 -0
- package/dist/runtime.cjs +1 -0
- package/dist/runtime.d.ts +21 -0
- package/dist/runtime.js +25 -0
- package/dist/serialization.cjs +1 -0
- package/dist/serialization.d.ts +4 -0
- package/dist/serialization.js +118 -0
- package/dist/stylesheet/DOMStyleManager.d.ts +95 -0
- package/dist/stylesheet/DOMStyleReferenceName.d.ts +2 -0
- package/dist/stylesheet/DOMStylesheetRuntime.d.ts +25 -0
- package/dist/stylesheet/acquireInstanceStylesheets.d.ts +4 -0
- package/dist/stylesheet/scopeDOMSelector.d.ts +2 -0
- package/dist/stylesheet/serializeDOMStyleValue.d.ts +3 -0
- package/dist/targetRuntime-C67QmOgE.cjs +1 -0
- package/dist/targetRuntime-C_OdmS5w.js +5 -0
- package/dist/template/AdvancedDOMMaterializer.d.ts +14 -0
- package/dist/template/AsyncDOMMaterializer.d.ts +4 -0
- package/dist/template/BoundaryDOMMaterializer.d.ts +10 -0
- package/dist/template/DOMHostPlan.d.ts +4 -0
- package/dist/template/DOMNode.types.d.ts +192 -0
- package/dist/template/DOMNodeRuntime.d.ts +1 -0
- package/dist/template/binding/DOMBinding.types.d.ts +44 -0
- package/dist/template/binding/bind.d.ts +16 -0
- package/dist/template/blueprint/DOMBlueprintAddressing.d.ts +23 -0
- package/dist/template/blueprint/DOMBlueprintMaterializer.d.ts +3 -0
- package/dist/template/blueprint/DOMBlueprintMaterializer.types.d.ts +15 -0
- package/dist/template/blueprint/DOMHostBlueprint.d.ts +102 -0
- package/dist/template/blueprint/DOMHostBlueprintCache.d.ts +86 -0
- package/dist/template/blueprint/createDOMDataEventInput.d.ts +5 -0
- package/dist/template/blueprint/mountDOMHostBlueprint.d.ts +45 -0
- package/dist/template/createDOMNodeRuntime.d.ts +3 -0
- package/dist/template/each/mountEach.d.ts +5 -0
- package/dist/template/each/mountPureEach.d.ts +22 -0
- package/dist/template/error/DOMInvocation.d.ts +58 -0
- package/dist/template/error/DOMOperationError.d.ts +25 -0
- package/dist/template/html/DOMRawHtmlNode.types.d.ts +21 -0
- package/dist/template/html/rawHtml.d.ts +5 -0
- package/dist/template/keep-alive/DOMKeepAliveNode.types.d.ts +10 -0
- package/dist/template/keep-alive/keepAlive.d.ts +4 -0
- package/dist/template/mount/DOMMountTransaction.d.ts +63 -0
- package/dist/template/mountNode.d.ts +173 -0
- package/dist/template/normalizeChildren.d.ts +5 -0
- package/dist/template/operations/DOMOperations.d.ts +56 -0
- package/dist/template/operations/FullDOMOperations.d.ts +6 -0
- package/dist/template/page/DOMHead.d.ts +7 -0
- package/dist/template/page/PageNodePlan.d.ts +31 -0
- package/dist/template/ref/DOMElementRef.types.d.ts +7 -0
- package/dist/template/ref/componentRefGuard.d.ts +6 -0
- package/dist/template/ref/elementRef.d.ts +9 -0
- package/dist/template/structural/range/DOMRange.d.ts +145 -0
- package/dist/template/teleport/DOMTeleportNode.types.d.ts +8 -0
- package/dist/template/teleport/teleport.d.ts +4 -0
- package/dist/template/transition/DOMTransitionCoordinator.d.ts +32 -0
- package/dist/template/transition/DOMTransitionNode.types.d.ts +30 -0
- package/dist/template/transition/transition.d.ts +4 -0
- package/dist/template/value/DOMValueDescriptor.types.d.ts +34 -0
- package/dist/template/value/valueDescriptors.d.ts +13 -0
- package/package.json +157 -4
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* False only when the consumer resolves `process.env.NODE_ENV` to `'production'`.
|
|
3
|
+
*
|
|
4
|
+
* The expression is emitted into dist verbatim: an application bundler replaces
|
|
5
|
+
* it with a literal and removes every `DEV ? a : b` development branch, while
|
|
6
|
+
* Node and test runners evaluate it once at module load.
|
|
7
|
+
*
|
|
8
|
+
* Dist therefore requires either a bundler that defines `process.env.NODE_ENV`
|
|
9
|
+
* or a runtime with a Node-like `process` global; anywhere else the read throws
|
|
10
|
+
* a ReferenceError at module load. The read is deliberately not guarded by
|
|
11
|
+
* `typeof process`: once a bundler has replaced the read, a guard is all that
|
|
12
|
+
* is left to decide the mode at run time, so a browser would run a production
|
|
13
|
+
* bundle in development mode (`||` guard) or a development bundle in production
|
|
14
|
+
* mode (`&&` guard). The distribution smoke test pins this requirement.
|
|
15
|
+
*
|
|
16
|
+
* Only development-time hardening that has no observable effect on correct
|
|
17
|
+
* programs may depend on this flag. Validation of user input, liveness checks
|
|
18
|
+
* and security checks never do.
|
|
19
|
+
*/
|
|
20
|
+
export declare const DEV: boolean;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export type DOMMotionChannel = 'paint.opacity' | 'transform.scale' | 'transform.translateX' | 'transform.translateY';
|
|
2
|
+
/** Общий mapping конечного и driven Motion в отдельный WAAPI effect layer. */
|
|
3
|
+
export declare function requireDOMMotionChannel(channel: string): DOMMotionChannel;
|
|
4
|
+
export declare function createDOMMotionFrame(channel: DOMMotionChannel, offset: number, value: number, easing?: string): Keyframe;
|
|
5
|
+
export declare function isDOMTranslation(channel: DOMMotionChannel): boolean;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MotionAdapter, MotionTimelineAdapter } from '@raphy-js/motion';
|
|
2
|
+
/**
|
|
3
|
+
* Необязательный адаптер Web Animations. Он не меняет inline styles:
|
|
4
|
+
* DOM Style владеет авторскими стилями, а WAAPI — временным слоем эффекта.
|
|
5
|
+
*/
|
|
6
|
+
export declare const DOM_MOTION_ADAPTER: MotionAdapter<Element>;
|
|
7
|
+
/** Explicit-time DOM effects. Author Style remains untouched. */
|
|
8
|
+
export declare const DOM_MOTION_TIMELINE_ADAPTER: MotionTimelineAdapter<Element>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { TargetRef } from '@raphy-js/core';
|
|
2
|
+
import { ScrollMetrics } from '@raphy-js/interaction/scroll';
|
|
3
|
+
import { ScrollMotionAdapter } from '@raphy-js/motion/scroll';
|
|
4
|
+
/** Использует уже нормализованный Interaction offset, включая RTL. */
|
|
5
|
+
export declare function scrollProgressValue(metrics: ScrollMetrics, axis: 'x' | 'y'): number;
|
|
6
|
+
/** 0 при входе в viewport scroller, 1 при выходе из него. */
|
|
7
|
+
export declare function viewProgressValue(subject: Readonly<{
|
|
8
|
+
x: number;
|
|
9
|
+
y: number;
|
|
10
|
+
width: number;
|
|
11
|
+
height: number;
|
|
12
|
+
}>, scroller: Readonly<{
|
|
13
|
+
x: number;
|
|
14
|
+
y: number;
|
|
15
|
+
width: number;
|
|
16
|
+
height: number;
|
|
17
|
+
}>, axis: 'x' | 'y', direction: 'ltr' | 'rtl'): number;
|
|
18
|
+
/** Опциональный DOM исполнитель: native timeline либо bounded JS fallback. */
|
|
19
|
+
export declare const DOM_SCROLL_MOTION_ADAPTER: ScrollMotionAdapter<TargetRef>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("@raphy-js/core"),u=require("@raphy-js/interaction/geometry"),S=require("@raphy-js/interaction/scroll"),A=require("./applicationIdentity-CHbuUlsE.cjs"),M=require("./channels-Bs8GHVWn.cjs");function j(e){if(!D.isTargetRef(e.scroller)||e.kind==="view"&&!D.isTargetRef(e.subject))throw new TypeError("[RaphyDOMMotion] Scroll progress requires mounted TargetRefs.");return e}function x(e){const t=e.current;if(t===null||t.nodeType!==1)throw new TypeError("[RaphyDOMMotion] Scroll binding requires a mounted TargetRef.");return t}function b(e){return Math.max(0,Math.min(1,e))}function k(e,t){const n=t==="x"?e.width-e.viewportWidth:e.height-e.viewportHeight;return n<=0?0:b((t==="x"?e.x:e.y)/n)}function q(e,t,n,i){const r=n==="x"?e.width+t.width:e.height+t.height;if(r<=0)return 0;if(n==="x"&&i==="rtl")return b((e.x+e.width-t.x)/r);const a=n==="x"?e.x:e.y,c=n==="x"?t.x+t.width:t.y+t.height;return b((c-a)/r)}function C(e){const t=S.getScrollMetrics(e.scroller);return e.kind==="scroll"?k(t,e.axis):q(u.measureTarget(e.subject),u.measureTarget(e.scroller),e.axis,t.direction)}function F(e,t){const n=S.getScrollMetrics(t.scroller);u.measureTarget(t.scroller),u.measureTarget(e),t.kind==="view"&&u.measureTarget(t.subject);const i=[e,t.scroller,...t.kind==="view"?[t.subject]:[]].map(s=>A.interactionApplication(s));if(i.some(s=>s===void 0||s!==i[0]))throw new Error("[RaphyDOMMotion] Target and progress refs must belong to one application.");const r=x(e),a=x(t.scroller),c=t.kind==="view"?x(t.subject):void 0;if(r.ownerDocument!==a.ownerDocument||c&&c.ownerDocument!==a.ownerDocument)throw new Error("[RaphyDOMMotion] Scroll refs must share a document.");return{target:r,scroller:a,subject:c,metrics:n}}function V(e){return Object.keys(e[0]).filter(n=>n!=="at").sort().map(n=>{const i=M.requireDOMMotionChannel(n);return{channel:i,keyframes:e.map(r=>M.createDOMMotionFrame(i,r.at,r[n]))}})}function _(e,t,n,i,r){if(t.axis==="x"&&r.direction==="rtl")return;if(t.kind==="scroll"){const s=e.ScrollTimeline;return s?new s({source:n,axis:t.axis}):void 0}const a=e.ViewTimeline;if(!a||!i||i.parentElement!==n)return;const c=e.getComputedStyle(n)[t.axis==="x"?"overflowX":"overflowY"];if(!(!/^(?:auto|scroll)$/.test(c)||(t.axis==="x"?r.width<=r.viewportWidth:r.height<=r.viewportHeight)))return new a({subject:i,axis:t.axis})}const L=Object.freeze({resolve(e){return D.isTargetRef(e)&&e.current!==null?e:void 0},bind(e,t,n){const i=V(t),r=j(n),{target:a,scroller:c,subject:s,metrics:P}=F(e,r),f=a.ownerDocument.defaultView;if(!f)throw new Error("[RaphyDOMMotion] Scroll binding requires a browsing context.");if(typeof a.animate!="function")throw new TypeError("[RaphyDOMMotion] Element.animate() is unavailable.");if(f.matchMedia?.("(prefers-reduced-motion: reduce)").matches){let o;return{ended:new Promise(w=>{o=w}),dispose:o}}const v=[],g=[];let h,m=!1,R,T;const O=new Promise((o,p)=>{R=o,T=p}),y=()=>{h!==void 0&&f.cancelAnimationFrame(h),h=void 0;for(const o of g.splice(0))try{o()}catch{}for(const o of v.splice(0))try{o.cancel()}catch{}},E=()=>{m||(m=!0,y(),R())};try{let o;try{o=_(f,r,c,s,P)}catch{}if(o)try{for(const l of i){const d=a.animate(l.keyframes,{fill:"both",composite:M.isDOMTranslation(l.channel)?"add":"replace",timeline:o});if(d.finished.catch(()=>{}),v.push(d),d.timeline!==o)throw new TypeError("[RaphyDOMMotion] Browser ignored the scroll timeline.")}return Object.freeze({ended:O,dispose:E})}catch{y()}if(typeof f.requestAnimationFrame!="function")throw new TypeError("[RaphyDOMMotion] Scroll fallback requires requestAnimationFrame.");for(const l of i){const d=a.animate(l.keyframes,{duration:1e3,fill:"both",composite:M.isDOMTranslation(l.channel)?"add":"replace"});d.finished.catch(()=>{}),v.push(d),d.pause()}const p=()=>{if(!m)try{const l=C(r)*1e3;for(const d of v)d.currentTime=l}catch(l){m=!0,y(),T(l)}},w=()=>{m||h!==void 0||(h=f.requestAnimationFrame(()=>{h=void 0,p()}))};return p(),g.push(S.observeScroll(r.scroller,w)),g.push(u.observeGeometry(r.scroller,w)),r.kind==="view"&&g.push(u.observeGeometry(r.subject,w)),Object.freeze({ended:O,dispose:E})}catch(o){throw m=!0,y(),O.catch(()=>{}),T(o),o}}});exports.DOM_SCROLL_MOTION_ADAPTER=L;exports.scrollProgressValue=k;exports.viewProgressValue=q;
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { isTargetRef as D } from "@raphy-js/core";
|
|
2
|
+
import { observeGeometry as E, measureTarget as w } from "@raphy-js/interaction/geometry";
|
|
3
|
+
import { observeScroll as j, getScrollMetrics as R } from "@raphy-js/interaction/scroll";
|
|
4
|
+
import { i as A } from "./applicationIdentity-DjVgpsQq.js";
|
|
5
|
+
import { i as S, r as F, c as P } from "./channels-DqAQt-NH.js";
|
|
6
|
+
function C(e) {
|
|
7
|
+
if (!D(e.scroller) || e.kind === "view" && !D(e.subject))
|
|
8
|
+
throw new TypeError("[RaphyDOMMotion] Scroll progress requires mounted TargetRefs.");
|
|
9
|
+
return e;
|
|
10
|
+
}
|
|
11
|
+
function O(e) {
|
|
12
|
+
const t = e.current;
|
|
13
|
+
if (t === null || t.nodeType !== 1)
|
|
14
|
+
throw new TypeError("[RaphyDOMMotion] Scroll binding requires a mounted TargetRef.");
|
|
15
|
+
return t;
|
|
16
|
+
}
|
|
17
|
+
function T(e) {
|
|
18
|
+
return Math.max(0, Math.min(1, e));
|
|
19
|
+
}
|
|
20
|
+
function V(e, t) {
|
|
21
|
+
const n = t === "x" ? e.width - e.viewportWidth : e.height - e.viewportHeight;
|
|
22
|
+
return n <= 0 ? 0 : T((t === "x" ? e.x : e.y) / n);
|
|
23
|
+
}
|
|
24
|
+
function z(e, t, n, i) {
|
|
25
|
+
const r = n === "x" ? e.width + t.width : e.height + t.height;
|
|
26
|
+
if (r <= 0)
|
|
27
|
+
return 0;
|
|
28
|
+
if (n === "x" && i === "rtl")
|
|
29
|
+
return T((e.x + e.width - t.x) / r);
|
|
30
|
+
const a = n === "x" ? e.x : e.y, c = n === "x" ? t.x + t.width : t.y + t.height;
|
|
31
|
+
return T((c - a) / r);
|
|
32
|
+
}
|
|
33
|
+
function _(e) {
|
|
34
|
+
const t = R(e.scroller);
|
|
35
|
+
return e.kind === "scroll" ? V(t, e.axis) : z(
|
|
36
|
+
w(e.subject),
|
|
37
|
+
w(e.scroller),
|
|
38
|
+
e.axis,
|
|
39
|
+
t.direction
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
function H(e, t) {
|
|
43
|
+
const n = R(t.scroller);
|
|
44
|
+
w(t.scroller), w(e), t.kind === "view" && w(t.subject);
|
|
45
|
+
const i = [e, t.scroller, ...t.kind === "view" ? [t.subject] : []].map((s) => A(s));
|
|
46
|
+
if (i.some((s) => s === void 0 || s !== i[0]))
|
|
47
|
+
throw new Error("[RaphyDOMMotion] Target and progress refs must belong to one application.");
|
|
48
|
+
const r = O(e), a = O(t.scroller), c = t.kind === "view" ? O(t.subject) : void 0;
|
|
49
|
+
if (r.ownerDocument !== a.ownerDocument || c && c.ownerDocument !== a.ownerDocument)
|
|
50
|
+
throw new Error("[RaphyDOMMotion] Scroll refs must share a document.");
|
|
51
|
+
return { target: r, scroller: a, subject: c, metrics: n };
|
|
52
|
+
}
|
|
53
|
+
function L(e) {
|
|
54
|
+
return Object.keys(e[0]).filter((n) => n !== "at").sort().map((n) => {
|
|
55
|
+
const i = F(n);
|
|
56
|
+
return {
|
|
57
|
+
channel: i,
|
|
58
|
+
keyframes: e.map((r) => P(i, r.at, r[n]))
|
|
59
|
+
};
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function W(e, t, n, i, r) {
|
|
63
|
+
if (t.axis === "x" && r.direction === "rtl")
|
|
64
|
+
return;
|
|
65
|
+
if (t.kind === "scroll") {
|
|
66
|
+
const s = e.ScrollTimeline;
|
|
67
|
+
return s ? new s({ source: n, axis: t.axis }) : void 0;
|
|
68
|
+
}
|
|
69
|
+
const a = e.ViewTimeline;
|
|
70
|
+
if (!a || !i || i.parentElement !== n)
|
|
71
|
+
return;
|
|
72
|
+
const c = e.getComputedStyle(n)[t.axis === "x" ? "overflowX" : "overflowY"];
|
|
73
|
+
if (!(!/^(?:auto|scroll)$/.test(c) || (t.axis === "x" ? r.width <= r.viewportWidth : r.height <= r.viewportHeight)))
|
|
74
|
+
return new a({ subject: i, axis: t.axis });
|
|
75
|
+
}
|
|
76
|
+
const Y = Object.freeze({
|
|
77
|
+
resolve(e) {
|
|
78
|
+
return D(e) && e.current !== null ? e : void 0;
|
|
79
|
+
},
|
|
80
|
+
bind(e, t, n) {
|
|
81
|
+
const i = L(t), r = C(n), { target: a, scroller: c, subject: s, metrics: q } = H(e, r), f = a.ownerDocument.defaultView;
|
|
82
|
+
if (!f)
|
|
83
|
+
throw new Error("[RaphyDOMMotion] Scroll binding requires a browsing context.");
|
|
84
|
+
if (typeof a.animate != "function")
|
|
85
|
+
throw new TypeError("[RaphyDOMMotion] Element.animate() is unavailable.");
|
|
86
|
+
if (f.matchMedia?.("(prefers-reduced-motion: reduce)").matches) {
|
|
87
|
+
let o;
|
|
88
|
+
return { ended: new Promise((p) => {
|
|
89
|
+
o = p;
|
|
90
|
+
}), dispose: o };
|
|
91
|
+
}
|
|
92
|
+
const v = [], y = [];
|
|
93
|
+
let h, m = !1, b, M;
|
|
94
|
+
const x = new Promise((o, u) => {
|
|
95
|
+
b = o, M = u;
|
|
96
|
+
}), g = () => {
|
|
97
|
+
h !== void 0 && f.cancelAnimationFrame(h), h = void 0;
|
|
98
|
+
for (const o of y.splice(0))
|
|
99
|
+
try {
|
|
100
|
+
o();
|
|
101
|
+
} catch {
|
|
102
|
+
}
|
|
103
|
+
for (const o of v.splice(0))
|
|
104
|
+
try {
|
|
105
|
+
o.cancel();
|
|
106
|
+
} catch {
|
|
107
|
+
}
|
|
108
|
+
}, k = () => {
|
|
109
|
+
m || (m = !0, g(), b());
|
|
110
|
+
};
|
|
111
|
+
try {
|
|
112
|
+
let o;
|
|
113
|
+
try {
|
|
114
|
+
o = W(f, r, c, s, q);
|
|
115
|
+
} catch {
|
|
116
|
+
}
|
|
117
|
+
if (o)
|
|
118
|
+
try {
|
|
119
|
+
for (const l of i) {
|
|
120
|
+
const d = a.animate(l.keyframes, {
|
|
121
|
+
fill: "both",
|
|
122
|
+
composite: S(l.channel) ? "add" : "replace",
|
|
123
|
+
timeline: o
|
|
124
|
+
});
|
|
125
|
+
if (d.finished.catch(() => {
|
|
126
|
+
}), v.push(d), d.timeline !== o)
|
|
127
|
+
throw new TypeError("[RaphyDOMMotion] Browser ignored the scroll timeline.");
|
|
128
|
+
}
|
|
129
|
+
return Object.freeze({ ended: x, dispose: k });
|
|
130
|
+
} catch {
|
|
131
|
+
g();
|
|
132
|
+
}
|
|
133
|
+
if (typeof f.requestAnimationFrame != "function")
|
|
134
|
+
throw new TypeError("[RaphyDOMMotion] Scroll fallback requires requestAnimationFrame.");
|
|
135
|
+
for (const l of i) {
|
|
136
|
+
const d = a.animate(l.keyframes, {
|
|
137
|
+
duration: 1e3,
|
|
138
|
+
fill: "both",
|
|
139
|
+
composite: S(l.channel) ? "add" : "replace"
|
|
140
|
+
});
|
|
141
|
+
d.finished.catch(() => {
|
|
142
|
+
}), v.push(d), d.pause();
|
|
143
|
+
}
|
|
144
|
+
const u = () => {
|
|
145
|
+
if (!m)
|
|
146
|
+
try {
|
|
147
|
+
const l = _(r) * 1e3;
|
|
148
|
+
for (const d of v)
|
|
149
|
+
d.currentTime = l;
|
|
150
|
+
} catch (l) {
|
|
151
|
+
m = !0, g(), M(l);
|
|
152
|
+
}
|
|
153
|
+
}, p = () => {
|
|
154
|
+
m || h !== void 0 || (h = f.requestAnimationFrame(() => {
|
|
155
|
+
h = void 0, u();
|
|
156
|
+
}));
|
|
157
|
+
};
|
|
158
|
+
return u(), y.push(j(r.scroller, p)), y.push(E(r.scroller, p)), r.kind === "view" && y.push(E(r.subject, p)), Object.freeze({ ended: x, dispose: k });
|
|
159
|
+
} catch (o) {
|
|
160
|
+
throw m = !0, g(), x.catch(() => {
|
|
161
|
+
}), M(o), o;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
export {
|
|
166
|
+
Y as DOM_SCROLL_MOTION_ADAPTER,
|
|
167
|
+
V as scrollProgressValue,
|
|
168
|
+
z as viewProgressValue
|
|
169
|
+
};
|
package/dist/motion.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const D=require("@raphy-js/core"),T=require("./elementRef-D8Ir8tXA.cjs"),m=require("./channels-Bs8GHVWn.cjs"),y={linear:"linear","in-cubic":"cubic-bezier(0.3333333333333333, 0, 0.6666666666666666, 0)","out-cubic":"cubic-bezier(0.3333333333333333, 1, 0.6666666666666666, 1)","in-out-cubic":"cubic-bezier(0.65, 0, 0.35, 1)"},p=Object.freeze({resolve(e){return T.isDOMElementRef(e)?e.current??void 0:D.isTargetRef(e)?M(e.current)?e.current:void 0:M(e)?e:void 0},play(e,s,r){return g(e,s,r.duration)}});function M(e){return typeof e=="object"&&e!==null&&e.nodeType===1}function g(e,s,r){if(!Number.isFinite(r)||r<0)throw new RangeError("[RaphyDOMMotion] Motion duration must be a finite non-negative number.");const o=new Map;for(const n of s){const t=m.requireDOMMotionChannel(n.channel);O(n,r);const f=o.get(t);f===void 0?o.set(t,[n]):f.push(n)}if(e.ownerDocument.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches)return{cancel(){},finished:Promise.resolve()};if(typeof e.animate!="function")throw new TypeError("[RaphyDOMMotion] Element.animate() is unavailable on this target.");const a=[];try{for(const[n,t]of o){t.sort((d,E)=>d.start-E.start),b(t);const f=t[0].start,l=r-f;if(l<=0)throw new RangeError("[RaphyDOMMotion] A channel must have positive time after its initial delay.");const h=v(n,t,f,l);a.push(e.animate(h,{composite:m.isDOMTranslation(n)?"add":"replace",delay:f,duration:l,fill:"forwards"}))}a.length===0&&r>0&&a.push(e.animate([],{duration:r}))}catch(n){for(const t of a){try{t.cancel()}catch{}t.finished.catch(()=>{})}throw n}let c=!1,i=!1;const u=Promise.all(a.map(n=>n.finished)).then(()=>{if(!i){i=!0;for(const n of a)n.cancel()}},n=>{if(!(c&&R(n))){if(!i){i=!0;for(const t of a)try{t.cancel()}catch{}}throw n}});return{cancel(){if(i)return;i=!0,c=!0;let n;for(const t of a)try{t.cancel()}catch(f){n??=f}if(n!==void 0)throw n},finished:u}}function O(e,s){if(!Number.isFinite(e.start)||!Number.isFinite(e.duration)||e.start<0||e.duration<=0||e.start+e.duration>s+w(s))throw new RangeError("[RaphyDOMMotion] Clip timing is outside the motion duration.");if(!(e.easing in y))throw new TypeError(`[RaphyDOMMotion] Unsupported motion easing "${e.easing}".`);if(e.keyframes.length<2||e.keyframes[0]?.at!==0||e.keyframes.at(-1)?.at!==1)throw new TypeError("[RaphyDOMMotion] Clips require normalized keyframes at 0 and 1.");let r=-1;for(const o of e.keyframes){if(!Number.isFinite(o.at)||o.at<=r||!Number.isFinite(o.value))throw new TypeError("[RaphyDOMMotion] Clip keyframes must be finite and strictly ordered.");if(e.channel==="paint.opacity"&&(o.value<0||o.value>1))throw new RangeError("[RaphyDOMMotion] Opacity must be between 0 and 1.");r=o.at}}function b(e){for(let s=1;s<e.length;s++){const r=e[s-1],o=r.start+r.duration;if(e[s].start<o-w(o))throw new Error(`[RaphyDOMMotion] Clips on channel "${r.channel}" overlap.`)}}function v(e,s,r,o){const a=[],i=s[0].keyframes[0].value;let u=r,n=i;for(const t of s){t.start>u&&a.length>0&&a.push(m.createDOMMotionFrame(e,(t.start-r)/o,n,"linear"));for(let f=0;f<t.keyframes.length;f++){const l=t.keyframes[f],h=Math.min(1,(t.start+l.at*t.duration-r)/o),d=f===t.keyframes.length-1?"linear":y[t.easing];a.push(m.createDOMMotionFrame(e,h,l.value,d))}u=t.start+t.duration,n=t.keyframes.at(-1).value}return u<r+o&&a.push(m.createDOMMotionFrame(e,1,n,"linear")),a}function R(e){return typeof e=="object"&&e!==null&&"name"in e&&e.name==="AbortError"}function w(e){return Math.max(1e-9,Number.EPSILON*Math.max(1,Math.abs(e))*8)}const N=Object.freeze({resolve:e=>p.resolve(e),bind(e,s,r){const o=new Map;for(const c of s){O(c,r.duration);const i=m.requireDOMMotionChannel(c.channel),u=o.get(i)??[];u.push(c),o.set(i,u)}const a=[];try{for(const[c,i]of o){i.sort((f,l)=>f.start-l.start),b(i);const u=i[0].start,n=r.duration-u,t=e.animate(v(c,i,u,n),{duration:n,delay:u,fill:"both",composite:m.isDOMTranslation(c)?"add":"replace"});a.push(t),t.finished.catch(()=>{}),t.pause(),t.currentTime=0}}catch(c){for(const i of a)i.cancel();throw c}return{setTime(c){for(const i of a)i.currentTime=c},dispose(){for(const c of a)c.cancel()}}}});exports.DOM_MOTION_ADAPTER=p;exports.DOM_MOTION_TIMELINE_ADAPTER=N;
|
package/dist/motion.js
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
import { isTargetRef as D } from "@raphy-js/core";
|
|
2
|
+
import { i as R } from "./elementRef-YPBBElV9.js";
|
|
3
|
+
import { r as y, i as M, c as d } from "./channels-DqAQt-NH.js";
|
|
4
|
+
const b = {
|
|
5
|
+
linear: "linear",
|
|
6
|
+
"in-cubic": "cubic-bezier(0.3333333333333333, 0, 0.6666666666666666, 0)",
|
|
7
|
+
"out-cubic": "cubic-bezier(0.3333333333333333, 1, 0.6666666666666666, 1)",
|
|
8
|
+
"in-out-cubic": "cubic-bezier(0.65, 0, 0.35, 1)"
|
|
9
|
+
}, T = Object.freeze({
|
|
10
|
+
resolve(e) {
|
|
11
|
+
return R(e) ? e.current ?? void 0 : D(e) ? p(e.current) ? e.current : void 0 : p(e) ? e : void 0;
|
|
12
|
+
},
|
|
13
|
+
play(e, s, r) {
|
|
14
|
+
return N(e, s, r.duration);
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
function p(e) {
|
|
18
|
+
return typeof e == "object" && e !== null && e.nodeType === 1;
|
|
19
|
+
}
|
|
20
|
+
function N(e, s, r) {
|
|
21
|
+
if (!Number.isFinite(r) || r < 0)
|
|
22
|
+
throw new RangeError("[RaphyDOMMotion] Motion duration must be a finite non-negative number.");
|
|
23
|
+
const o = /* @__PURE__ */ new Map();
|
|
24
|
+
for (const n of s) {
|
|
25
|
+
const t = y(n.channel);
|
|
26
|
+
v(n, r);
|
|
27
|
+
const f = o.get(t);
|
|
28
|
+
f === void 0 ? o.set(t, [n]) : f.push(n);
|
|
29
|
+
}
|
|
30
|
+
if (e.ownerDocument.defaultView?.matchMedia?.("(prefers-reduced-motion: reduce)").matches)
|
|
31
|
+
return { cancel() {
|
|
32
|
+
}, finished: Promise.resolve() };
|
|
33
|
+
if (typeof e.animate != "function")
|
|
34
|
+
throw new TypeError("[RaphyDOMMotion] Element.animate() is unavailable on this target.");
|
|
35
|
+
const i = [];
|
|
36
|
+
try {
|
|
37
|
+
for (const [n, t] of o) {
|
|
38
|
+
t.sort((h, g) => h.start - g.start), w(t);
|
|
39
|
+
const f = t[0].start, l = r - f;
|
|
40
|
+
if (l <= 0)
|
|
41
|
+
throw new RangeError("[RaphyDOMMotion] A channel must have positive time after its initial delay.");
|
|
42
|
+
const m = O(n, t, f, l);
|
|
43
|
+
i.push(e.animate(m, {
|
|
44
|
+
composite: M(n) ? "add" : "replace",
|
|
45
|
+
delay: f,
|
|
46
|
+
duration: l,
|
|
47
|
+
fill: "forwards"
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
i.length === 0 && r > 0 && i.push(e.animate([], { duration: r }));
|
|
51
|
+
} catch (n) {
|
|
52
|
+
for (const t of i) {
|
|
53
|
+
try {
|
|
54
|
+
t.cancel();
|
|
55
|
+
} catch {
|
|
56
|
+
}
|
|
57
|
+
t.finished.catch(() => {
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
throw n;
|
|
61
|
+
}
|
|
62
|
+
let c = !1, a = !1;
|
|
63
|
+
const u = Promise.all(i.map((n) => n.finished)).then(
|
|
64
|
+
() => {
|
|
65
|
+
if (!a) {
|
|
66
|
+
a = !0;
|
|
67
|
+
for (const n of i)
|
|
68
|
+
n.cancel();
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
(n) => {
|
|
72
|
+
if (!(c && k(n))) {
|
|
73
|
+
if (!a) {
|
|
74
|
+
a = !0;
|
|
75
|
+
for (const t of i)
|
|
76
|
+
try {
|
|
77
|
+
t.cancel();
|
|
78
|
+
} catch {
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
throw n;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
);
|
|
85
|
+
return {
|
|
86
|
+
cancel() {
|
|
87
|
+
if (a)
|
|
88
|
+
return;
|
|
89
|
+
a = !0, c = !0;
|
|
90
|
+
let n;
|
|
91
|
+
for (const t of i)
|
|
92
|
+
try {
|
|
93
|
+
t.cancel();
|
|
94
|
+
} catch (f) {
|
|
95
|
+
n ??= f;
|
|
96
|
+
}
|
|
97
|
+
if (n !== void 0)
|
|
98
|
+
throw n;
|
|
99
|
+
},
|
|
100
|
+
finished: u
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function v(e, s) {
|
|
104
|
+
if (!Number.isFinite(e.start) || !Number.isFinite(e.duration) || e.start < 0 || e.duration <= 0 || e.start + e.duration > s + E(s))
|
|
105
|
+
throw new RangeError("[RaphyDOMMotion] Clip timing is outside the motion duration.");
|
|
106
|
+
if (!(e.easing in b))
|
|
107
|
+
throw new TypeError(`[RaphyDOMMotion] Unsupported motion easing "${e.easing}".`);
|
|
108
|
+
if (e.keyframes.length < 2 || e.keyframes[0]?.at !== 0 || e.keyframes.at(-1)?.at !== 1)
|
|
109
|
+
throw new TypeError("[RaphyDOMMotion] Clips require normalized keyframes at 0 and 1.");
|
|
110
|
+
let r = -1;
|
|
111
|
+
for (const o of e.keyframes) {
|
|
112
|
+
if (!Number.isFinite(o.at) || o.at <= r || !Number.isFinite(o.value))
|
|
113
|
+
throw new TypeError("[RaphyDOMMotion] Clip keyframes must be finite and strictly ordered.");
|
|
114
|
+
if (e.channel === "paint.opacity" && (o.value < 0 || o.value > 1))
|
|
115
|
+
throw new RangeError("[RaphyDOMMotion] Opacity must be between 0 and 1.");
|
|
116
|
+
r = o.at;
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
function w(e) {
|
|
120
|
+
for (let s = 1; s < e.length; s++) {
|
|
121
|
+
const r = e[s - 1], o = r.start + r.duration;
|
|
122
|
+
if (e[s].start < o - E(o))
|
|
123
|
+
throw new Error(`[RaphyDOMMotion] Clips on channel "${r.channel}" overlap.`);
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
function O(e, s, r, o) {
|
|
127
|
+
const i = [], a = s[0].keyframes[0].value;
|
|
128
|
+
let u = r, n = a;
|
|
129
|
+
for (const t of s) {
|
|
130
|
+
t.start > u && i.length > 0 && i.push(d(e, (t.start - r) / o, n, "linear"));
|
|
131
|
+
for (let f = 0; f < t.keyframes.length; f++) {
|
|
132
|
+
const l = t.keyframes[f], m = Math.min(1, (t.start + l.at * t.duration - r) / o), h = f === t.keyframes.length - 1 ? "linear" : b[t.easing];
|
|
133
|
+
i.push(d(e, m, l.value, h));
|
|
134
|
+
}
|
|
135
|
+
u = t.start + t.duration, n = t.keyframes.at(-1).value;
|
|
136
|
+
}
|
|
137
|
+
return u < r + o && i.push(d(e, 1, n, "linear")), i;
|
|
138
|
+
}
|
|
139
|
+
function k(e) {
|
|
140
|
+
return typeof e == "object" && e !== null && "name" in e && e.name === "AbortError";
|
|
141
|
+
}
|
|
142
|
+
function E(e) {
|
|
143
|
+
return Math.max(1e-9, Number.EPSILON * Math.max(1, Math.abs(e)) * 8);
|
|
144
|
+
}
|
|
145
|
+
const F = Object.freeze({
|
|
146
|
+
resolve: (e) => T.resolve(e),
|
|
147
|
+
bind(e, s, r) {
|
|
148
|
+
const o = /* @__PURE__ */ new Map();
|
|
149
|
+
for (const c of s) {
|
|
150
|
+
v(c, r.duration);
|
|
151
|
+
const a = y(c.channel), u = o.get(a) ?? [];
|
|
152
|
+
u.push(c), o.set(a, u);
|
|
153
|
+
}
|
|
154
|
+
const i = [];
|
|
155
|
+
try {
|
|
156
|
+
for (const [c, a] of o) {
|
|
157
|
+
a.sort((f, l) => f.start - l.start), w(a);
|
|
158
|
+
const u = a[0].start, n = r.duration - u, t = e.animate(O(c, a, u, n), {
|
|
159
|
+
duration: n,
|
|
160
|
+
delay: u,
|
|
161
|
+
fill: "both",
|
|
162
|
+
composite: M(c) ? "add" : "replace"
|
|
163
|
+
});
|
|
164
|
+
i.push(t), t.finished.catch(() => {
|
|
165
|
+
}), t.pause(), t.currentTime = 0;
|
|
166
|
+
}
|
|
167
|
+
} catch (c) {
|
|
168
|
+
for (const a of i)
|
|
169
|
+
a.cancel();
|
|
170
|
+
throw c;
|
|
171
|
+
}
|
|
172
|
+
return {
|
|
173
|
+
setTime(c) {
|
|
174
|
+
for (const a of i)
|
|
175
|
+
a.currentTime = c;
|
|
176
|
+
},
|
|
177
|
+
dispose() {
|
|
178
|
+
for (const c of i)
|
|
179
|
+
c.cancel();
|
|
180
|
+
}
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
});
|
|
184
|
+
export {
|
|
185
|
+
T as DOM_MOTION_ADAPTER,
|
|
186
|
+
F as DOM_MOTION_TIMELINE_ADAPTER
|
|
187
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const A=require("./createDOMDataEventInput-B82pnIav.cjs"),O=require("./FullDOMOperations-Dschwj33.cjs");exports.withDOMOperations=A.withDOMOperations;exports.ADVANCED_OPERATION=O.ADVANCED_OPERATION;exports.BINDING_OPERATION=O.BINDING_OPERATION;exports.BOUNDARY_OPERATION=O.BOUNDARY_OPERATION;exports.EACH_OPERATION=O.EACH_OPERATION;exports.FULL_DOM_OPERATIONS=O.FULL_DOM_OPERATIONS;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { withDOMOperations } from './template/operations/DOMOperations.js';
|
|
2
|
+
export type { DOMOperationProfile } from './template/operations/DOMOperations.js';
|
|
3
|
+
export { ADVANCED_OPERATION, BINDING_OPERATION, BOUNDARY_OPERATION, EACH_OPERATION, FULL_DOM_OPERATIONS } from './template/operations/FullDOMOperations.js';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { w as N } from "./createDOMDataEventInput-BDX50jhu.js";
|
|
2
|
+
import { A as E, B as s, a as I, E as D, F as R } from "./FullDOMOperations-BOlf0_0L.js";
|
|
3
|
+
export {
|
|
4
|
+
E as ADVANCED_OPERATION,
|
|
5
|
+
s as BINDING_OPERATION,
|
|
6
|
+
I as BOUNDARY_OPERATION,
|
|
7
|
+
D as EACH_OPERATION,
|
|
8
|
+
R as FULL_DOM_OPERATIONS,
|
|
9
|
+
N as withDOMOperations
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { RAPHY_DOM_TARGET_PROFILE, } from './DOMProfile.js';
|
package/dist/profile.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@raphy-js/core/profile"),r=require("@raphy-js/profile"),o=r.defineTargetProfile({contracts:{node:"@raphy-js/dom/contracts/node",stylesheet:"@raphy-js/dom/contracts/stylesheet"},entrypoints:{runtime:r.moduleReference("@raphy-js/dom/runtime","RAPHY_DOM_RUNTIME_ADAPTER")},id:"@raphy-js/dom",requires:[e.RAPHY_CORE_PROFILE.id],supports:{aspects:[{openness:"open",reference:e.RAPHY_NODE_ASPECT},{openness:"open",reference:e.RAPHY_STYLE_ASPECT}]},version:"1.0.0-dev.88"});exports.RAPHY_DOM_TARGET_PROFILE=o;
|
package/dist/profile.js
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { RAPHY_NODE_ASPECT as e, RAPHY_STYLE_ASPECT as r, RAPHY_CORE_PROFILE as o } from "@raphy-js/core/profile";
|
|
2
|
+
import { defineTargetProfile as s, moduleReference as n } from "@raphy-js/profile";
|
|
3
|
+
const R = s({
|
|
4
|
+
contracts: {
|
|
5
|
+
node: "@raphy-js/dom/contracts/node",
|
|
6
|
+
stylesheet: "@raphy-js/dom/contracts/stylesheet"
|
|
7
|
+
},
|
|
8
|
+
entrypoints: {
|
|
9
|
+
runtime: n("@raphy-js/dom/runtime", "RAPHY_DOM_RUNTIME_ADAPTER")
|
|
10
|
+
},
|
|
11
|
+
id: "@raphy-js/dom",
|
|
12
|
+
requires: [o.id],
|
|
13
|
+
supports: {
|
|
14
|
+
aspects: [
|
|
15
|
+
{ openness: "open", reference: e },
|
|
16
|
+
{ openness: "open", reference: r }
|
|
17
|
+
]
|
|
18
|
+
},
|
|
19
|
+
version: "1.0.0-dev.88"
|
|
20
|
+
});
|
|
21
|
+
export {
|
|
22
|
+
R as RAPHY_DOM_TARGET_PROFILE
|
|
23
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ComponentInstance, RaphEffectScope } from '@raphy-js/core';
|
|
2
|
+
import { RaphExecution } from '@raphy-js/raph/execution';
|
|
3
|
+
import { RaphRuntime } from '@raphy-js/raph/runtime';
|
|
4
|
+
type ComponentNode<Runtime extends RaphExecution<Runtime>> = ComponentInstance<unknown, unknown, Readonly<Record<never, never>>, Readonly<Record<never, never>>, Runtime>['node'];
|
|
5
|
+
/**
|
|
6
|
+
* Обычный lifecycle owner либо pausable scope внутри KeepAlive.
|
|
7
|
+
*/
|
|
8
|
+
export type DOMEffectScope<Runtime extends RaphExecution<Runtime> = RaphRuntime> = ComponentNode<Runtime> | RaphEffectScope<Runtime>;
|
|
9
|
+
/**
|
|
10
|
+
* Продолжает pausable ancestry KeepAlive либо возвращает обычного owner напрямую.
|
|
11
|
+
*/
|
|
12
|
+
export declare function forkDOMEffectScope(parent: DOMEffectScope<any>, owner: ComponentNode<any>): DOMEffectScope<any>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RaphyRendererContext } from '@raphy-js/core';
|
|
2
|
+
import { DOMEventHub } from '../event/DOMEventHub.js';
|
|
3
|
+
/**
|
|
4
|
+
* Устанавливает application presentation без Router и без idle subscriptions.
|
|
5
|
+
*/
|
|
6
|
+
export declare function installDOMPresentation(context: RaphyRendererContext<any>, root: Element | ShadowRoot, events: DOMEventHub, applicationMarker: string): Readonly<{
|
|
7
|
+
dispose: () => void;
|
|
8
|
+
}>;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ComponentEmits, ComponentInstance, NoComponentEmits, NoComponentSlots, RaphyRenderer, RaphyRendererContext } from '@raphy-js/core';
|
|
2
|
+
import { RaphExecution } from '@raphy-js/raph/execution';
|
|
3
|
+
import { RaphRuntime } from '@raphy-js/raph/runtime';
|
|
4
|
+
import { DOMBlueprintMaterializerFactory } from '../template/blueprint/DOMBlueprintMaterializer.types.js';
|
|
5
|
+
import { DOMOperationProfile } from '../template/operations/DOMOperations.js';
|
|
6
|
+
import { DOMRendererOptions } from './DOMRenderer.types.js';
|
|
7
|
+
/**
|
|
8
|
+
* Владеет DOM output одного Raphy application внутри явно переданного target.
|
|
9
|
+
*
|
|
10
|
+
* @typeParam Props — тип входных данных root component.
|
|
11
|
+
* @typeParam State — тип setup state root component.
|
|
12
|
+
*/
|
|
13
|
+
export declare class DOMRenderer<Props = unknown, State = unknown, Emits extends ComponentEmits = NoComponentEmits, Runtime extends RaphExecution<Runtime> = RaphRuntime> implements RaphyRenderer<Props, State, Emits, Runtime> {
|
|
14
|
+
private readonly _context;
|
|
15
|
+
private readonly _eventHub;
|
|
16
|
+
private readonly _extensions;
|
|
17
|
+
private readonly _hostBlueprintCache;
|
|
18
|
+
private readonly _options;
|
|
19
|
+
private readonly _styleManager;
|
|
20
|
+
private _presentation;
|
|
21
|
+
private readonly _operations;
|
|
22
|
+
private _mountedOutput;
|
|
23
|
+
/**
|
|
24
|
+
* Связывает renderer instance с одним application и одним DOM target.
|
|
25
|
+
*/
|
|
26
|
+
constructor(context: RaphyRendererContext<Runtime>, options: DOMRendererOptions<Runtime>, operations: DOMOperationProfile, blueprints?: DOMBlueprintMaterializerFactory);
|
|
27
|
+
/**
|
|
28
|
+
* Создаёт и устанавливает DOM root после успешного setup root component.
|
|
29
|
+
*/
|
|
30
|
+
mount(root: ComponentInstance<Props, State, NoComponentSlots, Emits, Runtime>): void;
|
|
31
|
+
/**
|
|
32
|
+
* Удаляет принадлежащий renderer DOM root, не освобождая application самостоятельно.
|
|
33
|
+
*/
|
|
34
|
+
dispose(): void;
|
|
35
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { RaphExecution } from '@raphy-js/raph/execution';
|
|
2
|
+
import { RaphRuntime } from '@raphy-js/raph/runtime';
|
|
3
|
+
import { DOMRendererExtension } from './DOMRendererExtension.types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Настраивает application-local DOM renderer.
|
|
6
|
+
*/
|
|
7
|
+
export interface DOMRendererOptions<Runtime extends RaphExecution<Runtime> = RaphRuntime> {
|
|
8
|
+
readonly target: Element | ShadowRoot;
|
|
9
|
+
readonly styleNonce?: string;
|
|
10
|
+
readonly applicationMarker?: string;
|
|
11
|
+
readonly extensions?: readonly DOMRendererExtension<Runtime>[];
|
|
12
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { CapabilityProvisioner, NodeTargetRoute, RaphyRendererContext, TargetRuntime } from '@raphy-js/core';
|
|
2
|
+
import { RaphExecution } from '@raphy-js/raph/execution';
|
|
3
|
+
import { Disposer } from '@raphy-js/raph/reactivity';
|
|
4
|
+
import { RaphRuntime } from '@raphy-js/raph/runtime';
|
|
5
|
+
/** Application-local event access exposed to renderer extensions. */
|
|
6
|
+
export interface DOMRendererEventFacade {
|
|
7
|
+
/** Listens on one same-document target and tracks the listener with the extension. */
|
|
8
|
+
readonly listen: (target: EventTarget, type: string, listener: (event: Event) => void, options?: AddEventListenerOptions | boolean) => Disposer;
|
|
9
|
+
/** Listens once across the renderer root and every retained Teleport boundary. */
|
|
10
|
+
readonly listenBoundaries: (type: string, listener: (event: Event) => void, options?: AddEventListenerOptions | boolean) => Disposer;
|
|
11
|
+
}
|
|
12
|
+
/** Stable renderer services available while an extension is installed. */
|
|
13
|
+
export interface DOMRendererExtensionContext<Runtime extends RaphExecution<Runtime> = RaphRuntime> {
|
|
14
|
+
readonly applicationId: string;
|
|
15
|
+
readonly capabilities: CapabilityProvisioner;
|
|
16
|
+
readonly document: Document;
|
|
17
|
+
readonly events: DOMRendererEventFacade;
|
|
18
|
+
readonly owner: RaphyRendererContext<Runtime>['applicationNode'];
|
|
19
|
+
readonly root: Element | ShadowRoot;
|
|
20
|
+
readonly runtime: RaphyRendererContext<Runtime>['runtime'];
|
|
21
|
+
/** Renderer-owned asynchronous work participates in Core afterRender. */
|
|
22
|
+
readonly trackRenderWork: RaphyRendererContext<Runtime>['host']['trackRenderWork'];
|
|
23
|
+
}
|
|
24
|
+
export type DOMRendererExtensionCleanup = Disposer | Readonly<{
|
|
25
|
+
dispose: Disposer;
|
|
26
|
+
}> | undefined | void;
|
|
27
|
+
/** Optional platform feature installed before root component setup. */
|
|
28
|
+
export interface DOMRendererExtension<Runtime extends RaphExecution<Runtime> = RaphRuntime> {
|
|
29
|
+
readonly id: string;
|
|
30
|
+
/** Pure logical target resolution. The parent owns placement of the foreign plan. */
|
|
31
|
+
readonly resolveTarget?: (target: string, parent: TargetRuntime) => NodeTargetRoute | undefined;
|
|
32
|
+
readonly install: (context: DOMRendererExtensionContext<Runtime>) => DOMRendererExtensionCleanup;
|
|
33
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { RaphyRendererRuntimeProfile } from '@raphy-js/core';
|
|
2
|
+
import { RaphExecution } from '@raphy-js/raph/execution';
|
|
3
|
+
export declare const DOM_WRITE_PHASE = "@raphy-js/dom:write";
|
|
4
|
+
/**
|
|
5
|
+
* Options of a write binding whose first delivery runs inside its registration.
|
|
6
|
+
* One shared object serves every such binding, so a mounted element allocates
|
|
7
|
+
* no options literal per binding; Raph only reads it.
|
|
8
|
+
*/
|
|
9
|
+
export declare const DOM_SYNC_BINDING_OPTIONS: Readonly<{
|
|
10
|
+
readonly initial: "sync";
|
|
11
|
+
}>;
|
|
12
|
+
/** Shared immutable phase declarations specialized to the selected Core profile. */
|
|
13
|
+
export declare function domRuntimeProfile<Runtime extends RaphExecution<Runtime>>(): RaphyRendererRuntimeProfile<Runtime>;
|
|
14
|
+
/** Previous full-profile annotation remains available to existing consumers. */
|
|
15
|
+
export declare const DOM_RUNTIME_PROFILE: RaphyRendererRuntimeProfile;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const DOM_TARGET_RUNTIME: import('@raphy-js/core').TargetRuntime;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { NodeRuntime, StylesheetRuntime } from '@raphy-js/core';
|
|
2
|
+
/** Каждое target definition получает отдельный stylesheet runtime. */
|
|
3
|
+
export declare function createDOMTargetRuntime(node: NodeRuntime, stylesheet?: StylesheetRuntime): import('@raphy-js/core').TargetRuntime;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RaphyRendererContext } from '@raphy-js/core';
|
|
2
|
+
import { DOMEventHub } from '../event/DOMEventHub.js';
|
|
3
|
+
import { DOMStyleManager } from '../stylesheet/DOMStyleManager.js';
|
|
4
|
+
import { DOMBlueprintMaterializer } from '../template/blueprint/DOMBlueprintMaterializer.types.js';
|
|
5
|
+
import { DOMOperationTable } from '../template/operations/DOMOperations.js';
|
|
6
|
+
import { DOMRendererOptions } from './DOMRenderer.types.js';
|
|
7
|
+
/** Устанавливает общий app-owned view host, не создавая другое application. */
|
|
8
|
+
export declare function installAuxiliaryViews(context: RaphyRendererContext<any>, options: Pick<DOMRendererOptions, 'target'>, cache: DOMBlueprintMaterializer | undefined, events: DOMEventHub, styles: DOMStyleManager, operations: DOMOperationTable): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { RaphyRendererContext } from '@raphy-js/core';
|
|
2
|
+
import { RaphExecution } from '@raphy-js/raph/execution';
|
|
3
|
+
import { Disposer } from '@raphy-js/raph/reactivity';
|
|
4
|
+
import { DOMEventHub } from '../event/DOMEventHub.js';
|
|
5
|
+
import { DOMRendererOptions } from './DOMRenderer.types.js';
|
|
6
|
+
export interface DOMRendererExtensionController {
|
|
7
|
+
readonly dispose: Disposer;
|
|
8
|
+
}
|
|
9
|
+
/** Installs renderer extensions transactionally in author order. */
|
|
10
|
+
export declare function installDOMRendererExtensions<Runtime extends RaphExecution<Runtime>>(context: RaphyRendererContext<Runtime>, options: DOMRendererOptions<Runtime>, eventHub: DOMEventHub): DOMRendererExtensionController;
|