@wardic/dom 1.5.0-next.0 → 1.5.0-next.2
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/dist/Report.d.ts +1 -1
- package/dist/Report.d.ts.map +1 -1
- package/dist/Report.js +1 -1
- package/dist/Report.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/internal/diagnostic-codes.d.ts +10 -0
- package/dist/internal/diagnostic-codes.d.ts.map +1 -0
- package/dist/internal/diagnostic-codes.js +38 -0
- package/dist/internal/diagnostic-codes.js.map +1 -0
- package/dist/internal/projection.d.ts.map +1 -1
- package/dist/internal/projection.js +8 -7
- package/dist/internal/projection.js.map +1 -1
- package/dist/internal/reorder.d.ts.map +1 -1
- package/dist/internal/reorder.js +2 -1
- package/dist/internal/reorder.js.map +1 -1
- package/dist/internal/scroll.js +1 -1
- package/dist/internal/scroll.js.map +1 -1
- package/dist/unstable/DragTrack.d.ts.map +1 -1
- package/dist/unstable/DragTrack.js +2 -1
- package/dist/unstable/DragTrack.js.map +1 -1
- package/dist/unstable/ElementSetup.d.ts +4 -1
- package/dist/unstable/ElementSetup.d.ts.map +1 -1
- package/dist/unstable/ElementSetup.js +6 -2
- package/dist/unstable/ElementSetup.js.map +1 -1
- package/dist/unstable/Feature.d.ts +6 -2
- package/dist/unstable/Feature.d.ts.map +1 -1
- package/dist/unstable/Feature.js +5 -4
- package/dist/unstable/Feature.js.map +1 -1
- package/dist/unstable/PointerValues.js +1 -1
- package/dist/unstable/PointerValues.js.map +1 -1
- package/dist/unstable/PresenceController.js +2 -2
- package/dist/unstable/PresenceController.js.map +1 -1
- package/package.json +3 -3
- package/src/Report.ts +1 -1
- package/src/index.ts +1 -1
- package/src/internal/diagnostic-codes.ts +46 -0
- package/src/internal/projection.ts +13 -7
- package/src/internal/reorder.ts +4 -2
- package/src/internal/scroll.ts +1 -1
- package/src/unstable/DragTrack.ts +5 -1
- package/src/unstable/ElementSetup.ts +8 -3
- package/src/unstable/Feature.ts +11 -7
- package/src/unstable/PointerValues.ts +1 -1
- package/src/unstable/PresenceController.ts +2 -2
package/src/internal/scroll.ts
CHANGED
|
@@ -363,7 +363,7 @@ const readerOf = (registry: AtomRegistry.AtomRegistry, containers: (element: Ele
|
|
|
363
363
|
registry.set(atom, next)
|
|
364
364
|
if (failing) failing = false
|
|
365
365
|
} catch (defect) {
|
|
366
|
-
if (!failing) Report.
|
|
366
|
+
if (!failing) Report.callbackFailedOn(context, DEPENDENT_FAILED, Cause.die(defect))
|
|
367
367
|
failing = true
|
|
368
368
|
}
|
|
369
369
|
}
|
|
@@ -85,6 +85,7 @@ import * as Stream from "effect/Stream"
|
|
|
85
85
|
import * as UndefinedOr from "effect/UndefinedOr"
|
|
86
86
|
import type * as DragConstraints from "./DragConstraints.ts"
|
|
87
87
|
import type * as WardicServices from "@wardic/core/unstable/WardicServices"
|
|
88
|
+
import * as Diagnostic from "@wardic/core/unstable/Diagnostic"
|
|
88
89
|
import type * as WardConfig from "./WardConfig.ts"
|
|
89
90
|
import * as DragControls from "./DragControls.ts"
|
|
90
91
|
import * as DragTransition from "./DragTransition.ts"
|
|
@@ -822,7 +823,10 @@ export const driveDragTrack = (opts: DragTrackOptions): DragTrack => {
|
|
|
822
823
|
onTrue: () => Effect.void,
|
|
823
824
|
onFalse: () => {
|
|
824
825
|
warned = true
|
|
825
|
-
return
|
|
826
|
+
return Diagnostic.report(
|
|
827
|
+
"WARDIC_DRAG_CONTAINER_MISSING",
|
|
828
|
+
"`dragConstraints`' container isn't on the page at a drag's start, so the element drags unconstrained. Render the container before the element can be dragged, or give `dragConstraints` a box of numbers.",
|
|
829
|
+
)
|
|
826
830
|
},
|
|
827
831
|
})),
|
|
828
832
|
),
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
// since PR 2, moved to dom for every DOM binding's elements, with the value reads its provider holds.
|
|
15
15
|
import * as BaseValue from "@wardic/core/BaseValue"
|
|
16
16
|
import * as Projection from "@wardic/core/Projection"
|
|
17
|
+
import * as Diagnostic from "@wardic/core/unstable/Diagnostic"
|
|
17
18
|
import type * as ReducedMotion from "@wardic/core/ReducedMotion"
|
|
18
19
|
import type * as Renderer from "@wardic/core/Renderer"
|
|
19
20
|
import type * as Values from "@wardic/core/Values"
|
|
@@ -288,11 +289,15 @@ export const writeUnderStyle = (element: HTMLElement, style: Readonly<Record<str
|
|
|
288
289
|
})
|
|
289
290
|
}
|
|
290
291
|
|
|
291
|
-
/**
|
|
292
|
+
/**
|
|
293
|
+
* Report, once per element, that a `transform` string gave way to the transform keys in its `style`
|
|
294
|
+
* (#130): `WARDIC_TRANSFORM_STRING_DROPPED`, on the Environment's reporter (`Diagnostic`).
|
|
295
|
+
*/
|
|
292
296
|
export const warnDroppedTransform = (runtime: WardicServices.Runner<WardicServices.WardicServices>, id: string): void => {
|
|
293
297
|
runtime.runFork(
|
|
294
|
-
|
|
295
|
-
"
|
|
298
|
+
Diagnostic.report(
|
|
299
|
+
"WARDIC_TRANSFORM_STRING_DROPPED",
|
|
300
|
+
"a `transform` string is dropped while `style` sets a transform key (x, scale, rotate…); " +
|
|
296
301
|
"the keys win, as Motion's do. Give the transform as keys, or drop them",
|
|
297
302
|
).pipe(Effect.annotateLogs({ id })),
|
|
298
303
|
)
|
package/src/unstable/Feature.ts
CHANGED
|
@@ -29,6 +29,7 @@ import * as Predicate from "effect/Predicate"
|
|
|
29
29
|
import * as UndefinedOr from "effect/UndefinedOr"
|
|
30
30
|
import * as OwnerScope from "./OwnerScope.ts"
|
|
31
31
|
import type * as WardConfig from "./WardConfig.ts"
|
|
32
|
+
import * as Diagnostic from "@wardic/core/unstable/Diagnostic"
|
|
32
33
|
import type * as Reactivity from "@wardic/core/unstable/Reactivity"
|
|
33
34
|
import type * as WardicServices from "@wardic/core/unstable/WardicServices"
|
|
34
35
|
|
|
@@ -317,8 +318,11 @@ export interface FeatureRegistry {
|
|
|
317
318
|
* that brings no Feature works with when one is there (the projection system, for a presence).
|
|
318
319
|
*/
|
|
319
320
|
readonly built: () => Context.Context<never>
|
|
320
|
-
/**
|
|
321
|
-
|
|
321
|
+
/**
|
|
322
|
+
* Logs `message` at Warning the first time `feature` is named: development's word on a missing Feature.
|
|
323
|
+
* With `code`, reports it as that coded diagnostic instead (`Diagnostic.report`, solid-next).
|
|
324
|
+
*/
|
|
325
|
+
readonly warnOnce: (feature: string, message: string, code?: Diagnostic.Code) => void
|
|
322
326
|
/** Runs `end` as the provider ends, before its Features: what a Wardic instance's loads stop by (#516). */
|
|
323
327
|
readonly onEnd: (end: () => void) => void
|
|
324
328
|
/** Ends every Feature built, the provider's runtime after (a Feature's Layer may stand on it). */
|
|
@@ -337,7 +341,7 @@ export interface InstanceHost extends Omit<SectionHost, "onCleanup"> {
|
|
|
337
341
|
* A registry's sections of exactly a list, one per list; what runs as it ends (`onEnd`, run by `end`);
|
|
338
342
|
* and its warnings, one per Feature.
|
|
339
343
|
*/
|
|
340
|
-
const sectionsAndWarnings = (build: Build, warn: (message: string) => void) => {
|
|
344
|
+
const sectionsAndWarnings = (build: Build, warn: (message: string, code: Diagnostic.Code | undefined) => void) => {
|
|
341
345
|
const sections = new WeakMap<ReadonlyArray<Feature>, FeatureSection>()
|
|
342
346
|
const ends: Array<() => void> = []
|
|
343
347
|
const warned = new Set<string>()
|
|
@@ -356,10 +360,10 @@ const sectionsAndWarnings = (build: Build, warn: (message: string) => void) => {
|
|
|
356
360
|
return section
|
|
357
361
|
},
|
|
358
362
|
}),
|
|
359
|
-
warnOnce: (feature: string, message: string): void => {
|
|
363
|
+
warnOnce: (feature: string, message: string, code?: Diagnostic.Code): void => {
|
|
360
364
|
if (warned.has(feature)) return
|
|
361
365
|
warned.add(feature)
|
|
362
|
-
warn(message)
|
|
366
|
+
warn(message, code)
|
|
363
367
|
},
|
|
364
368
|
}
|
|
365
369
|
}
|
|
@@ -411,8 +415,8 @@ export const clientRegistry = (runtime: FeatureRuntime, dispose: () => Promise<v
|
|
|
411
415
|
return services
|
|
412
416
|
},
|
|
413
417
|
})
|
|
414
|
-
const { end, ...rest } = sectionsAndWarnings(build, (message) => {
|
|
415
|
-
runtime.runFork(Effect.logWarning(message))
|
|
418
|
+
const { end, ...rest } = sectionsAndWarnings(build, (message, code) => {
|
|
419
|
+
runtime.runFork(UndefinedOr.match(code, { onUndefined: () => Effect.logWarning(message), onDefined: (given) => Diagnostic.report(given, message) }))
|
|
416
420
|
})
|
|
417
421
|
return {
|
|
418
422
|
build,
|
|
@@ -96,7 +96,7 @@ export const pointer: (element: Element, options?: Options) => Effect.Effect<Poi
|
|
|
96
96
|
let eventThrew = false
|
|
97
97
|
/** The value `key`'s set threw: reported at a run's first throw. Its failure path alone. */
|
|
98
98
|
const valueFailed = (key: string, defect: unknown): void => {
|
|
99
|
-
if (Bool.not(Bool.or(eventThrew, failing))) Report.
|
|
99
|
+
if (Bool.not(Bool.or(eventThrew, failing))) Report.callbackFailedOn(context, DEPENDENT_FAILED, Cause.die(defect), { key })
|
|
100
100
|
eventThrew = true
|
|
101
101
|
}
|
|
102
102
|
const place = (event: Event): void => {
|
|
@@ -707,7 +707,7 @@ export const exitCompleteEvents = (runtime: WardicServices.Runner<WardicServices
|
|
|
707
707
|
} catch (defect) {
|
|
708
708
|
if (failing) return
|
|
709
709
|
failing = true
|
|
710
|
-
runtime.runFork(Report.
|
|
710
|
+
runtime.runFork(Report.callbackFailed("wardic.presence: onExitComplete failed", Cause.die(defect)))
|
|
711
711
|
}
|
|
712
712
|
},
|
|
713
713
|
}
|
|
@@ -1536,7 +1536,7 @@ export const makePresence = (options: PresenceOptions): PresenceController => {
|
|
|
1536
1536
|
try {
|
|
1537
1537
|
watch.leave(custom, release, () => holdLate(el, counted))
|
|
1538
1538
|
} catch (defect) {
|
|
1539
|
-
runtime.runFork(Report.
|
|
1539
|
+
runtime.runFork(Report.callbackFailed("wardic.presence: a usePresence callback failed", Cause.die(defect)))
|
|
1540
1540
|
release()
|
|
1541
1541
|
}
|
|
1542
1542
|
})
|