foldkit 0.92.0 → 0.94.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/customElement/index.d.ts +78 -0
- package/dist/customElement/index.d.ts.map +1 -0
- package/dist/customElement/index.js +109 -0
- package/dist/customElement/public.d.ts +3 -0
- package/dist/customElement/public.d.ts.map +1 -0
- package/dist/customElement/public.js +1 -0
- package/dist/devTools/overlay-styles.d.ts +1 -1
- package/dist/devTools/overlay-styles.d.ts.map +1 -1
- package/dist/devTools/overlay-styles.js +65 -0
- package/dist/devTools/overlay.d.ts.map +1 -1
- package/dist/devTools/overlay.js +154 -41
- package/dist/html/index.d.ts +34 -1
- package/dist/html/index.d.ts.map +1 -1
- package/dist/html/index.js +11 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/route/parser.js +1 -1
- package/dist/runtime/public.d.ts +1 -1
- package/dist/runtime/public.d.ts.map +1 -1
- package/dist/runtime/runtime.d.ts +11 -2
- package/dist/runtime/runtime.d.ts.map +1 -1
- package/dist/runtime/runtime.js +9 -1
- package/dist/ui/dragAndDrop/index.d.ts +3 -3
- package/dist/ui/slider/index.d.ts +70 -12
- package/dist/ui/slider/index.d.ts.map +1 -1
- package/dist/ui/slider/index.js +34 -15
- package/dist/ui/slider/public.d.ts +1 -1
- package/dist/ui/slider/public.d.ts.map +1 -1
- package/dist/ui/slider/public.js +1 -1
- package/package.json +10 -6
package/dist/route/parser.js
CHANGED
|
@@ -121,7 +121,7 @@ export const oneOf = (...parsers) => ({
|
|
|
121
121
|
onEmpty: () => Effect.fail(new ParseError({
|
|
122
122
|
message: `No parsers provided for path: /${Array.join(segments, '/')}`,
|
|
123
123
|
})),
|
|
124
|
-
onNonEmpty: (
|
|
124
|
+
onNonEmpty: () => Effect.firstSuccessOf(Array.map(parsers, parser => parser.parse(segments, search))),
|
|
125
125
|
}),
|
|
126
126
|
});
|
|
127
127
|
/**
|
package/dist/runtime/public.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { makeProgram, run } from './runtime.js';
|
|
2
|
-
export type { RoutingConfig, CrashConfig, CrashContext, RoutingProgramConfigWithFlags, RoutingProgramConfig, ProgramConfigWithFlags, ProgramConfig, ProgramInit, RoutingProgramInit, MakeRuntimeReturn, Visibility, SlowViewContext, SlowViewConfig, DevToolsConfig, } from './runtime.js';
|
|
2
|
+
export type { RoutingConfig, CrashConfig, CrashContext, RoutingProgramConfigWithFlags, RoutingProgramConfig, ProgramConfigWithFlags, ProgramConfig, ProgramInit, RoutingProgramInit, MakeRuntimeReturn, Visibility, SlowViewContext, SlowViewConfig, DevToolsConfig, DevToolsMode, DevToolsModeConfig, } from './runtime.js';
|
|
3
3
|
export { UrlRequest } from './urlRequest.js';
|
|
4
4
|
export type { Internal, External } from './urlRequest.js';
|
|
5
5
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/runtime/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAE/C,YAAY,EACV,aAAa,EACb,WAAW,EACX,YAAY,EACZ,6BAA6B,EAC7B,oBAAoB,EACpB,sBAAsB,EACtB,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,cAAc,EACd,cAAc,
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../src/runtime/public.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,cAAc,CAAA;AAE/C,YAAY,EACV,aAAa,EACb,WAAW,EACX,YAAY,EACZ,6BAA6B,EAC7B,oBAAoB,EACpB,sBAAsB,EACtB,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,iBAAiB,EACjB,UAAU,EACV,eAAe,EACf,cAAc,EACd,cAAc,EACd,YAAY,EACZ,kBAAkB,GACnB,MAAM,cAAc,CAAA;AAErB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAE5C,YAAY,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAA"}
|
|
@@ -15,6 +15,15 @@ export type Visibility = 'Development' | 'Always';
|
|
|
15
15
|
* - `'TimeTravel'`: Clicking a row pauses the app at that historical state. Resume to continue.
|
|
16
16
|
*/
|
|
17
17
|
export type DevToolsMode = 'Inspect' | 'TimeTravel';
|
|
18
|
+
/** Mode value for the DevTools panel. Either a single mode used in every
|
|
19
|
+
* environment, or an object selecting different modes for development and
|
|
20
|
+
* production. Use the object form to keep `'TimeTravel'` for local debugging
|
|
21
|
+
* while shipping the safer `'Inspect'` mode to users. `'TimeTravel'` in
|
|
22
|
+
* production pauses the user's app when a history row is clicked. */
|
|
23
|
+
export type DevToolsModeConfig = DevToolsMode | Readonly<{
|
|
24
|
+
development: DevToolsMode;
|
|
25
|
+
production: DevToolsMode;
|
|
26
|
+
}>;
|
|
18
27
|
/**
|
|
19
28
|
* DevTools configuration.
|
|
20
29
|
*
|
|
@@ -22,7 +31,7 @@ export type DevToolsMode = 'Inspect' | 'TimeTravel';
|
|
|
22
31
|
*
|
|
23
32
|
* - `show`: `'Development'` (default) enables in dev mode only, `'Always'` enables in all environments including production.
|
|
24
33
|
* - `position`: Where the badge and panel appear. Defaults to `'BottomRight'`.
|
|
25
|
-
* - `mode`: `'TimeTravel'` (default) enables full time-travel debugging. `'Inspect'` allows browsing state snapshots without pausing the app.
|
|
34
|
+
* - `mode`: `'TimeTravel'` (default) enables full time-travel debugging. `'Inspect'` allows browsing state snapshots without pausing the app. Pass `{ development, production }` to use different modes per environment. Useful when DevTools is shown in production (`show: 'Always'`) and you want `'TimeTravel'` only in local development.
|
|
26
35
|
* - `banner`: Optional text shown as a banner at the top of the panel.
|
|
27
36
|
* - `excludeFromHistory`: Message `_tag` values whose dispatches should not be recorded in DevTools history. The Messages still drive `update` and the runtime as usual; they just don't appear in the history panel and don't pay the per-Message diff cost. Use for high-frequency Messages (animation frames, pointer moves, scroll events) that would flood history without adding insight.
|
|
28
37
|
* - `maxEntries`: Maximum number of recorded Messages retained in history before the oldest is evicted. Defaults to 100. Clamped to the range 20-500: smaller values keep the panel snappy under high message rates, larger values give you more scroll-back. Each retained entry stores a full Model snapshot, so memory cost scales linearly with both `maxEntries` and your Model size.
|
|
@@ -30,7 +39,7 @@ export type DevToolsMode = 'Inspect' | 'TimeTravel';
|
|
|
30
39
|
export type DevToolsConfig = false | Readonly<{
|
|
31
40
|
show?: Visibility;
|
|
32
41
|
position?: DevToolsPosition;
|
|
33
|
-
mode?:
|
|
42
|
+
mode?: DevToolsModeConfig;
|
|
34
43
|
banner?: string;
|
|
35
44
|
excludeFromHistory?: ReadonlyArray<string>;
|
|
36
45
|
maxEntries?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/runtime/runtime.ts"],"names":[],"mappings":"AACA,OAAO,EAGL,OAAO,EAEP,MAAM,EAGN,KAAK,EAEL,MAAM,EAON,MAAM,EAIP,MAAM,QAAQ,CAAA;AAGf,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AASlD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAE3C,OAAO,EAAE,GAAG,EAA+B,MAAM,iBAAiB,CAAA;AAalE,OAAO,KAAK,EAEV,gBAAgB,EACjB,MAAM,sBAAsB,CAAA;AAI7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAA;AACtD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AAe5C,0DAA0D;AAC1D,MAAM,MAAM,gBAAgB,GACxB,aAAa,GACb,YAAY,GACZ,UAAU,GACV,SAAS,CAAA;AAEb,wCA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AEpB,wBAAgB,WAAW,CACzB,KAAK,EACL,OAAO,SAAS;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,EAChC,aAAa,SAAS,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EACzD,SAAS,GAAG,KAAK,EACjB,uBAAuB,GAAG,KAAK,EAE/B,MAAM,EAAE,aAAa,CACnB,KAAK,EACL,OAAO,EACP,aAAa,EACb,SAAS,EACT,uBAAuB,CACxB,GACA,iBAAiB,CAAA;AA2NpB,kEAAkE;AAClE,eAAO,MAAM,GAAG,GAAI,SAAS,iBAAiB,KAAG,IA4ChD,CAAA"}
|
package/dist/runtime/runtime.js
CHANGED
|
@@ -20,6 +20,14 @@ const toCommandRecord = (command) => command.args !== undefined
|
|
|
20
20
|
const DEFAULT_DEV_TOOLS_SHOW = 'Development';
|
|
21
21
|
const DEFAULT_DEV_TOOLS_POSITION = 'BottomRight';
|
|
22
22
|
const DEFAULT_DEV_TOOLS_MODE = 'TimeTravel';
|
|
23
|
+
const resolveDevToolsMode = (config) => {
|
|
24
|
+
if (typeof config === 'string') {
|
|
25
|
+
return config;
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
return import.meta.hot ? config.development : config.production;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
23
31
|
const DEV_TOOLS_MAX_ENTRIES_MIN = 20;
|
|
24
32
|
const DEV_TOOLS_MAX_ENTRIES_MAX = 500;
|
|
25
33
|
const DEFAULT_SLOW_VIEW_SHOW = 'Development';
|
|
@@ -283,7 +291,7 @@ const makeRuntime = ({ Model, flags: resolveFlags, init, update, view, subscript
|
|
|
283
291
|
const isInIframe = window.self !== window.top;
|
|
284
292
|
const resolvedDevTools = pipe(devTools ?? {}, Option.liftPredicate(config => config !== false), Option.filter(config => Match.value(config.show ?? DEFAULT_DEV_TOOLS_SHOW).pipe(Match.when('Always', () => true), Match.when('Development', () => !!import.meta.hot && !isInIframe), Match.exhaustive)), Option.map(config => ({
|
|
285
293
|
position: config.position ?? DEFAULT_DEV_TOOLS_POSITION,
|
|
286
|
-
mode: config.mode ?? DEFAULT_DEV_TOOLS_MODE,
|
|
294
|
+
mode: resolveDevToolsMode(config.mode ?? DEFAULT_DEV_TOOLS_MODE),
|
|
287
295
|
maybeBanner: Option.fromNullishOr(config.banner),
|
|
288
296
|
})));
|
|
289
297
|
if (Option.isSome(resolvedDevTools)) {
|
|
@@ -172,7 +172,6 @@ export declare const SubscriptionDeps: S.Struct<{
|
|
|
172
172
|
export declare const subscriptions: import("../../runtime/subscription.js").Subscriptions<{
|
|
173
173
|
readonly id: string;
|
|
174
174
|
readonly orientation: "Vertical" | "Horizontal";
|
|
175
|
-
readonly activationThreshold: number;
|
|
176
175
|
readonly dragState: {
|
|
177
176
|
readonly _tag: "Idle";
|
|
178
177
|
} | {
|
|
@@ -209,7 +208,10 @@ export declare const subscriptions: import("../../runtime/subscription.js").Subs
|
|
|
209
208
|
readonly targetContainerId: string;
|
|
210
209
|
readonly targetIndex: number;
|
|
211
210
|
};
|
|
211
|
+
readonly activationThreshold: number;
|
|
212
212
|
}, {
|
|
213
|
+
readonly _tag: "CancelledDrag";
|
|
214
|
+
} | {
|
|
213
215
|
readonly _tag: "PressedDraggable";
|
|
214
216
|
readonly screenX: number;
|
|
215
217
|
readonly screenY: number;
|
|
@@ -228,8 +230,6 @@ export declare const subscriptions: import("../../runtime/subscription.js").Subs
|
|
|
228
230
|
}>;
|
|
229
231
|
} | {
|
|
230
232
|
readonly _tag: "ReleasedPointer";
|
|
231
|
-
} | {
|
|
232
|
-
readonly _tag: "CancelledDrag";
|
|
233
233
|
} | {
|
|
234
234
|
readonly _tag: "ActivatedKeyboardDrag";
|
|
235
235
|
readonly index: number;
|
|
@@ -83,26 +83,41 @@ type UpdateReturn = readonly [
|
|
|
83
83
|
/** Processes a slider message and returns the next model, commands, and an
|
|
84
84
|
* optional out-message for the parent. */
|
|
85
85
|
export declare const update: (model: Model, message: Message) => UpdateReturn;
|
|
86
|
-
/**
|
|
87
|
-
*
|
|
86
|
+
/** Updates the slider's range. Snaps and clamps the current value into the
|
|
87
|
+
* new range. Use this when min/max derive from external state (e.g. a
|
|
88
|
+
* bounded buffer whose first/last index shifts over time). Unlike `setValue`,
|
|
89
|
+
* this runs even while the user is Dragging: a structural range change
|
|
90
|
+
* cannot leave the value out of bounds. */
|
|
91
|
+
export declare const setRange: (model: Model, range: Readonly<{
|
|
92
|
+
min: number;
|
|
93
|
+
max: number;
|
|
94
|
+
}>) => Model;
|
|
95
|
+
/** Sets the slider's value, snapped and clamped into the current range.
|
|
96
|
+
* No-op while the user is actively dragging. drag state owns the value.
|
|
97
|
+
* Does not emit `ChangedValue`; use when the value is being driven by
|
|
98
|
+
* external state rather than user input. */
|
|
99
|
+
export declare const setValue: (model: Model, value: number) => Model;
|
|
100
|
+
/** Schema describing the subscription dependencies for slider drag. */
|
|
88
101
|
export declare const SubscriptionDeps: S.Struct<{
|
|
89
|
-
readonly
|
|
102
|
+
readonly dragPointer: S.Struct<{
|
|
90
103
|
readonly dragActivity: S.Literals<readonly ["Idle", "Active"]>;
|
|
91
104
|
readonly id: S.String;
|
|
92
105
|
readonly min: S.Number;
|
|
93
106
|
readonly max: S.Number;
|
|
94
107
|
}>;
|
|
95
|
-
readonly
|
|
108
|
+
readonly dragEscape: S.Struct<{
|
|
96
109
|
readonly dragActivity: S.Literals<readonly ["Idle", "Active"]>;
|
|
97
110
|
}>;
|
|
98
111
|
}>;
|
|
99
|
-
/**
|
|
100
|
-
*
|
|
101
|
-
|
|
112
|
+
/** Builds slider drag subscriptions, looking up the track
|
|
113
|
+
* element through the supplied root resolver. Use this when the slider is
|
|
114
|
+
* rendered inside a Shadow DOM. The root is read lazily so consumers can
|
|
115
|
+
* resolve it at subscription time. */
|
|
116
|
+
export declare const subscriptionsForRoot: (getTrackRoot: () => Document | ShadowRoot) => import("../../runtime/subscription.js").Subscriptions<{
|
|
102
117
|
readonly value: number;
|
|
103
118
|
readonly id: string;
|
|
104
|
-
readonly max: number;
|
|
105
119
|
readonly min: number;
|
|
120
|
+
readonly max: number;
|
|
106
121
|
readonly step: number;
|
|
107
122
|
readonly dragState: {
|
|
108
123
|
readonly _tag: "Idle";
|
|
@@ -111,8 +126,45 @@ export declare const subscriptions: import("../../runtime/subscription.js").Subs
|
|
|
111
126
|
readonly originValue: number;
|
|
112
127
|
};
|
|
113
128
|
}, {
|
|
129
|
+
readonly _tag: "PressedThumb";
|
|
130
|
+
} | {
|
|
131
|
+
readonly _tag: "PressedPointer";
|
|
132
|
+
readonly value: number;
|
|
133
|
+
} | {
|
|
134
|
+
readonly _tag: "MovedDragPointer";
|
|
135
|
+
readonly value: number;
|
|
136
|
+
} | {
|
|
137
|
+
readonly _tag: "ReleasedDragPointer";
|
|
138
|
+
} | {
|
|
114
139
|
readonly _tag: "CancelledDrag";
|
|
115
140
|
} | {
|
|
141
|
+
readonly _tag: "PressedKeyboardNavigation";
|
|
142
|
+
readonly direction: "Max" | "Min" | "StepDecrement" | "StepIncrement" | "PageDecrement" | "PageIncrement";
|
|
143
|
+
}, S.Struct<{
|
|
144
|
+
readonly dragPointer: S.Struct<{
|
|
145
|
+
readonly dragActivity: S.Literals<readonly ["Idle", "Active"]>;
|
|
146
|
+
readonly id: S.String;
|
|
147
|
+
readonly min: S.Number;
|
|
148
|
+
readonly max: S.Number;
|
|
149
|
+
}>;
|
|
150
|
+
readonly dragEscape: S.Struct<{
|
|
151
|
+
readonly dragActivity: S.Literals<readonly ["Idle", "Active"]>;
|
|
152
|
+
}>;
|
|
153
|
+
}>, never>;
|
|
154
|
+
/** Default drag subscriptions, with the track looked up via `document`. */
|
|
155
|
+
export declare const subscriptions: import("../../runtime/subscription.js").Subscriptions<{
|
|
156
|
+
readonly value: number;
|
|
157
|
+
readonly id: string;
|
|
158
|
+
readonly min: number;
|
|
159
|
+
readonly max: number;
|
|
160
|
+
readonly step: number;
|
|
161
|
+
readonly dragState: {
|
|
162
|
+
readonly _tag: "Idle";
|
|
163
|
+
} | {
|
|
164
|
+
readonly _tag: "Dragging";
|
|
165
|
+
readonly originValue: number;
|
|
166
|
+
};
|
|
167
|
+
}, {
|
|
116
168
|
readonly _tag: "PressedThumb";
|
|
117
169
|
} | {
|
|
118
170
|
readonly _tag: "PressedPointer";
|
|
@@ -122,17 +174,19 @@ export declare const subscriptions: import("../../runtime/subscription.js").Subs
|
|
|
122
174
|
readonly value: number;
|
|
123
175
|
} | {
|
|
124
176
|
readonly _tag: "ReleasedDragPointer";
|
|
177
|
+
} | {
|
|
178
|
+
readonly _tag: "CancelledDrag";
|
|
125
179
|
} | {
|
|
126
180
|
readonly _tag: "PressedKeyboardNavigation";
|
|
127
181
|
readonly direction: "Max" | "Min" | "StepDecrement" | "StepIncrement" | "PageDecrement" | "PageIncrement";
|
|
128
182
|
}, S.Struct<{
|
|
129
|
-
readonly
|
|
183
|
+
readonly dragPointer: S.Struct<{
|
|
130
184
|
readonly dragActivity: S.Literals<readonly ["Idle", "Active"]>;
|
|
131
185
|
readonly id: S.String;
|
|
132
186
|
readonly min: S.Number;
|
|
133
187
|
readonly max: S.Number;
|
|
134
188
|
}>;
|
|
135
|
-
readonly
|
|
189
|
+
readonly dragEscape: S.Struct<{
|
|
136
190
|
readonly dragActivity: S.Literals<readonly ["Idle", "Active"]>;
|
|
137
191
|
}>;
|
|
138
192
|
}>, never>;
|
|
@@ -156,13 +210,17 @@ export type ViewConfig<ParentMessage> = Readonly<{
|
|
|
156
210
|
formatValue?: (value: number) => string;
|
|
157
211
|
isDisabled?: boolean;
|
|
158
212
|
name?: string;
|
|
213
|
+
/** Resolves the root that holds the slider track when looking it up by its
|
|
214
|
+
* `data-slider-track-id` attribute. Defaults to `document`. Provide a
|
|
215
|
+
* ShadowRoot when rendering the slider inside a shadow tree so pointer
|
|
216
|
+
* events on the track can map clientX into a value. */
|
|
217
|
+
getTrackRoot?: () => Document | ShadowRoot;
|
|
159
218
|
}>;
|
|
160
219
|
/** Renders an accessible slider by building ARIA attribute groups and
|
|
161
220
|
* delegating layout to the consumer's `toView` callback. Follows the
|
|
162
221
|
* WAI-ARIA slider pattern — role="slider" on the thumb, aria-valuemin /
|
|
163
222
|
* aria-valuemax / aria-valuenow, keyboard navigation by step / page / home /
|
|
164
|
-
* end. Pointer drag is handled by the component's
|
|
165
|
-
* subscriptions. */
|
|
223
|
+
* end. Pointer drag is handled by the component's drag subscriptions. */
|
|
166
224
|
export declare const view: <ParentMessage>(config: ViewConfig<ParentMessage>) => Html;
|
|
167
225
|
/** Creates a memoized slider view. Static config is captured in a closure;
|
|
168
226
|
* only `model` and `toParentMessage` are compared per render via `createLazy`. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/ui/slider/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,MAAM,EACN,MAAM,IAAI,CAAC,EAIZ,MAAM,QAAQ,CAAA;AAEf,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAA;AACrD,OAAO,EACL,KAAK,SAAS,EACd,KAAK,IAAI,EAGV,MAAM,qBAAqB,CAAA;AAa5B;uDACuD;AACvD,eAAO,MAAM,KAAK;;;;;;;;;EAOhB,CAAA;AAEF,MAAM,MAAM,KAAK,GAAG,OAAO,KAAK,CAAC,IAAI,CAAA;AAIrC,4EAA4E;AAC5E,eAAO,MAAM,YAAY,0EAAoB,CAAA;AAC7C;;sDAEsD;AACtD,eAAO,MAAM,cAAc;;EAA2C,CAAA;AACtE;wCACwC;AACxC,eAAO,MAAM,gBAAgB;;EAA6C,CAAA;AAC1E,yEAAyE;AACzE,eAAO,MAAM,mBAAmB,iFAA2B,CAAA;AAC3D,iFAAiF;AACjF,eAAO,MAAM,aAAa,2EAAqB,CAAA;AAC/C,uEAAuE;AACvE,eAAO,MAAM,yBAAyB;;EASpC,CAAA;AAEF,8DAA8D;AAC9D,eAAO,MAAM,OAAO,EAAE,CAAC,CAAC,KAAK,CAC3B;IACE,OA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MAAM,CAAA;IAClB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAA;IACvC,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb;;;4DAGwD;IACxD,YAAY,CAAC,EAAE,MAAM,QAAQ,GAAG,UAAU,CAAA;CAC3C,CAAC,CAAA;AAEF;;;;0EAI0E;AAC1E,eAAO,MAAM,IAAI,GAAI,aAAa,EAChC,QAAQ,UAAU,CAAC,aAAa,CAAC,KAChC,IAgJF,CAAA;AAED;mFACmF;AACnF,eAAO,MAAM,IAAI,GAAI,aAAa,EAChC,cAAc,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,OAAO,GAAG,iBAAiB,CAAC,KACzE,CAAC,CACF,KAAK,EAAE,KAAK,EACZ,eAAe,EAAE,UAAU,CAAC,aAAa,CAAC,CAAC,iBAAiB,CAAC,KAC1D,IAAI,CAgBR,CAAA"}
|
package/dist/ui/slider/index.js
CHANGED
|
@@ -152,10 +152,27 @@ export const update = (model, message) => M.value(message).pipe(withUpdateReturn
|
|
|
152
152
|
}), M.orElse(() => [model, [], Option.none()])),
|
|
153
153
|
PressedKeyboardNavigation: ({ direction }) => withValue(model, nextValueForDirection(model, direction), []),
|
|
154
154
|
}));
|
|
155
|
+
/** Updates the slider's range. Snaps and clamps the current value into the
|
|
156
|
+
* new range. Use this when min/max derive from external state (e.g. a
|
|
157
|
+
* bounded buffer whose first/last index shifts over time). Unlike `setValue`,
|
|
158
|
+
* this runs even while the user is Dragging: a structural range change
|
|
159
|
+
* cannot leave the value out of bounds. */
|
|
160
|
+
export const setRange = (model, range) => evo(model, {
|
|
161
|
+
min: () => range.min,
|
|
162
|
+
max: () => range.max,
|
|
163
|
+
value: current => snapAndClamp(current, range.min, range.max, model.step),
|
|
164
|
+
});
|
|
165
|
+
/** Sets the slider's value, snapped and clamped into the current range.
|
|
166
|
+
* No-op while the user is actively dragging. drag state owns the value.
|
|
167
|
+
* Does not emit `ChangedValue`; use when the value is being driven by
|
|
168
|
+
* external state rather than user input. */
|
|
169
|
+
export const setValue = (model, value) => M.value(model.dragState).pipe(M.withReturnType(), M.tag('Dragging', () => model), M.orElse(() => evo(model, {
|
|
170
|
+
value: () => snapAndClamp(value, model.min, model.max, model.step),
|
|
171
|
+
})));
|
|
155
172
|
// SUBSCRIPTION
|
|
156
173
|
const DragActivity = S.Literals(['Idle', 'Active']);
|
|
157
174
|
const dragActivityFromModel = (model) => M.value(model.dragState).pipe(M.withReturnType(), M.tag('Dragging', () => 'Active'), M.orElse(() => 'Idle'));
|
|
158
|
-
const trackElement = (id) => Option.fromNullishOr(
|
|
175
|
+
const trackElement = (id, root) => Option.fromNullishOr(root.querySelector(`[data-slider-track-id="${id}"]`));
|
|
159
176
|
const valueFromClientX = (clientX, trackElement_, min, max) => {
|
|
160
177
|
const rect = trackElement_.getBoundingClientRect();
|
|
161
178
|
if (rect.width === 0) {
|
|
@@ -166,23 +183,24 @@ const valueFromClientX = (clientX, trackElement_, min, max) => {
|
|
|
166
183
|
return min + fraction * (max - min);
|
|
167
184
|
}
|
|
168
185
|
};
|
|
169
|
-
/** Schema describing the subscription dependencies for
|
|
170
|
-
* tracking. */
|
|
186
|
+
/** Schema describing the subscription dependencies for slider drag. */
|
|
171
187
|
export const SubscriptionDeps = S.Struct({
|
|
172
|
-
|
|
188
|
+
dragPointer: S.Struct({
|
|
173
189
|
dragActivity: DragActivity,
|
|
174
190
|
id: S.String,
|
|
175
191
|
min: S.Number,
|
|
176
192
|
max: S.Number,
|
|
177
193
|
}),
|
|
178
|
-
|
|
194
|
+
dragEscape: S.Struct({
|
|
179
195
|
dragActivity: DragActivity,
|
|
180
196
|
}),
|
|
181
197
|
});
|
|
182
|
-
/**
|
|
183
|
-
*
|
|
184
|
-
|
|
185
|
-
|
|
198
|
+
/** Builds slider drag subscriptions, looking up the track
|
|
199
|
+
* element through the supplied root resolver. Use this when the slider is
|
|
200
|
+
* rendered inside a Shadow DOM. The root is read lazily so consumers can
|
|
201
|
+
* resolve it at subscription time. */
|
|
202
|
+
export const subscriptionsForRoot = (getTrackRoot) => makeSubscriptions(SubscriptionDeps)({
|
|
203
|
+
dragPointer: {
|
|
186
204
|
modelToDependencies: model => ({
|
|
187
205
|
dragActivity: dragActivityFromModel(model),
|
|
188
206
|
id: model.id,
|
|
@@ -190,7 +208,7 @@ export const subscriptions = makeSubscriptions(SubscriptionDeps)({
|
|
|
190
208
|
max: model.max,
|
|
191
209
|
}),
|
|
192
210
|
dependenciesToStream: ({ dragActivity, id, min, max }) => {
|
|
193
|
-
const pointerEvents = Stream.merge(Stream.fromEventListener(document, 'pointermove').pipe(Stream.mapEffect(event => Effect.sync(() => Option.map(trackElement(id), element => MovedDragPointer({
|
|
211
|
+
const pointerEvents = Stream.merge(Stream.fromEventListener(document, 'pointermove').pipe(Stream.mapEffect(event => Effect.sync(() => Option.map(trackElement(id, getTrackRoot()), element => MovedDragPointer({
|
|
194
212
|
value: valueFromClientX(event.clientX, element, min, max),
|
|
195
213
|
})))), Stream.filter(Option.isSome), Stream.map(option => option.value)), Stream.fromEventListener(document, 'pointerup').pipe(Stream.map(() => ReleasedDragPointer())));
|
|
196
214
|
// NOTE: prevents text selection and locks cursor to grabbing while the
|
|
@@ -210,13 +228,15 @@ export const subscriptions = makeSubscriptions(SubscriptionDeps)({
|
|
|
210
228
|
return Stream.when(Stream.merge(pointerEvents, documentDragStyles), Effect.sync(() => dragActivity === 'Active'));
|
|
211
229
|
},
|
|
212
230
|
},
|
|
213
|
-
|
|
231
|
+
dragEscape: {
|
|
214
232
|
modelToDependencies: model => ({
|
|
215
233
|
dragActivity: dragActivityFromModel(model),
|
|
216
234
|
}),
|
|
217
235
|
dependenciesToStream: ({ dragActivity }) => Stream.when(Stream.fromEventListener(document, 'keydown').pipe(Stream.filter(({ key }) => key === 'Escape'), Stream.map(() => CancelledDrag())), Effect.sync(() => dragActivity === 'Active')),
|
|
218
236
|
},
|
|
219
237
|
});
|
|
238
|
+
/** Default drag subscriptions, with the track looked up via `document`. */
|
|
239
|
+
export const subscriptions = subscriptionsForRoot(() => document);
|
|
220
240
|
// VIEW
|
|
221
241
|
const LEFT_MOUSE_BUTTON = 0;
|
|
222
242
|
const labelId = (id) => `${id}-label`;
|
|
@@ -226,16 +246,15 @@ const percentString = (fraction) => `${Math.round(fraction * 10000) / 100}%`;
|
|
|
226
246
|
* delegating layout to the consumer's `toView` callback. Follows the
|
|
227
247
|
* WAI-ARIA slider pattern — role="slider" on the thumb, aria-valuemin /
|
|
228
248
|
* aria-valuemax / aria-valuenow, keyboard navigation by step / page / home /
|
|
229
|
-
* end. Pointer drag is handled by the component's
|
|
230
|
-
* subscriptions. */
|
|
249
|
+
* end. Pointer drag is handled by the component's drag subscriptions. */
|
|
231
250
|
export const view = (config) => {
|
|
232
251
|
const h = html();
|
|
233
|
-
const { model, toParentMessage, formatValue, isDisabled = false, name, } = config;
|
|
252
|
+
const { model, toParentMessage, formatValue, isDisabled = false, name, getTrackRoot = () => document, } = config;
|
|
234
253
|
const { id, value, min, max } = model;
|
|
235
254
|
const isDragging = model.dragState._tag === 'Dragging';
|
|
236
255
|
const fraction = fractionOfValue(model);
|
|
237
256
|
const handleKeyDown = (key) => Option.map(keyToDirection(key), direction => toParentMessage(PressedKeyboardNavigation({ direction })));
|
|
238
|
-
const pointerAtClientX = (clientX) => Option.map(trackElement(id), element => toParentMessage(PressedPointer({
|
|
257
|
+
const pointerAtClientX = (clientX) => Option.map(trackElement(id, getTrackRoot()), element => toParentMessage(PressedPointer({
|
|
239
258
|
value: valueFromClientX(clientX, element, min, max),
|
|
240
259
|
})));
|
|
241
260
|
const trackPointerHandler = (_pointerType, button, _screenX, _screenY, _timeStamp, clientX) => pipe(button, Option.liftPredicate(Equal.equals(LEFT_MOUSE_BUTTON)), Option.flatMap(() => pointerAtClientX(clientX)));
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { init, update, view, lazy, subscriptions, fractionOfValue, Model, Message, OutMessage, SubscriptionDeps, } from './index.js';
|
|
1
|
+
export { init, update, setRange, setValue, view, lazy, subscriptions, subscriptionsForRoot, fractionOfValue, Model, Message, OutMessage, SubscriptionDeps, } from './index.js';
|
|
2
2
|
export type { InitConfig, ViewConfig, SliderAttributes, PressedThumb, PressedPointer, MovedDragPointer, ReleasedDragPointer, CancelledDrag, PressedKeyboardNavigation, } from './index.js';
|
|
3
3
|
//# sourceMappingURL=public.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/slider/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,aAAa,EACb,eAAe,EACf,KAAK,EACL,OAAO,EACP,UAAU,EACV,gBAAgB,GACjB,MAAM,YAAY,CAAA;AAEnB,YAAY,EACV,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,yBAAyB,GAC1B,MAAM,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"public.d.ts","sourceRoot":"","sources":["../../../src/ui/slider/public.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EACJ,MAAM,EACN,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,KAAK,EACL,OAAO,EACP,UAAU,EACV,gBAAgB,GACjB,MAAM,YAAY,CAAA;AAEnB,YAAY,EACV,UAAU,EACV,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,mBAAmB,EACnB,aAAa,EACb,yBAAyB,GAC1B,MAAM,YAAY,CAAA"}
|
package/dist/ui/slider/public.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { init, update, view, lazy, subscriptions, fractionOfValue, Model, Message, OutMessage, SubscriptionDeps, } from './index.js';
|
|
1
|
+
export { init, update, setRange, setValue, view, lazy, subscriptions, subscriptionsForRoot, fractionOfValue, Model, Message, OutMessage, SubscriptionDeps, } from './index.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "foldkit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.94.0",
|
|
4
4
|
"description": "A TypeScript frontend framework, built on Effect and architected like Elm",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -23,6 +23,10 @@
|
|
|
23
23
|
"types": "./dist/command/public.d.ts",
|
|
24
24
|
"import": "./dist/command/public.js"
|
|
25
25
|
},
|
|
26
|
+
"./customElement": {
|
|
27
|
+
"types": "./dist/customElement/public.d.ts",
|
|
28
|
+
"import": "./dist/customElement/public.js"
|
|
29
|
+
},
|
|
26
30
|
"./dom": {
|
|
27
31
|
"types": "./dist/dom/public.d.ts",
|
|
28
32
|
"import": "./dist/dom/public.js"
|
|
@@ -200,13 +204,13 @@
|
|
|
200
204
|
"dist"
|
|
201
205
|
],
|
|
202
206
|
"peerDependencies": {
|
|
203
|
-
"@effect/platform-browser": "4.0.0-beta.
|
|
204
|
-
"effect": "4.0.0-beta.
|
|
207
|
+
"@effect/platform-browser": "4.0.0-beta.64",
|
|
208
|
+
"effect": "4.0.0-beta.64"
|
|
205
209
|
},
|
|
206
210
|
"devDependencies": {
|
|
207
|
-
"@effect/platform-browser": "4.0.0-beta.
|
|
208
|
-
"@effect/vitest": "4.0.0-beta.
|
|
209
|
-
"effect": "4.0.0-beta.
|
|
211
|
+
"@effect/platform-browser": "4.0.0-beta.64",
|
|
212
|
+
"@effect/vitest": "4.0.0-beta.64",
|
|
213
|
+
"effect": "4.0.0-beta.64",
|
|
210
214
|
"happy-dom": "^20.9.0",
|
|
211
215
|
"rimraf": "^6.1.3",
|
|
212
216
|
"typedoc": "^0.28.19",
|