@wardic/foldkit 0.0.0-stage → 1.2.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/LICENSE +21 -0
- package/README.md +59 -2
- package/THIRD_PARTY_NOTICES.md +145 -0
- package/dist/AnimationControls.d.ts +37 -0
- package/dist/AnimationControls.d.ts.map +1 -0
- package/dist/AnimationControls.js +37 -0
- package/dist/AnimationControls.js.map +1 -0
- package/dist/AnimationScope.d.ts +20 -0
- package/dist/AnimationScope.d.ts.map +1 -0
- package/dist/AnimationScope.js +20 -0
- package/dist/AnimationScope.js.map +1 -0
- package/dist/DragControls.d.ts +25 -0
- package/dist/DragControls.d.ts.map +1 -0
- package/dist/DragControls.js +21 -0
- package/dist/DragControls.js.map +1 -0
- package/dist/Features.d.ts +36 -0
- package/dist/Features.d.ts.map +1 -0
- package/dist/Features.js +44 -0
- package/dist/Features.js.map +1 -0
- package/dist/Ward.d.ts +301 -0
- package/dist/Ward.d.ts.map +1 -0
- package/dist/Ward.js +6 -0
- package/dist/Ward.js.map +1 -0
- package/dist/Wardic.d.ts +363 -0
- package/dist/Wardic.d.ts.map +1 -0
- package/dist/Wardic.js +85 -0
- package/dist/Wardic.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -0
- package/dist/index.js.map +1 -0
- package/dist/internal/builder.d.ts +8 -0
- package/dist/internal/builder.d.ts.map +1 -0
- package/dist/internal/builder.js +242 -0
- package/dist/internal/builder.js.map +1 -0
- package/dist/internal/commands.d.ts +143 -0
- package/dist/internal/commands.d.ts.map +1 -0
- package/dist/internal/commands.js +242 -0
- package/dist/internal/commands.js.map +1 -0
- package/dist/internal/delivery.d.ts +44 -0
- package/dist/internal/delivery.d.ts.map +1 -0
- package/dist/internal/delivery.js +85 -0
- package/dist/internal/delivery.js.map +1 -0
- package/dist/internal/dev.d.ts +10 -0
- package/dist/internal/dev.d.ts.map +1 -0
- package/dist/internal/dev.js +10 -0
- package/dist/internal/dev.js.map +1 -0
- package/dist/internal/dev.production.d.ts +8 -0
- package/dist/internal/dev.production.d.ts.map +1 -0
- package/dist/internal/dev.production.js +8 -0
- package/dist/internal/dev.production.js.map +1 -0
- package/dist/internal/drag.d.ts +66 -0
- package/dist/internal/drag.d.ts.map +1 -0
- package/dist/internal/drag.js +71 -0
- package/dist/internal/drag.js.map +1 -0
- package/dist/internal/element.d.ts +59 -0
- package/dist/internal/element.d.ts.map +1 -0
- package/dist/internal/element.js +582 -0
- package/dist/internal/element.js.map +1 -0
- package/dist/internal/gestures.d.ts +62 -0
- package/dist/internal/gestures.d.ts.map +1 -0
- package/dist/internal/gestures.js +109 -0
- package/dist/internal/gestures.js.map +1 -0
- package/dist/internal/hydrate.d.ts +5 -0
- package/dist/internal/hydrate.d.ts.map +1 -0
- package/dist/internal/hydrate.js +27 -0
- package/dist/internal/hydrate.js.map +1 -0
- package/dist/internal/keys.d.ts +21 -0
- package/dist/internal/keys.d.ts.map +1 -0
- package/dist/internal/keys.js +12 -0
- package/dist/internal/keys.js.map +1 -0
- package/dist/internal/layout.d.ts +29 -0
- package/dist/internal/layout.d.ts.map +1 -0
- package/dist/internal/layout.js +88 -0
- package/dist/internal/layout.js.map +1 -0
- package/dist/internal/mount.d.ts +22 -0
- package/dist/internal/mount.d.ts.map +1 -0
- package/dist/internal/mount.js +100 -0
- package/dist/internal/mount.js.map +1 -0
- package/dist/internal/presence.d.ts +33 -0
- package/dist/internal/presence.d.ts.map +1 -0
- package/dist/internal/presence.js +338 -0
- package/dist/internal/presence.js.map +1 -0
- package/dist/internal/reactivity.d.ts +15 -0
- package/dist/internal/reactivity.d.ts.map +1 -0
- package/dist/internal/reactivity.js +26 -0
- package/dist/internal/reactivity.js.map +1 -0
- package/dist/internal/reorder.d.ts +47 -0
- package/dist/internal/reorder.d.ts.map +1 -0
- package/dist/internal/reorder.js +250 -0
- package/dist/internal/reorder.js.map +1 -0
- package/dist/internal/scope.d.ts +28 -0
- package/dist/internal/scope.d.ts.map +1 -0
- package/dist/internal/scope.js +44 -0
- package/dist/internal/scope.js.map +1 -0
- package/dist/internal/server.d.ts +13 -0
- package/dist/internal/server.d.ts.map +1 -0
- package/dist/internal/server.js +13 -0
- package/dist/internal/server.js.map +1 -0
- package/dist/internal/server.node.d.ts +8 -0
- package/dist/internal/server.node.d.ts.map +1 -0
- package/dist/internal/server.node.js +8 -0
- package/dist/internal/server.node.js.map +1 -0
- package/dist/internal/services.d.ts +222 -0
- package/dist/internal/services.d.ts.map +1 -0
- package/dist/internal/services.js +338 -0
- package/dist/internal/services.js.map +1 -0
- package/dist/internal/tree.d.ts +71 -0
- package/dist/internal/tree.d.ts.map +1 -0
- package/dist/internal/tree.js +207 -0
- package/dist/internal/tree.js.map +1 -0
- package/dist/internal/variant-node.d.ts +62 -0
- package/dist/internal/variant-node.d.ts.map +1 -0
- package/dist/internal/variant-node.js +279 -0
- package/dist/internal/variant-node.js.map +1 -0
- package/dist/internal/view-transition.d.ts +10 -0
- package/dist/internal/view-transition.d.ts.map +1 -0
- package/dist/internal/view-transition.js +36 -0
- package/dist/internal/view-transition.js.map +1 -0
- package/dist/internal/walk.d.ts +26 -0
- package/dist/internal/walk.d.ts.map +1 -0
- package/dist/internal/walk.js +162 -0
- package/dist/internal/walk.js.map +1 -0
- package/package.json +99 -4
- package/src/AnimationControls.ts +46 -0
- package/src/AnimationScope.ts +19 -0
- package/src/DragControls.ts +27 -0
- package/src/Features.ts +45 -0
- package/src/Ward.ts +434 -0
- package/src/Wardic.ts +410 -0
- package/src/index.ts +20 -0
- package/src/internal/builder.ts +262 -0
- package/src/internal/commands.ts +359 -0
- package/src/internal/delivery.ts +116 -0
- package/src/internal/dev.production.ts +7 -0
- package/src/internal/dev.ts +9 -0
- package/src/internal/drag.ts +136 -0
- package/src/internal/element.ts +668 -0
- package/src/internal/gestures.ts +184 -0
- package/src/internal/hydrate.ts +29 -0
- package/src/internal/keys.ts +19 -0
- package/src/internal/layout.ts +109 -0
- package/src/internal/mount.ts +124 -0
- package/src/internal/presence.ts +362 -0
- package/src/internal/reactivity.ts +45 -0
- package/src/internal/reorder.ts +313 -0
- package/src/internal/scope.ts +60 -0
- package/src/internal/server.node.ts +7 -0
- package/src/internal/server.ts +12 -0
- package/src/internal/services.ts +486 -0
- package/src/internal/tree.ts +230 -0
- package/src/internal/variant-node.ts +352 -0
- package/src/internal/view-transition.ts +43 -0
- package/src/internal/walk.ts +211 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 the Wardic contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,60 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @wardic/foldkit
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[Wardic](https://wardic.dev) for [Foldkit](https://www.npmjs.com/package/foldkit): Motion's animations on Foldkit's views, as Effect. Shipped from Wardic 1.2 (#561), versioned with `@wardic/core`, `@wardic/dom` and `@wardic/test`.
|
|
4
|
+
|
|
5
|
+
```ts
|
|
6
|
+
import { DomLive } from "@wardic/dom"
|
|
7
|
+
import * as Wardic from "@wardic/foldkit/Wardic"
|
|
8
|
+
|
|
9
|
+
// Once, at module scope.
|
|
10
|
+
export const wardic = Wardic.make({ env: DomLive })
|
|
11
|
+
|
|
12
|
+
// In the view: `w.*` elements take Foldkit's attributes and Wardic's.
|
|
13
|
+
const view = (model: Model, h: HtmlBuilder<Message>): Html => {
|
|
14
|
+
const w = wardic.html(h)
|
|
15
|
+
return w.div([h.Class("app")], [
|
|
16
|
+
w.div([h.Class("card"), w.Initial({ opacity: 0, y: 8 }), w.Animate({ opacity: 1, y: 0 }), w.Transition({ duration: 0.3 })], [model.title]),
|
|
17
|
+
])
|
|
18
|
+
}
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
- The first `w.*` element to mount builds Wardic's services on the Handle's `env`, shared until the last has left. `w.Provider(options)` on the `w.*` element at the top names the root the subtree options hang on.
|
|
22
|
+
- An element animates its `Animate` target from `Initial` as it mounts, Retargets on a render that changes its target, and holds through one that doesn't.
|
|
23
|
+
- `h.div([...w.attributes({ initial, animate, transition, style, mount })])` puts a Ward on an element `w` doesn't make.
|
|
24
|
+
- Variants go down the DOM: a child with `w.Variants(…)` and no `Animate` of its own follows the name its nearest `w.*` ancestor hands down, staggered by that ancestor's `Transition` (`staggerChildren`, `delayChildren`, `when`). `w.Custom(value)` resolves its dynamic variants; `w.Inherit(false)` keeps it out.
|
|
25
|
+
- `arc({ strength })` (from the root) is a curved path for a transition's `path`: `x` and `y` travel along it together, as a `layoutId` flight's `w.Transition({ layout: { path } })`.
|
|
26
|
+
- `w.Config({ transition, reducedMotion, skipAnimations })` sets a subtree's defaults, over the Handle's `Wardic.make({ config })`.
|
|
27
|
+
- `w.OnAnimationStart(message | (definition) => message)` and `w.OnAnimationComplete(…)` send Messages to `update`; `Option.none()` from a function sends nothing.
|
|
28
|
+
- Live values are Atoms: `w.Style({ x: atom })` follows one through the gate, `w.Text(atom)` writes one as the element's text, `w.OnUpdate(atom)` sets one to the element's values each frame. Derived ones (`LiveValue.spring`, `follow`, `velocity`, `scroll`, re-exported from the root) are made in a Command through `Wardic.provide(effect)`, with `resources: wardic.resources` on the program; their Scope is the caller's, a `ManagedResource`'s or an `Effect.scoped`. A container's scroll is `Wardic.scroll({ container })`, Motion's `useScroll` as four Atoms, on the Handle's `scroll` Feature: name it, `Wardic.make({ env, features: [Features.scroll] })` (Solid's `createScroll` brings it by itself), or it fails with `ScrollFailed`. The pointer over an element is `Wardic.pointer(element)`: its place in the element's pixels, its progress across the box from 0 to 1 each way, the box's size, and whether it's inside, as Atoms set within the pointer's own events; a mouse and a pen unless `types` says; no Feature to name. A leave keeps the place, so a value that returns to rest with it is a derived Atom over `inside` (`Atom.readable`).
|
|
29
|
+
- `Wardic.animate(subject, values, options)` is an Effect for a Command: an element, a selector or a list, landing as `{ landed }`, failing `AnimationFailed` when the subject finds nothing; interrupting its fiber stops it where it is. `Wardic.animate(sequence, options)` plays a sequence of Segments laid out in time (`[["li", { opacity: 1 }, { delay: stagger(0.05) }], "shown", ["h1", { y: 0 }, { at: "shown" }]]`, with `at` times, labels and function Segments as Motion's), failing only when nothing in it animates.
|
|
30
|
+
- Animation scopes: `const scope = AnimationScope.make()` (from the root), `w.AnimationScope(scope)` on one element, then `Wardic.animate("li", values, { scope })` (either form) looks its selectors up inside that element; the element's release stops the animations started in the scope where they are, each awaiting Command then succeeding with `landed: false`; `scope.element()` is the element while it's mounted. Without a scope a selector resolves under the `w.Provider()` element, else the document; a scope not mounted finds nothing.
|
|
31
|
+
- A Retarget a patch makes paints its first step in the patch's frame: the binding tells the Frame loop it runs inside the frame (the **Held frame**'s cure).
|
|
32
|
+
- Presence: `w.ul([w.Presence({ mode, initial, custom, onExitComplete, propagate })], items.map((key) => w.keyed("li")(key, [w.Exit({ opacity: 0 }), …], [key])))` keeps each item Foldkit removes in its place while its `Exit` plays, in Motion's order through the patches that follow; one back under its key mid-exit takes over from where the leaver is. It needs `Wardic.make({ env, features: [Features.presence] })`, with `Features` from the root.
|
|
33
|
+
- Layout: `w.li([w.Layout(true)])` animates from where it was to where a patch put it, measured by a pass after every patch that changed the DOM (the child list, the text, `class` and `hidden`; `Wardic.make({ layoutAttributes })` adds yours; never `style`). `w.LayoutId("pill")` hands over across two views, and `w.LayoutCrossfade(false)` on the twin that takes over keeps one element visible through the handover, at its own opacity; `w.LayoutGroup({ id })` on an ancestor keeps its ids apart; `w.LayoutDependency(value)` asks for a pass as it changes; it and `Wardic.animateLayout` are the only triggers under `Wardic.make({ layoutTrigger: "declared" })`. `w.OnLayoutAnimationStart(message)` and `w.OnLayoutAnimationComplete(message)` send Messages; `w.OnBeforeLayoutMeasure(fn)` and `w.OnLayoutMeasure(fn)` are plain functions. It needs `Features.layout`. Put `w.Provider()` on the app's root: the observer then watches the app's tree alone, not the body (Foldkit's DevTools paint into it).
|
|
34
|
+
- `Wardic.animateLayout()` is an Effect for a Command run with the Model change that moved the layout elements: it waits for the render's commit, animates the change from where the elements were, and succeeds once every layout animation has ended; `LayoutFailed` without `Features.layout`.
|
|
35
|
+
- `Runtime.makeElement({ viewTransition: wardic.viewTransition(decide) })` wraps the app's predicate: in a render it transitions, layout moves and `layoutId` handovers land at once, for the View Transition's morph to carry; without `document.startViewTransition`, Wardic animates them itself.
|
|
36
|
+
- Gestures: `w.WhileHover({ scale: 1.05 })`, `w.WhileTap({ scale: 0.95 })`, `w.WhileFocus(…)` (the keyboard's focus) and `w.WhileInView(…)` with `w.Viewport({ once, margin, amount, root: "#scroller" })` (`root` a selector under the view, or `"parent"`) are entries in the Override stack, a name among them reaching the element's Variant children. `w.OnHoverStart(message | (event, info) => message)`, `w.OnHoverEnd(…)`, `w.OnTapStart(…)`, `w.OnTap(…)` and `w.OnTapCancel(…)` send Messages with the DOM's event and the gesture's info (its point in the viewport; a press's input, `"pointer"` or `"keyboard"`: Enter and Space press a focused element, which is made focusable); `w.OnViewportEnter(message | (entry) => message)` and `w.OnViewportLeave(…)` the browser's entry. A function runs at the event, so `event.stopPropagation()` works; its Message reaches `update` a microtask later. `w.Propagate({ tap: false })` keeps a press to its element. Each needs its Feature, `Features.hover`, `press`, `focus` or `inView` (`Features.domAnimation` is the four): without it the attribute is a type error naming the Feature.
|
|
37
|
+
- Drag: `w.div([w.Drag("x"), w.DragConstraints("parent"), w.WhileDrag({ scale: 1.05 }), w.OnDragEnd((event, info) => Message.Dropped({ x: info.offset.x }))], …)` follows the pointer on its axis and carries on at the speed it was let go. `w.DragConstraints` takes a box of pixels, `"parent"`, a selector under the view, or `false`; `w.DragElastic(0.2)`, `w.DragMomentum(false)`, `w.DragSnapToOrigin()`, `w.DragTransition({ power, timeConstant })`, `w.DragPropagation()`, `w.DragDirectionLock()` with `w.OnDirectionLock((axis) => message)`, `w.DragListener(false)` and `w.OnMeasureDragConstraints(fn)` are Motion's props; `w.OnDragStart(…)`, `w.OnDrag(…)` and `w.OnDragEnd(…)` send Messages with the drag's info (its offset, delta, velocity and point), `w.OnDragTransitionEnd(message)` once the element rests. The drag's options are read as its track starts, at the first render with `Drag`: give a changed one on a new key. The element gets `touch-action`, `user-select: none` and `draggable="false"` under its own `h.Style`. With `w.Layout()` the drag moves the element within its layout, and it returns to its slot on release. It needs `Features.drag`.
|
|
38
|
+
- Drag controls: `const controls = DragControls.make()` (from the root), `w.DragControls(controls)` on the element and `w.StartsDrag(controls, { snapToCursor })` on the grip it drags by (give the grip `touch-action: none`); `w.DragListener(false)` keeps the element's own presses from dragging it; `controls.stop()` and `controls.cancel()` end its drag from anywhere.
|
|
39
|
+
- Animation controls: `const controls = AnimationControls.make()` (from the root), `w.Animate(controls)` on any number of elements, then from a Command `AnimationControls.start(controls, "visible", transition?)`, an Effect that succeeds once each element and its Variant children have landed and, interrupted, stops them where they are; `controls.set(definition)` lands them at once and `controls.stop()` ends them where they are, both synchronous (`Effect.sync`). A definition is a variant name, a target, or a function of the element's `Custom`, called once per element. An element keeps the controls it mounted with: key it to mount it with others. On a server it renders its `Initial` and plays nothing until a start.
|
|
40
|
+
- Pan: `w.OnPanSessionStart(…)`, `w.OnPanStart(…)`, `w.OnPan(…)` and `w.OnPanEnd(…)` send Messages as a pointer pans the element, which moves nothing itself. `w.Config({ transformPagePoint })`, or `Wardic.make({ config: { transformPagePoint } })`, maps a drag's and a pan's points: `correctParentTransform(parent)` turns them back through a parent's CSS transform, `transformViewBoxPoint(svg)` into an SVG's viewBox units, each given an element, an accessor or a selector looked up in the document at each point (both from the root). It needs `Features.pan` (`Features.domMax` is every DOM Feature).
|
|
41
|
+
- Reorder: `w.ul([w.ReorderGroup({ values: model.items, onReorder: (items) => Message.Items({ items }) })], items.map((key) => w.keyed("li")(key, [w.ReorderItem(key)], [key])))` puts the keyed items in order by dragging them, or from the keyboard (Space lifts, the arrows move, Space drops, Escape cancels, each announced). The order lives in the Model: `onReorder` sends the whole new order at each Crossover; `onReorderEnd`, `onHoldStart` and `onHoldEnd` send Messages too; `axis`, `keyboard`, `announcements` and `instructions` are Motion's and Wardic's options. Each item is a layout element (`w.Layout("position")` beside it moves its place alone) dragged on the group's axis; a `StartsDrag` element inside it, with `w.DragListener(false)` and `w.DragControls(controls)` on the item, drags it by that element alone. It needs `Features.layout` and `Features.drag`. `wardic.Reorder` is the group's Mount for a Scene test.
|
|
42
|
+
- Features load lazily too: `Wardic.make({ env, features: () => import("./features.ts").then((m) => m.domMax) })`. An element mounted before the load arrives starts its gestures, its drag's track and its layout node once it has.
|
|
43
|
+
- Server rendering: Foldkit's `renderToString` (its `experimental/server`, `makeApplication` programs only) renders every `w.*` element at its Starting style with no runtime and no Mount, as a server does: a Variant child's inherited one included under `w.Provider()`, and a `w.Presence({ initial: false })` child's `Animate`. Put one `w.Provider()` on the topmost `w.*` element: the walk that writes them starts there, a `w.*` ancestor above it isn't seen, and a second one's rules collide with the first's (a nested one's are dropped). The package's `node`, `worker` and `deno` export conditions tell a server from a client. Appear animations (ADR-0044): under `w.Provider()`, each `w.*` element the server can sample plays its mount animation from the first paint, before the script runs, its rules in a `<style>` the Provider element renders as its first child; `Wardic.make({ appear: false })` turns them off, `"explain"` says in development why an element waits for the JavaScript, `nonce` goes on that `<style>`, and `w.Appear(false)` keeps one element out. On the client, `wardic.hydrate(program, { buildId })` takes `Runtime.hydrate`'s place in the entry: it moves those rules into the head before Foldkit adopts the page, and has the hydration render keep each running animation, which the element's ward takes over where the CSS has got, with no flicker (the Handoff). Give the server's `renderToString` and `wardic.hydrate` one `buildId` (or build both with `@foldkit/vite-plugin`). `Runtime.hydrate` called directly finds a `<style>` the view lacks and rebuilds the Provider element's subtree, and strips each running animation back to its Starting style.
|
|
44
|
+
- Scene tests resolve Wardic's Mounts by name: `Scene.Mount.resolve(wardic.Element, Done())`, `wardic.Provider` and `wardic.Presence`.
|
|
45
|
+
|
|
46
|
+
## Deviations
|
|
47
|
+
|
|
48
|
+
What this binding does differently from `@wardic/solid`, for what Foldkit gives it:
|
|
49
|
+
|
|
50
|
+
- **The References and the Tracer reach Wardic through `env`** (ADR-0071, decision 10). A `w.*` element's Mount never sees the program's `resources`, so a Tracer or a Reference set there doesn't reach Wardic's Layer: give them in `Wardic.make({ env })`, as `Layer.merge(DomLive, …)`, until Foldkit gives Mounts services.
|
|
51
|
+
- **`wardic.hydrate`, not `Runtime.hydrate`**, for a server-rendered page (above): Foldkit has no head channel for the Appear rules and no hook around its hydration render, so the Handle does both before it hands Foldkit the program.
|
|
52
|
+
- **Server rendering is for `makeApplication` programs**: Foldkit's `renderToString` and `Runtime.hydrate` take those alone; a `makeElement` program renders on the client.
|
|
53
|
+
- **No Playback controls**: Solid's `animate` returns them (pause, play, speed, time, complete, cancel); on Foldkit the Effect is the handle, awaited for its end and interrupted to stop it (an `interrupt: true` Command's second dispatch), so pause, speed and seek have no place to live.
|
|
54
|
+
- **One `w.Provider()`, on the topmost `w.*` element**: Foldkit has no wrapper node, so the element carrying the Provider attribute is the root of the walk that writes the server's styles and samples its Appear animations (above).
|
|
55
|
+
|
|
56
|
+
The rest is as `@wardic/solid` has it, an attribute for each prop.
|
|
57
|
+
|
|
58
|
+
- Docs: https://wardic.dev
|
|
59
|
+
- Source: https://github.com/wardiclabs/wardic/tree/main/packages/foldkit
|
|
60
|
+
- Licence: MIT
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
# Third-party notices
|
|
2
|
+
|
|
3
|
+
Wardic follows the API of [Motion](https://motion.dev) for React, and parts of its source are ported from Motion's: rewritten in Wardic's own style, keeping Motion's algorithms, formulas and constants so the results match. Motion is MIT licensed, and its notice follows.
|
|
4
|
+
|
|
5
|
+
## Motion
|
|
6
|
+
|
|
7
|
+
https://github.com/motiondivision/motion
|
|
8
|
+
|
|
9
|
+
Ported from Motion's source:
|
|
10
|
+
|
|
11
|
+
- `@wardic/core`:
|
|
12
|
+
- `Box` and `Projection`: the projection geometry (`motion-dom`'s `projection/geometry`: `models`, `delta-calc`, `delta-apply`, `applyTreeDeltas`);
|
|
13
|
+
- `Spring`: the solver for a spring's stiffness and damping from its duration and bounce (`findSpring`);
|
|
14
|
+
- `Velocity`: a gesture's velocity from its points (`getVelocity`);
|
|
15
|
+
- `Reorder`: moving an item, and the axis a list runs on (`moveItem`, `detectAxis`);
|
|
16
|
+
- `AutoScroll`: scrolling a container while an item is dragged near its edge (`autoScrollIfNeeded`).
|
|
17
|
+
- `@wardic/dom`:
|
|
18
|
+
- the projection transform (`buildProjectionTransform`);
|
|
19
|
+
- the scroll offsets (`render/dom/scroll/offsets`).
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
The MIT License (MIT)
|
|
23
|
+
|
|
24
|
+
Copyright (c) 2024 [Motion](https://motion.dev) B.V.
|
|
25
|
+
|
|
26
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
27
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
28
|
+
in the Software without restriction, including without limitation the rights
|
|
29
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
30
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
31
|
+
furnished to do so, subject to the following conditions:
|
|
32
|
+
|
|
33
|
+
The above copyright notice and this permission notice shall be included in all
|
|
34
|
+
copies or substantial portions of the Software.
|
|
35
|
+
|
|
36
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
37
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
38
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
39
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
40
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
41
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
42
|
+
SOFTWARE.
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Manrope
|
|
46
|
+
|
|
47
|
+
https://github.com/googlefonts/manrope
|
|
48
|
+
|
|
49
|
+
The docs site serves Manrope for its headings (`site/public/fonts/manrope-latin.woff2`, its variable weights 600 to 800, Latin only, with its licence beside it as `OFL.txt`), and Wardic's wordmark is "wardic" set in Manrope ExtraBold and outlined (`brand/`, and the docs header's logo, `site/src/components/logo-paths.ts`). Manrope is licensed under the SIL Open Font License, Version 1.1.
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
Copyright 2018 The Manrope Project Authors (https://github.com/googlefonts/manrope)
|
|
53
|
+
|
|
54
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
55
|
+
This license is copied below, and is also available with a FAQ at:
|
|
56
|
+
http://scripts.sil.org/OFL
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
-----------------------------------------------------------
|
|
60
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
61
|
+
-----------------------------------------------------------
|
|
62
|
+
|
|
63
|
+
PREAMBLE
|
|
64
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
65
|
+
development of collaborative font projects, to support the font creation
|
|
66
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
67
|
+
open framework in which fonts may be shared and improved in partnership
|
|
68
|
+
with others.
|
|
69
|
+
|
|
70
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
71
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
72
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
73
|
+
redistributed and/or sold with any software provided that any reserved
|
|
74
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
75
|
+
however, cannot be released under any other type of license. The
|
|
76
|
+
requirement for fonts to remain under this license does not apply
|
|
77
|
+
to any document created using the fonts or their derivatives.
|
|
78
|
+
|
|
79
|
+
DEFINITIONS
|
|
80
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
81
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
82
|
+
include source files, build scripts and documentation.
|
|
83
|
+
|
|
84
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
85
|
+
copyright statement(s).
|
|
86
|
+
|
|
87
|
+
"Original Version" refers to the collection of Font Software components as
|
|
88
|
+
distributed by the Copyright Holder(s).
|
|
89
|
+
|
|
90
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
91
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
92
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
93
|
+
new environment.
|
|
94
|
+
|
|
95
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
96
|
+
writer or other person who contributed to the Font Software.
|
|
97
|
+
|
|
98
|
+
PERMISSION & CONDITIONS
|
|
99
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
100
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
101
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
102
|
+
Software, subject to the following conditions:
|
|
103
|
+
|
|
104
|
+
1) Neither the Font Software nor any of its individual components,
|
|
105
|
+
in Original or Modified Versions, may be sold by itself.
|
|
106
|
+
|
|
107
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
108
|
+
redistributed and/or sold with any software, provided that each copy
|
|
109
|
+
contains the above copyright notice and this license. These can be
|
|
110
|
+
included either as stand-alone text files, human-readable headers or
|
|
111
|
+
in the appropriate machine-readable metadata fields within text or
|
|
112
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
113
|
+
|
|
114
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
115
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
116
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
117
|
+
presented to the users.
|
|
118
|
+
|
|
119
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
120
|
+
Software shall not be used to promote, endorse or advertise any
|
|
121
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
122
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
123
|
+
permission.
|
|
124
|
+
|
|
125
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
126
|
+
must be distributed entirely under this license, and must not be
|
|
127
|
+
distributed under any other license. The requirement for fonts to
|
|
128
|
+
remain under this license does not apply to any document created
|
|
129
|
+
using the Font Software.
|
|
130
|
+
|
|
131
|
+
TERMINATION
|
|
132
|
+
This license becomes null and void if any of the above conditions are
|
|
133
|
+
not met.
|
|
134
|
+
|
|
135
|
+
DISCLAIMER
|
|
136
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
137
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
138
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
139
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
140
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
141
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
142
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
143
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
144
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
145
|
+
```
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **Animation controls** on Foldkit (#433, Motion's `useAnimationControls`; #798, Q2–Q4, Q13 and Q18):
|
|
3
|
+
* made apart from any element with {@link make}, at module scope or in the Model's making, and given to
|
|
4
|
+
* any number of `w.*` elements as `w.Animate(controls)` (the bundle's `animate` too). {@link start}
|
|
5
|
+
* animates each to a definition as a change of its `Animate` would, its Variant children following, as
|
|
6
|
+
* an Effect for a Command: it succeeds once they have landed, and interrupting it stops them where
|
|
7
|
+
* they are. `controls.set(definition)` lands them at once and `controls.stop()` ends them where they
|
|
8
|
+
* are, both synchronous, run from `Effect.sync` in a Command. An element hears the controls it mounted
|
|
9
|
+
* with, until it unmounts.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const controls = AnimationControls.make()
|
|
13
|
+
* // in the view
|
|
14
|
+
* w.ul([w.Initial("hidden"), w.Animate(controls), w.Variants(list)], items)
|
|
15
|
+
* // in a Command
|
|
16
|
+
* const Open = Command.define("Open", { messages: [Message.Opened], execute: AnimationControls.start(controls, "visible").pipe(Effect.as(Message.Opened())) })
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
import * as CoreControls from "@wardic/core/unstable/AnimationControls";
|
|
21
|
+
import type * as WardConfig from "@wardic/dom/unstable/WardConfig";
|
|
22
|
+
import * as Effect from "effect/Effect";
|
|
23
|
+
/** The controls: `start(definition, transition?)`, `set(definition)` and `stop()`, over every element given them. */
|
|
24
|
+
export type AnimationControls = CoreControls.WardicAnimationControls;
|
|
25
|
+
/** What a start or set animates to (Motion's): a variant name, or names, a target's values, or a function of the element's `Custom`, values and velocities, called once per element. */
|
|
26
|
+
export type Definition = CoreControls.WardicControlsDefinition;
|
|
27
|
+
/** Makes animation controls (Motion's `useAnimationControls`): needs no element, and outlives the elements given them. */
|
|
28
|
+
export declare const make: () => AnimationControls;
|
|
29
|
+
/**
|
|
30
|
+
* Animates every element given `controls`, and its Variant children, to `definition`, as a change of
|
|
31
|
+
* its `Animate` would (an `Effect` for a Command): `transition`, when given, is the transition of this
|
|
32
|
+
* change over the definition's own, and its stagger. Succeeds once each element and its children have
|
|
33
|
+
* landed, at once with no element given the controls; interrupting it ends every element the controls
|
|
34
|
+
* reach where it is, as `controls.stop()` does.
|
|
35
|
+
*/
|
|
36
|
+
export declare const start: (controls: AnimationControls, definition: Definition, transition?: WardConfig.WardicTransition) => Effect.Effect<void>;
|
|
37
|
+
//# sourceMappingURL=AnimationControls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimationControls.d.ts","sourceRoot":"","sources":["../src/AnimationControls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,YAAY,MAAM,yCAAyC,CAAA;AACvE,OAAO,KAAK,KAAK,UAAU,MAAM,iCAAiC,CAAA;AAClE,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,qHAAqH;AACrH,MAAM,MAAM,iBAAiB,GAAG,YAAY,CAAC,uBAAuB,CAAA;AAEpE,wLAAwL;AACxL,MAAM,MAAM,UAAU,GAAG,YAAY,CAAC,wBAAwB,CAAA;AAE9D,0HAA0H;AAC1H,eAAO,MAAM,IAAI,EAAE,MAAM,iBAAwD,CAAA;AAIjF;;;;;;GAMG;AACH,eAAO,MAAM,KAAK,aAAc,iBAAiB,cAAc,UAAU,eAAe,UAAU,CAAC,gBAAgB,KAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAIpI,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **Animation controls** on Foldkit (#433, Motion's `useAnimationControls`; #798, Q2–Q4, Q13 and Q18):
|
|
3
|
+
* made apart from any element with {@link make}, at module scope or in the Model's making, and given to
|
|
4
|
+
* any number of `w.*` elements as `w.Animate(controls)` (the bundle's `animate` too). {@link start}
|
|
5
|
+
* animates each to a definition as a change of its `Animate` would, its Variant children following, as
|
|
6
|
+
* an Effect for a Command: it succeeds once they have landed, and interrupting it stops them where
|
|
7
|
+
* they are. `controls.set(definition)` lands them at once and `controls.stop()` ends them where they
|
|
8
|
+
* are, both synchronous, run from `Effect.sync` in a Command. An element hears the controls it mounted
|
|
9
|
+
* with, until it unmounts.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const controls = AnimationControls.make()
|
|
13
|
+
* // in the view
|
|
14
|
+
* w.ul([w.Initial("hidden"), w.Animate(controls), w.Variants(list)], items)
|
|
15
|
+
* // in a Command
|
|
16
|
+
* const Open = Command.define("Open", { messages: [Message.Opened], execute: AnimationControls.start(controls, "visible").pipe(Effect.as(Message.Opened())) })
|
|
17
|
+
*
|
|
18
|
+
* @module
|
|
19
|
+
*/
|
|
20
|
+
import * as CoreControls from "@wardic/core/unstable/AnimationControls";
|
|
21
|
+
import * as Effect from "effect/Effect";
|
|
22
|
+
/** Makes animation controls (Motion's `useAnimationControls`): needs no element, and outlives the elements given them. */
|
|
23
|
+
export const make = CoreControls.createAnimationControls;
|
|
24
|
+
// #798, Q3, Q13 and Q18: core's promise as an Effect, interruption as the controls' stop. No `Wardic`
|
|
25
|
+
// service: the controls reach elements through their Mounts.
|
|
26
|
+
/**
|
|
27
|
+
* Animates every element given `controls`, and its Variant children, to `definition`, as a change of
|
|
28
|
+
* its `Animate` would (an `Effect` for a Command): `transition`, when given, is the transition of this
|
|
29
|
+
* change over the definition's own, and its stagger. Succeeds once each element and its children have
|
|
30
|
+
* landed, at once with no element given the controls; interrupting it ends every element the controls
|
|
31
|
+
* reach where it is, as `controls.stop()` does.
|
|
32
|
+
*/
|
|
33
|
+
export const start = (controls, definition, transition) => Effect.callback((resume) => {
|
|
34
|
+
void controls.start(definition, transition).then(() => resume(Effect.void));
|
|
35
|
+
return Effect.sync(() => controls.stop());
|
|
36
|
+
});
|
|
37
|
+
//# sourceMappingURL=AnimationControls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimationControls.js","sourceRoot":"","sources":["../src/AnimationControls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AACH,OAAO,KAAK,YAAY,MAAM,yCAAyC,CAAA;AAEvE,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAQvC,0HAA0H;AAC1H,MAAM,CAAC,MAAM,IAAI,GAA4B,YAAY,CAAC,uBAAuB,CAAA;AAEjF,sGAAsG;AACtG,6DAA6D;AAC7D;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,QAA2B,EAAE,UAAsB,EAAE,UAAwC,EAAuB,EAAE,CAC1I,MAAM,CAAC,QAAQ,CAAO,CAAC,MAAM,EAAE,EAAE;IAC/B,KAAK,QAAQ,CAAC,KAAK,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAA;IAC3E,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAA;AAC3C,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **Animation scopes** on Foldkit (#433, Motion's `useAnimate`'s scope; #798, Q7–Q9): made apart from any
|
|
3
|
+
* element with {@link make}, at module scope or in the Model's making, and given to one `w.*` element as
|
|
4
|
+
* `w.AnimationScope(scope)` (the bundle's `animationScope` too). A Command's `Wardic.animate(subject,
|
|
5
|
+
* values, { scope })`, or `Wardic.animate(sequence, { scope })`, then looks its selectors up inside that
|
|
6
|
+
* element, and the element's release stops the animations started in the scope where they are, each
|
|
7
|
+
* awaiting Command then succeeding with `landed: false`. `scope.element()` is the element while it's
|
|
8
|
+
* mounted. Without a scope, selectors resolve under the `w.Provider()` element, else the document.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const listScope = AnimationScope.make()
|
|
12
|
+
* // in the view
|
|
13
|
+
* w.ul([w.AnimationScope(listScope)], items)
|
|
14
|
+
* // in a Command
|
|
15
|
+
* Wardic.animate("li", { opacity: 1 }, { delay: stagger(0.05), scope: listScope })
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
export { type AnimationScope, make } from "./internal/scope.ts";
|
|
20
|
+
//# sourceMappingURL=AnimationScope.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimationScope.d.ts","sourceRoot":"","sources":["../src/AnimationScope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAE,KAAK,cAAc,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **Animation scopes** on Foldkit (#433, Motion's `useAnimate`'s scope; #798, Q7–Q9): made apart from any
|
|
3
|
+
* element with {@link make}, at module scope or in the Model's making, and given to one `w.*` element as
|
|
4
|
+
* `w.AnimationScope(scope)` (the bundle's `animationScope` too). A Command's `Wardic.animate(subject,
|
|
5
|
+
* values, { scope })`, or `Wardic.animate(sequence, { scope })`, then looks its selectors up inside that
|
|
6
|
+
* element, and the element's release stops the animations started in the scope where they are, each
|
|
7
|
+
* awaiting Command then succeeding with `landed: false`. `scope.element()` is the element while it's
|
|
8
|
+
* mounted. Without a scope, selectors resolve under the `w.Provider()` element, else the document.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* const listScope = AnimationScope.make()
|
|
12
|
+
* // in the view
|
|
13
|
+
* w.ul([w.AnimationScope(listScope)], items)
|
|
14
|
+
* // in a Command
|
|
15
|
+
* Wardic.animate("li", { opacity: 1 }, { delay: stagger(0.05), scope: listScope })
|
|
16
|
+
*
|
|
17
|
+
* @module
|
|
18
|
+
*/
|
|
19
|
+
export { make } from "./internal/scope.js";
|
|
20
|
+
//# sourceMappingURL=AnimationScope.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AnimationScope.js","sourceRoot":"","sources":["../src/AnimationScope.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAuB,IAAI,EAAE,MAAM,qBAAqB,CAAA"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **Drag controls** on Foldkit (#431, Motion's `useDragControls`; #793, Q8): made apart from any element
|
|
3
|
+
* with {@link make}, at module scope or in the Model's making, and given to a `w.*` element as
|
|
4
|
+
* `w.DragControls(controls)`. Its drag then starts from a pointer pressed on the `StartsDrag` element
|
|
5
|
+
* (`w.StartsDrag(controls, options)`), or from `controls.start(event)` wherever a pointer went down;
|
|
6
|
+
* `controls.stop()` ends each drag as a release would, `controls.cancel()` where it is. Add
|
|
7
|
+
* `w.DragListener(false)` when a press on the element itself shouldn't drag it.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const controls = DragControls.make()
|
|
11
|
+
* w.div([w.Drag("y"), w.DragControls(controls), w.DragListener(false)], [
|
|
12
|
+
* w.div([w.StartsDrag(controls), h.Style({ "touch-action": "none" })], ["⋮⋮"]),
|
|
13
|
+
* "a row dragged by its grip",
|
|
14
|
+
* ])
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
import * as DomDragControls from "@wardic/dom/unstable/DragControls";
|
|
19
|
+
/** The controls: `start(event, options?)`, `stop()` and `cancel()`, over every element given them. */
|
|
20
|
+
export type DragControls = DomDragControls.WardicDragControls;
|
|
21
|
+
/** `start`'s options (Motion's): `snapToCursor` moves the element's centre under the pointer as the drag begins; `distanceThreshold` is how far it moves first, 3 px by default. */
|
|
22
|
+
export type StartOptions = DomDragControls.WardicDragControlsOptions;
|
|
23
|
+
/** Makes drag controls (Motion's `useDragControls`): needs no element, and outlives the elements given them. */
|
|
24
|
+
export declare const make: () => DragControls;
|
|
25
|
+
//# sourceMappingURL=DragControls.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragControls.d.ts","sourceRoot":"","sources":["../src/DragControls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,eAAe,MAAM,mCAAmC,CAAA;AAEpE,sGAAsG;AACtG,MAAM,MAAM,YAAY,GAAG,eAAe,CAAC,kBAAkB,CAAA;AAE7D,oLAAoL;AACpL,MAAM,MAAM,YAAY,GAAG,eAAe,CAAC,yBAAyB,CAAA;AAEpE,gHAAgH;AAChH,eAAO,MAAM,IAAI,EAAE,MAAM,YAAiD,CAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* **Drag controls** on Foldkit (#431, Motion's `useDragControls`; #793, Q8): made apart from any element
|
|
3
|
+
* with {@link make}, at module scope or in the Model's making, and given to a `w.*` element as
|
|
4
|
+
* `w.DragControls(controls)`. Its drag then starts from a pointer pressed on the `StartsDrag` element
|
|
5
|
+
* (`w.StartsDrag(controls, options)`), or from `controls.start(event)` wherever a pointer went down;
|
|
6
|
+
* `controls.stop()` ends each drag as a release would, `controls.cancel()` where it is. Add
|
|
7
|
+
* `w.DragListener(false)` when a press on the element itself shouldn't drag it.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const controls = DragControls.make()
|
|
11
|
+
* w.div([w.Drag("y"), w.DragControls(controls), w.DragListener(false)], [
|
|
12
|
+
* w.div([w.StartsDrag(controls), h.Style({ "touch-action": "none" })], ["⋮⋮"]),
|
|
13
|
+
* "a row dragged by its grip",
|
|
14
|
+
* ])
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
import * as DomDragControls from "@wardic/dom/unstable/DragControls";
|
|
19
|
+
/** Makes drag controls (Motion's `useDragControls`): needs no element, and outlives the elements given them. */
|
|
20
|
+
export const make = DomDragControls.createDragControls;
|
|
21
|
+
//# sourceMappingURL=DragControls.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DragControls.js","sourceRoot":"","sources":["../src/DragControls.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,eAAe,MAAM,mCAAmC,CAAA;AAQpE,gHAAgH;AAChH,MAAM,CAAC,MAAM,IAAI,GAAuB,eAAe,CAAC,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The **Features** a Handle takes (#511, ADR-0067; ADR-0071 *Amendment (#516)*, and *Amendment (#791)*
|
|
3
|
+
* at slices 2 and 3): `Wardic.make({ env, features: [Features.layout, Features.presence] })`, or a
|
|
4
|
+
* preset, `features: Features.domAnimation`, or a load, `features: () => import("./features.ts").then((m) => m.domMax)`.
|
|
5
|
+
* Without one, a `w.*` element is Slim: a gesture attribute is then a type error naming its Feature,
|
|
6
|
+
* and at runtime warns once in development and does nothing. The DOM's Features are `@wardic/dom`'s;
|
|
7
|
+
* `presence` is the binding's own, since `w.Presence` sits on the shared builder and dom's presence
|
|
8
|
+
* controller would otherwise ship to every Foldkit app.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* import { DomLive } from "@wardic/dom"
|
|
12
|
+
* import { Features, Wardic } from "@wardic/foldkit"
|
|
13
|
+
*
|
|
14
|
+
* const wardic = Wardic.make({ env: DomLive, features: [Features.domAnimation, Features.presence] })
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
import * as Feature from "@wardic/dom/unstable/Feature";
|
|
19
|
+
import { PresenceMaker, type PresenceMakerShape } from "./internal/keys.ts";
|
|
20
|
+
export { layout } from "@wardic/dom/unstable/features/Layout";
|
|
21
|
+
export { hover } from "@wardic/dom/unstable/features/Hover";
|
|
22
|
+
export { press } from "@wardic/dom/unstable/features/Press";
|
|
23
|
+
export { focus } from "@wardic/dom/unstable/features/Focus";
|
|
24
|
+
export { inView } from "@wardic/dom/unstable/features/InView";
|
|
25
|
+
export { pan } from "@wardic/dom/unstable/features/Pan";
|
|
26
|
+
export { drag } from "@wardic/dom/unstable/features/Drag";
|
|
27
|
+
export { scroll } from "@wardic/dom/unstable/features/Scroll";
|
|
28
|
+
export { domAnimation } from "@wardic/dom/unstable/features/DomAnimation";
|
|
29
|
+
export { domMax } from "@wardic/dom/unstable/features/DomMax";
|
|
30
|
+
/**
|
|
31
|
+
* Presence (ADR-0007; ADR-0071 decision 29): `w.Presence` on a parent keeps each child Foldkit removes
|
|
32
|
+
* on the page while its `w.Exit` plays, in Motion's order, with `mode`, `custom`, `onExitComplete`,
|
|
33
|
+
* `propagate` and the rest of Motion's `AnimatePresence` props.
|
|
34
|
+
*/
|
|
35
|
+
export declare const presence: Feature.Feature<PresenceMaker, PresenceMakerShape, "presence">;
|
|
36
|
+
//# sourceMappingURL=Features.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Features.d.ts","sourceRoot":"","sources":["../src/Features.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAA;AAGvD,OAAO,EAAE,aAAa,EAAE,KAAK,kBAAkB,EAAE,MAAM,oBAAoB,CAAA;AAE3E,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAA;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAA;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAA;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAA;AAC7D,OAAO,EAAE,GAAG,EAAE,MAAM,mCAAmC,CAAA;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAA;AAGzD,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAA;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAA;AAE7D;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,OAAO,CAAC,OAAO,CAAC,aAAa,EAAE,kBAAkB,EAAE,UAAU,CAInF,CAAA"}
|
package/dist/Features.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The **Features** a Handle takes (#511, ADR-0067; ADR-0071 *Amendment (#516)*, and *Amendment (#791)*
|
|
3
|
+
* at slices 2 and 3): `Wardic.make({ env, features: [Features.layout, Features.presence] })`, or a
|
|
4
|
+
* preset, `features: Features.domAnimation`, or a load, `features: () => import("./features.ts").then((m) => m.domMax)`.
|
|
5
|
+
* Without one, a `w.*` element is Slim: a gesture attribute is then a type error naming its Feature,
|
|
6
|
+
* and at runtime warns once in development and does nothing. The DOM's Features are `@wardic/dom`'s;
|
|
7
|
+
* `presence` is the binding's own, since `w.Presence` sits on the shared builder and dom's presence
|
|
8
|
+
* controller would otherwise ship to every Foldkit app.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* import { DomLive } from "@wardic/dom"
|
|
12
|
+
* import { Features, Wardic } from "@wardic/foldkit"
|
|
13
|
+
*
|
|
14
|
+
* const wardic = Wardic.make({ env: DomLive, features: [Features.domAnimation, Features.presence] })
|
|
15
|
+
*
|
|
16
|
+
* @module
|
|
17
|
+
*/
|
|
18
|
+
import * as Feature from "@wardic/dom/unstable/Feature";
|
|
19
|
+
import * as PresenceController from "@wardic/dom/unstable/PresenceController";
|
|
20
|
+
import * as Layer from "effect/Layer";
|
|
21
|
+
import { PresenceMaker } from "./internal/keys.js";
|
|
22
|
+
export { layout } from "@wardic/dom/unstable/features/Layout";
|
|
23
|
+
export { hover } from "@wardic/dom/unstable/features/Hover";
|
|
24
|
+
export { press } from "@wardic/dom/unstable/features/Press";
|
|
25
|
+
export { focus } from "@wardic/dom/unstable/features/Focus";
|
|
26
|
+
export { inView } from "@wardic/dom/unstable/features/InView";
|
|
27
|
+
export { pan } from "@wardic/dom/unstable/features/Pan";
|
|
28
|
+
export { drag } from "@wardic/dom/unstable/features/Drag";
|
|
29
|
+
// #795 (the storefront's part 2): a container's scroll as Live values, which Solid's `createScroll` brings
|
|
30
|
+
// by itself; a Foldkit app names it here, and `Wardic.scroll` reads on it.
|
|
31
|
+
export { scroll } from "@wardic/dom/unstable/features/Scroll";
|
|
32
|
+
export { domAnimation } from "@wardic/dom/unstable/features/DomAnimation";
|
|
33
|
+
export { domMax } from "@wardic/dom/unstable/features/DomMax";
|
|
34
|
+
/**
|
|
35
|
+
* Presence (ADR-0007; ADR-0071 decision 29): `w.Presence` on a parent keeps each child Foldkit removes
|
|
36
|
+
* on the page while its `w.Exit` plays, in Motion's order, with `mode`, `custom`, `onExitComplete`,
|
|
37
|
+
* `propagate` and the rest of Motion's `AnimatePresence` props.
|
|
38
|
+
*/
|
|
39
|
+
export const presence = {
|
|
40
|
+
name: "presence",
|
|
41
|
+
key: PresenceMaker,
|
|
42
|
+
layer: /*#__PURE__*/ Layer.succeed(PresenceMaker)({ make: PresenceController.makePresence, events: PresenceController.exitCompleteEvents, propagateTo: PresenceController.propagateTo }),
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=Features.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Features.js","sourceRoot":"","sources":["../src/Features.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,KAAK,OAAO,MAAM,8BAA8B,CAAA;AACvD,OAAO,KAAK,kBAAkB,MAAM,yCAAyC,CAAA;AAC7E,OAAO,KAAK,KAAK,MAAM,cAAc,CAAA;AACrC,OAAO,EAAE,aAAa,EAA2B,MAAM,oBAAoB,CAAA;AAE3E,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAA;AAC7D,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAA;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAA;AAC3D,OAAO,EAAE,KAAK,EAAE,MAAM,qCAAqC,CAAA;AAC3D,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAA;AAC7D,OAAO,EAAE,GAAG,EAAE,MAAM,mCAAmC,CAAA;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,oCAAoC,CAAA;AACzD,2GAA2G;AAC3G,2EAA2E;AAC3E,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAA;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,4CAA4C,CAAA;AACzE,OAAO,EAAE,MAAM,EAAE,MAAM,sCAAsC,CAAA;AAE7D;;;;GAIG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAmE;IACtF,IAAI,EAAE,UAAU;IAChB,GAAG,EAAE,aAAa;IAClB,KAAK,EAAE,aAAa,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC,EAAE,IAAI,EAAE,kBAAkB,CAAC,YAAY,EAAE,MAAM,EAAE,kBAAkB,CAAC,kBAAkB,EAAE,WAAW,EAAE,kBAAkB,CAAC,WAAW,EAAE,CAAC;CACzL,CAAA"}
|