@unrulysystems/native-motion-core 0.1.0-alpha.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/CHANGELOG.md +9 -0
- package/LICENSE +21 -0
- package/README.md +48 -0
- package/dist/clock.cjs +71 -0
- package/dist/clock.d.cts +23 -0
- package/dist/clock.d.ts +23 -0
- package/dist/clock.js +66 -0
- package/dist/collect-reads.cjs +68 -0
- package/dist/collect-reads.d.cts +23 -0
- package/dist/collect-reads.d.ts +23 -0
- package/dist/collect-reads.js +62 -0
- package/dist/component/boundedArray.cjs +74 -0
- package/dist/component/boundedArray.d.cts +25 -0
- package/dist/component/boundedArray.d.ts +25 -0
- package/dist/component/boundedArray.js +68 -0
- package/dist/component/index.cjs +57 -0
- package/dist/component/index.d.cts +12 -0
- package/dist/component/index.d.ts +12 -0
- package/dist/component/index.js +22 -0
- package/dist/component/orchestration.cjs +129 -0
- package/dist/component/orchestration.d.cts +66 -0
- package/dist/component/orchestration.d.ts +66 -0
- package/dist/component/orchestration.js +124 -0
- package/dist/component/resolve.cjs +104 -0
- package/dist/component/resolve.d.cts +11 -0
- package/dist/component/resolve.d.ts +11 -0
- package/dist/component/resolve.js +97 -0
- package/dist/component/transition.cjs +352 -0
- package/dist/component/transition.d.cts +33 -0
- package/dist/component/transition.d.ts +33 -0
- package/dist/component/transition.js +339 -0
- package/dist/component/types.cjs +114 -0
- package/dist/component/types.d.cts +60 -0
- package/dist/component/types.d.ts +60 -0
- package/dist/component/types.js +111 -0
- package/dist/component/validate.cjs +1015 -0
- package/dist/component/validate.d.cts +37 -0
- package/dist/component/validate.d.ts +37 -0
- package/dist/component/validate.js +1002 -0
- package/dist/component/variants.cjs +333 -0
- package/dist/component/variants.d.cts +106 -0
- package/dist/component/variants.d.ts +106 -0
- package/dist/component/variants.js +321 -0
- package/dist/config/constants.cjs +41 -0
- package/dist/config/constants.d.cts +29 -0
- package/dist/config/constants.d.ts +29 -0
- package/dist/config/constants.js +38 -0
- package/dist/delay.cjs +72 -0
- package/dist/delay.d.cts +26 -0
- package/dist/delay.d.ts +26 -0
- package/dist/delay.js +70 -0
- package/dist/derived.cjs +143 -0
- package/dist/derived.d.cts +41 -0
- package/dist/derived.d.ts +41 -0
- package/dist/derived.js +139 -0
- package/dist/driver/index.cjs +22 -0
- package/dist/driver/index.d.cts +7 -0
- package/dist/driver/index.d.ts +7 -0
- package/dist/driver/index.js +14 -0
- package/dist/driver/keyframeTiming.cjs +130 -0
- package/dist/driver/keyframeTiming.d.cts +18 -0
- package/dist/driver/keyframeTiming.d.ts +18 -0
- package/dist/driver/keyframeTiming.js +124 -0
- package/dist/driver/keyframeTimingConfig.cjs +24 -0
- package/dist/driver/keyframeTimingConfig.d.cts +5 -0
- package/dist/driver/keyframeTimingConfig.d.ts +5 -0
- package/dist/driver/keyframeTimingConfig.js +22 -0
- package/dist/driver/prepare.cjs +459 -0
- package/dist/driver/prepare.d.cts +4 -0
- package/dist/driver/prepare.d.ts +4 -0
- package/dist/driver/prepare.js +454 -0
- package/dist/driver/reference.cjs +762 -0
- package/dist/driver/reference.d.cts +53 -0
- package/dist/driver/reference.d.ts +53 -0
- package/dist/driver/reference.js +757 -0
- package/dist/driver/step.cjs +55 -0
- package/dist/driver/step.d.cts +9 -0
- package/dist/driver/step.d.ts +9 -0
- package/dist/driver/step.js +52 -0
- package/dist/driver/tiers.cjs +40 -0
- package/dist/driver/tiers.d.cts +2 -0
- package/dist/driver/tiers.d.ts +2 -0
- package/dist/driver/tiers.js +37 -0
- package/dist/driver/types.cjs +9 -0
- package/dist/driver/types.d.cts +68 -0
- package/dist/driver/types.d.ts +68 -0
- package/dist/driver/types.js +8 -0
- package/dist/external-animation-ledger.cjs +1250 -0
- package/dist/external-animation-ledger.d.cts +416 -0
- package/dist/external-animation-ledger.d.ts +416 -0
- package/dist/external-animation-ledger.js +1243 -0
- package/dist/gesture/directionLock.cjs +25 -0
- package/dist/gesture/directionLock.d.cts +8 -0
- package/dist/gesture/directionLock.d.ts +8 -0
- package/dist/gesture/directionLock.js +21 -0
- package/dist/gesture/dragConfig.cjs +634 -0
- package/dist/gesture/dragConfig.d.cts +298 -0
- package/dist/gesture/dragConfig.d.ts +298 -0
- package/dist/gesture/dragConfig.js +624 -0
- package/dist/gesture/elastic.cjs +44 -0
- package/dist/gesture/elastic.d.cts +4 -0
- package/dist/gesture/elastic.d.ts +4 -0
- package/dist/gesture/elastic.js +39 -0
- package/dist/gesture/handoffSession.cjs +161 -0
- package/dist/gesture/handoffSession.d.cts +35 -0
- package/dist/gesture/handoffSession.d.ts +35 -0
- package/dist/gesture/handoffSession.js +158 -0
- package/dist/gesture/index.cjs +37 -0
- package/dist/gesture/index.d.cts +12 -0
- package/dist/gesture/index.d.ts +12 -0
- package/dist/gesture/index.js +11 -0
- package/dist/gesture/projection.cjs +95 -0
- package/dist/gesture/projection.d.cts +7 -0
- package/dist/gesture/projection.d.ts +7 -0
- package/dist/gesture/projection.js +87 -0
- package/dist/gesture/session.cjs +162 -0
- package/dist/gesture/session.d.cts +29 -0
- package/dist/gesture/session.d.ts +29 -0
- package/dist/gesture/session.js +158 -0
- package/dist/gesture/types.cjs +5 -0
- package/dist/gesture/types.d.cts +13 -0
- package/dist/gesture/types.d.ts +13 -0
- package/dist/gesture/types.js +4 -0
- package/dist/gesture/viewportConstraints.cjs +38 -0
- package/dist/gesture/viewportConstraints.d.cts +6 -0
- package/dist/gesture/viewportConstraints.d.ts +6 -0
- package/dist/gesture/viewportConstraints.js +34 -0
- package/dist/graph.cjs +226 -0
- package/dist/graph.d.cts +2 -0
- package/dist/graph.d.ts +2 -0
- package/dist/graph.js +223 -0
- package/dist/index.cjs +140 -0
- package/dist/index.d.cts +33 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +70 -0
- package/dist/inertia.cjs +214 -0
- package/dist/inertia.d.cts +53 -0
- package/dist/inertia.d.ts +53 -0
- package/dist/inertia.js +212 -0
- package/dist/instant.cjs +66 -0
- package/dist/instant.d.cts +16 -0
- package/dist/instant.d.ts +16 -0
- package/dist/instant.js +63 -0
- package/dist/internal-driver.cjs +81 -0
- package/dist/internal-driver.d.cts +19 -0
- package/dist/internal-driver.d.ts +19 -0
- package/dist/internal-driver.js +35 -0
- package/dist/keyframes.cjs +191 -0
- package/dist/keyframes.d.cts +13 -0
- package/dist/keyframes.d.ts +13 -0
- package/dist/keyframes.js +188 -0
- package/dist/layout/commitDetector.cjs +67 -0
- package/dist/layout/commitDetector.d.cts +21 -0
- package/dist/layout/commitDetector.d.ts +21 -0
- package/dist/layout/commitDetector.js +64 -0
- package/dist/layout/compose.cjs +67 -0
- package/dist/layout/compose.d.cts +30 -0
- package/dist/layout/compose.d.ts +30 -0
- package/dist/layout/compose.js +65 -0
- package/dist/layout/constants.cjs +13 -0
- package/dist/layout/constants.d.cts +6 -0
- package/dist/layout/constants.d.ts +6 -0
- package/dist/layout/constants.js +10 -0
- package/dist/layout/identity.cjs +700 -0
- package/dist/layout/identity.d.cts +67 -0
- package/dist/layout/identity.d.ts +67 -0
- package/dist/layout/identity.js +698 -0
- package/dist/layout/index.cjs +36 -0
- package/dist/layout/index.d.cts +18 -0
- package/dist/layout/index.d.ts +18 -0
- package/dist/layout/index.js +13 -0
- package/dist/layout/measure.cjs +81 -0
- package/dist/layout/measure.d.cts +43 -0
- package/dist/layout/measure.d.ts +43 -0
- package/dist/layout/measure.js +78 -0
- package/dist/layout/projection.cjs +99 -0
- package/dist/layout/projection.d.cts +23 -0
- package/dist/layout/projection.d.ts +23 -0
- package/dist/layout/projection.js +97 -0
- package/dist/layout/scroll.cjs +27 -0
- package/dist/layout/scroll.d.cts +13 -0
- package/dist/layout/scroll.d.ts +13 -0
- package/dist/layout/scroll.js +24 -0
- package/dist/layout/session.cjs +207 -0
- package/dist/layout/session.d.cts +73 -0
- package/dist/layout/session.d.ts +73 -0
- package/dist/layout/session.js +205 -0
- package/dist/layout/tree.cjs +826 -0
- package/dist/layout/tree.d.cts +70 -0
- package/dist/layout/tree.d.ts +70 -0
- package/dist/layout/tree.js +823 -0
- package/dist/layout/types.cjs +36 -0
- package/dist/layout/types.d.cts +31 -0
- package/dist/layout/types.d.ts +31 -0
- package/dist/layout/types.js +35 -0
- package/dist/motion-arc.cjs +184 -0
- package/dist/motion-arc.d.cts +78 -0
- package/dist/motion-arc.d.ts +78 -0
- package/dist/motion-arc.js +183 -0
- package/dist/motion-mix.cjs +205 -0
- package/dist/motion-mix.d.cts +3 -0
- package/dist/motion-mix.d.ts +3 -0
- package/dist/motion-mix.js +202 -0
- package/dist/motion-value-driver-port.cjs +636 -0
- package/dist/motion-value-driver-port.d.cts +406 -0
- package/dist/motion-value-driver-port.d.ts +406 -0
- package/dist/motion-value-driver-port.js +627 -0
- package/dist/motion-value.cjs +189 -0
- package/dist/motion-value.d.cts +51 -0
- package/dist/motion-value.d.ts +51 -0
- package/dist/motion-value.js +185 -0
- package/dist/presence/controller.cjs +657 -0
- package/dist/presence/controller.d.cts +6 -0
- package/dist/presence/controller.d.ts +6 -0
- package/dist/presence/controller.js +652 -0
- package/dist/presence/index.cjs +19 -0
- package/dist/presence/index.d.cts +4 -0
- package/dist/presence/index.d.ts +4 -0
- package/dist/presence/index.js +12 -0
- package/dist/presence/machine.cjs +50 -0
- package/dist/presence/machine.d.cts +10 -0
- package/dist/presence/machine.d.ts +10 -0
- package/dist/presence/machine.js +46 -0
- package/dist/presence/types.cjs +6 -0
- package/dist/presence/types.d.cts +32 -0
- package/dist/presence/types.d.ts +32 -0
- package/dist/presence/types.js +5 -0
- package/dist/repeat.cjs +311 -0
- package/dist/repeat.d.cts +174 -0
- package/dist/repeat.d.ts +174 -0
- package/dist/repeat.js +300 -0
- package/dist/spring.cjs +128 -0
- package/dist/spring.d.cts +18 -0
- package/dist/spring.d.ts +18 -0
- package/dist/spring.js +125 -0
- package/dist/subscriptions.cjs +74 -0
- package/dist/subscriptions.d.cts +19 -0
- package/dist/subscriptions.d.ts +19 -0
- package/dist/subscriptions.js +69 -0
- package/dist/subset/index.cjs +23 -0
- package/dist/subset/index.d.cts +6 -0
- package/dist/subset/index.d.ts +6 -0
- package/dist/subset/index.js +13 -0
- package/dist/subset/normalize.cjs +90 -0
- package/dist/subset/normalize.d.cts +10 -0
- package/dist/subset/normalize.d.ts +10 -0
- package/dist/subset/normalize.js +85 -0
- package/dist/subset/registry.cjs +259 -0
- package/dist/subset/registry.d.cts +25 -0
- package/dist/subset/registry.d.ts +25 -0
- package/dist/subset/registry.js +256 -0
- package/dist/subset/resolve.cjs +98 -0
- package/dist/subset/resolve.d.cts +24 -0
- package/dist/subset/resolve.d.ts +24 -0
- package/dist/subset/resolve.js +90 -0
- package/dist/timing.cjs +206 -0
- package/dist/timing.d.cts +17 -0
- package/dist/timing.d.ts +17 -0
- package/dist/timing.js +201 -0
- package/dist/transformTemplate.cjs +219 -0
- package/dist/transformTemplate.d.cts +29 -0
- package/dist/transformTemplate.d.ts +29 -0
- package/dist/transformTemplate.js +215 -0
- package/dist/transition.cjs +231 -0
- package/dist/transition.d.cts +89 -0
- package/dist/transition.d.ts +89 -0
- package/dist/transition.js +223 -0
- package/dist/types.cjs +4 -0
- package/dist/types.d.cts +175 -0
- package/dist/types.d.ts +175 -0
- package/dist/types.js +3 -0
- package/dist/value-types/color.cjs +220 -0
- package/dist/value-types/color.d.cts +19 -0
- package/dist/value-types/color.d.ts +19 -0
- package/dist/value-types/color.js +218 -0
- package/dist/value-types/complex.cjs +160 -0
- package/dist/value-types/complex.d.cts +19 -0
- package/dist/value-types/complex.d.ts +19 -0
- package/dist/value-types/complex.js +155 -0
- package/dist/value-types/constants.cjs +15 -0
- package/dist/value-types/constants.d.cts +6 -0
- package/dist/value-types/constants.d.ts +6 -0
- package/dist/value-types/constants.js +12 -0
- package/dist/value-types/discrete.cjs +62 -0
- package/dist/value-types/discrete.d.cts +4 -0
- package/dist/value-types/discrete.d.ts +4 -0
- package/dist/value-types/discrete.js +56 -0
- package/dist/value-types/index.cjs +59 -0
- package/dist/value-types/index.d.cts +14 -0
- package/dist/value-types/index.d.ts +14 -0
- package/dist/value-types/index.js +24 -0
- package/dist/value-types/measure-resolve.cjs +325 -0
- package/dist/value-types/measure-resolve.d.cts +91 -0
- package/dist/value-types/measure-resolve.d.ts +91 -0
- package/dist/value-types/measure-resolve.js +313 -0
- package/dist/value-types/mix.cjs +90 -0
- package/dist/value-types/mix.d.cts +27 -0
- package/dist/value-types/mix.d.ts +27 -0
- package/dist/value-types/mix.js +85 -0
- package/dist/value-types/named-colors.cjs +61 -0
- package/dist/value-types/named-colors.d.cts +2 -0
- package/dist/value-types/named-colors.d.ts +2 -0
- package/dist/value-types/named-colors.js +58 -0
- package/dist/value-types/numeric.cjs +86 -0
- package/dist/value-types/numeric.d.cts +16 -0
- package/dist/value-types/numeric.d.ts +16 -0
- package/dist/value-types/numeric.js +79 -0
- package/dist/worklet-layout/config/constants.js +39 -0
- package/dist/worklet-layout/layout/constants.js +11 -0
- package/dist/worklet-layout/layout/identity.js +699 -0
- package/dist/worklet-layout/layout/projection.js +98 -0
- package/dist/worklet-layout/layout/session.js +206 -0
- package/dist/worklet-layout/layout/tree.js +824 -0
- package/dist/worklet-layout/layout/types.js +36 -0
- package/dist/worklet-layout/spring.js +125 -0
- package/dist/worklet-layout/timing.js +201 -0
- package/dist/worklet-layout/transition.js +223 -0
- package/dist/worklet-layout.cjs +47 -0
- package/dist/worklet-layout.d.cts +15 -0
- package/dist/worklet-layout.d.ts +15 -0
- package/dist/worklet-layout.js +28 -0
- package/dist/wrap.cjs +7 -0
- package/dist/wrap.d.cts +1 -0
- package/dist/wrap.d.ts +1 -0
- package/dist/wrap.js +4 -0
- package/package.json +45 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Rect, Transform } from "./types.cjs";
|
|
2
|
+
/**
|
|
3
|
+
* The viewport rect of a child at progress `p`, positioned parent-relative (REQ-LAYOUT-012). `childLocal` is
|
|
4
|
+
* the child's rect in the parent's LOCAL space (relative to the parent's top-left, in the after frame). The
|
|
5
|
+
* child rides the parent's projection: its origin and size scale with the parent's current visual frame, so
|
|
6
|
+
* its fractional position within the parent is invariant across progress and it is never stranded at its
|
|
7
|
+
* host-absolute origin while the parent is displaced.
|
|
8
|
+
*/
|
|
9
|
+
export declare function composeParentRelative(parentBefore: Rect, parentAfter: Rect, childLocal: Rect, progress: number): Rect;
|
|
10
|
+
/**
|
|
11
|
+
* The counter-scale a child carrying layout identity applies to cancel its parent's scale, so it keeps its
|
|
12
|
+
* intrinsic size under a scaled layout (REQ-LAYOUT-013). `parent.scaleX × counterScale.scaleX == 1`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function counterScale(parent: Transform): Transform;
|
|
15
|
+
/** A border-radius corrected per axis under a (possibly anisotropic) scale: `scale × corrected == radius`. */
|
|
16
|
+
export interface CorrectedRadius {
|
|
17
|
+
readonly x: number;
|
|
18
|
+
readonly y: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Correct a border-radius under a non-unit scale (REQ-LAYOUT-013): dividing by the axis scale so the applied
|
|
22
|
+
* scale reproduces the intended visual radius. Anisotropic scale yields distinct x/y radii.
|
|
23
|
+
*/
|
|
24
|
+
export declare function correctRadius(radius: number, scaleX: number, scaleY: number): CorrectedRadius;
|
|
25
|
+
/**
|
|
26
|
+
* Assert a property can be corrected under a scaled layout, else fail loud (REQ-LAYOUT-013 → REQ-API-005/006)
|
|
27
|
+
* rather than rendering a distorted result. Consults the frozen registry only to sharpen the message
|
|
28
|
+
* (known style prop vs typo); the correctable set is LAYOUT's own contribution, pending ratification.
|
|
29
|
+
*/
|
|
30
|
+
export declare function assertCorrectable(property: string): void;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { Rect, Transform } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* The viewport rect of a child at progress `p`, positioned parent-relative (REQ-LAYOUT-012). `childLocal` is
|
|
4
|
+
* the child's rect in the parent's LOCAL space (relative to the parent's top-left, in the after frame). The
|
|
5
|
+
* child rides the parent's projection: its origin and size scale with the parent's current visual frame, so
|
|
6
|
+
* its fractional position within the parent is invariant across progress and it is never stranded at its
|
|
7
|
+
* host-absolute origin while the parent is displaced.
|
|
8
|
+
*/
|
|
9
|
+
export declare function composeParentRelative(parentBefore: Rect, parentAfter: Rect, childLocal: Rect, progress: number): Rect;
|
|
10
|
+
/**
|
|
11
|
+
* The counter-scale a child carrying layout identity applies to cancel its parent's scale, so it keeps its
|
|
12
|
+
* intrinsic size under a scaled layout (REQ-LAYOUT-013). `parent.scaleX × counterScale.scaleX == 1`.
|
|
13
|
+
*/
|
|
14
|
+
export declare function counterScale(parent: Transform): Transform;
|
|
15
|
+
/** A border-radius corrected per axis under a (possibly anisotropic) scale: `scale × corrected == radius`. */
|
|
16
|
+
export interface CorrectedRadius {
|
|
17
|
+
readonly x: number;
|
|
18
|
+
readonly y: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Correct a border-radius under a non-unit scale (REQ-LAYOUT-013): dividing by the axis scale so the applied
|
|
22
|
+
* scale reproduces the intended visual radius. Anisotropic scale yields distinct x/y radii.
|
|
23
|
+
*/
|
|
24
|
+
export declare function correctRadius(radius: number, scaleX: number, scaleY: number): CorrectedRadius;
|
|
25
|
+
/**
|
|
26
|
+
* Assert a property can be corrected under a scaled layout, else fail loud (REQ-LAYOUT-013 → REQ-API-005/006)
|
|
27
|
+
* rather than rendering a distorted result. Consults the frozen registry only to sharpen the message
|
|
28
|
+
* (known style prop vs typo); the correctable set is LAYOUT's own contribution, pending ratification.
|
|
29
|
+
*/
|
|
30
|
+
export declare function assertCorrectable(property: string): void;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// SPEC-LAYOUT §2/§4a — parent-relative composition + distortion correction (REQ-LAYOUT-012/013). A nested
|
|
2
|
+
// child is positioned relative to the animating ancestor's projection frame, so it composes coherently and
|
|
3
|
+
// is never left behind at its pre-animation viewport origin. A child carrying layout identity under a scaled
|
|
4
|
+
// parent gets a counter-scale to keep its intrinsic size, and border-radius is corrected under non-unit
|
|
5
|
+
// scale. A property that cannot be corrected under a scaled layout fails loud (REQ-LAYOUT-013 → REQ-API-005/
|
|
6
|
+
// 006). Pure; consumes the frozen SUBSET registry (existence check) but owns no second property registry.
|
|
7
|
+
import { UNIVERSAL_SUBSET } from "../subset/index.js";
|
|
8
|
+
import { applyTransformToRect, projectAtProgress } from "./projection.js";
|
|
9
|
+
/**
|
|
10
|
+
* The viewport rect of a child at progress `p`, positioned parent-relative (REQ-LAYOUT-012). `childLocal` is
|
|
11
|
+
* the child's rect in the parent's LOCAL space (relative to the parent's top-left, in the after frame). The
|
|
12
|
+
* child rides the parent's projection: its origin and size scale with the parent's current visual frame, so
|
|
13
|
+
* its fractional position within the parent is invariant across progress and it is never stranded at its
|
|
14
|
+
* host-absolute origin while the parent is displaced.
|
|
15
|
+
*/
|
|
16
|
+
export function composeParentRelative(parentBefore, parentAfter, childLocal, progress) {
|
|
17
|
+
'worklet';
|
|
18
|
+
const tp = projectAtProgress(parentBefore, parentAfter, progress);
|
|
19
|
+
const parentVisual = applyTransformToRect(tp, parentAfter);
|
|
20
|
+
return {
|
|
21
|
+
x: parentVisual.x + childLocal.x * tp.scaleX,
|
|
22
|
+
y: parentVisual.y + childLocal.y * tp.scaleY,
|
|
23
|
+
width: childLocal.width * tp.scaleX,
|
|
24
|
+
height: childLocal.height * tp.scaleY,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function assertNonZeroScale(scaleX, scaleY) {
|
|
28
|
+
'worklet';
|
|
29
|
+
if (!Number.isFinite(scaleX) || !Number.isFinite(scaleY) || scaleX === 0 || scaleY === 0) {
|
|
30
|
+
throw new Error(`layout: cannot counter-correct under a zero/non-finite scale (scaleX=${scaleX}, scaleY=${scaleY}) — divide-by-zero guard (REQ-LAYOUT-011)`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The counter-scale a child carrying layout identity applies to cancel its parent's scale, so it keeps its
|
|
35
|
+
* intrinsic size under a scaled layout (REQ-LAYOUT-013). `parent.scaleX × counterScale.scaleX == 1`.
|
|
36
|
+
*/
|
|
37
|
+
export function counterScale(parent) {
|
|
38
|
+
'worklet';
|
|
39
|
+
assertNonZeroScale(parent.scaleX, parent.scaleY);
|
|
40
|
+
return { translateX: 0, translateY: 0, scaleX: 1 / parent.scaleX, scaleY: 1 / parent.scaleY };
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Correct a border-radius under a non-unit scale (REQ-LAYOUT-013): dividing by the axis scale so the applied
|
|
44
|
+
* scale reproduces the intended visual radius. Anisotropic scale yields distinct x/y radii.
|
|
45
|
+
*/
|
|
46
|
+
export function correctRadius(radius, scaleX, scaleY) {
|
|
47
|
+
'worklet';
|
|
48
|
+
assertNonZeroScale(scaleX, scaleY);
|
|
49
|
+
return { x: radius / scaleX, y: radius / scaleY };
|
|
50
|
+
}
|
|
51
|
+
// LAYOUT's proposed set of properties that are corrected under a scaled layout. This is the subsystem's
|
|
52
|
+
// CONTRIBUTION to the universal subset (REQ-LAYOUT-013), pending SUBSET ratification (§7) — NOT a second
|
|
53
|
+
// registry. Size is handled structurally by counterScale; borderRadius by correctRadius.
|
|
54
|
+
const LAYOUT_CORRECTABLE = new Set(['borderRadius']);
|
|
55
|
+
/**
|
|
56
|
+
* Assert a property can be corrected under a scaled layout, else fail loud (REQ-LAYOUT-013 → REQ-API-005/006)
|
|
57
|
+
* rather than rendering a distorted result. Consults the frozen registry only to sharpen the message
|
|
58
|
+
* (known style prop vs typo); the correctable set is LAYOUT's own contribution, pending ratification.
|
|
59
|
+
*/
|
|
60
|
+
export function assertCorrectable(property) {
|
|
61
|
+
if (LAYOUT_CORRECTABLE.has(property))
|
|
62
|
+
return;
|
|
63
|
+
const known = UNIVERSAL_SUBSET.has(property);
|
|
64
|
+
throw new Error(`layout: '${property}' is ${known ? 'a known style property but is not' : 'not a known style property and is not'} correctable under a scaled layout at M1 — the correctable set is {borderRadius} (size via counter-scale), LAYOUT's proposed contribution to the universal subset (§7, pending SUBSET ratification). Fails loud rather than rendering distorted (REQ-LAYOUT-013).`);
|
|
65
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @frame-path — executes inside the UI-runtime frame step; allocation-gated (REQ-DRIVER-021).
|
|
3
|
+
// SPEC-LAYOUT §4a pinned tolerances. Stated once, shared across the projection math, composition, and the
|
|
4
|
+
// session. Position/scale epsilons gate identity-at-settle + counter-scale; the velocity epsilon gates
|
|
5
|
+
// retarget C1 continuity (M4). These are invariant tolerances, not feel parameters — they do not widen.
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.EPSILON_VEL = exports.EPSILON_SCALE = exports.EPSILON_POS = void 0;
|
|
8
|
+
/** Position/edge coincidence tolerance (px): ends-at-host-layout, parent-relative coherence, C0 seam. */
|
|
9
|
+
exports.EPSILON_POS = 0.5;
|
|
10
|
+
/** Child-size tolerance (fraction): a counter-scaled child stays within 1% of its intrinsic size. */
|
|
11
|
+
exports.EPSILON_SCALE = 0.01;
|
|
12
|
+
/** Retarget velocity-continuity tolerance (px/s): the C1 seam when a layout change arrives mid-projection. */
|
|
13
|
+
exports.EPSILON_VEL = 1;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Position/edge coincidence tolerance (px): ends-at-host-layout, parent-relative coherence, C0 seam. */
|
|
2
|
+
export declare const EPSILON_POS = 0.5;
|
|
3
|
+
/** Child-size tolerance (fraction): a counter-scaled child stays within 1% of its intrinsic size. */
|
|
4
|
+
export declare const EPSILON_SCALE = 0.01;
|
|
5
|
+
/** Retarget velocity-continuity tolerance (px/s): the C1 seam when a layout change arrives mid-projection. */
|
|
6
|
+
export declare const EPSILON_VEL = 1;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Position/edge coincidence tolerance (px): ends-at-host-layout, parent-relative coherence, C0 seam. */
|
|
2
|
+
export declare const EPSILON_POS = 0.5;
|
|
3
|
+
/** Child-size tolerance (fraction): a counter-scaled child stays within 1% of its intrinsic size. */
|
|
4
|
+
export declare const EPSILON_SCALE = 0.01;
|
|
5
|
+
/** Retarget velocity-continuity tolerance (px/s): the C1 seam when a layout change arrives mid-projection. */
|
|
6
|
+
export declare const EPSILON_VEL = 1;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
// @frame-path — executes inside the UI-runtime frame step; allocation-gated (REQ-DRIVER-021).
|
|
2
|
+
// SPEC-LAYOUT §4a pinned tolerances. Stated once, shared across the projection math, composition, and the
|
|
3
|
+
// session. Position/scale epsilons gate identity-at-settle + counter-scale; the velocity epsilon gates
|
|
4
|
+
// retarget C1 continuity (M4). These are invariant tolerances, not feel parameters — they do not widen.
|
|
5
|
+
/** Position/edge coincidence tolerance (px): ends-at-host-layout, parent-relative coherence, C0 seam. */
|
|
6
|
+
export const EPSILON_POS = 0.5;
|
|
7
|
+
/** Child-size tolerance (fraction): a counter-scaled child stays within 1% of its intrinsic size. */
|
|
8
|
+
export const EPSILON_SCALE = 0.01;
|
|
9
|
+
/** Retarget velocity-continuity tolerance (px/s): the C1 seam when a layout change arrives mid-projection. */
|
|
10
|
+
export const EPSILON_VEL = 1;
|