what-core 0.13.11 → 0.15.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 +64 -38
- package/a11y.d.ts +128 -0
- package/data.d.ts +294 -0
- package/dist/a11y.js +510 -0
- package/dist/a11y.min.js +413 -0
- package/dist/actions.js +158 -0
- package/dist/actions.min.js +112 -0
- package/dist/animation.js +481 -0
- package/dist/animation.min.js +295 -0
- package/dist/async.js +180 -0
- package/dist/async.min.js +134 -0
- package/dist/components.js +577 -0
- package/dist/components.min.js +413 -0
- package/dist/data.js +1212 -0
- package/dist/data.min.js +918 -0
- package/dist/diagnostics.js +187 -0
- package/dist/diagnostics.min.js +134 -0
- package/dist/dom.js +796 -0
- package/dist/dom.min.js +603 -0
- package/dist/entries/a11y.js +43 -0
- package/dist/entries/a11y.min.js +43 -0
- package/dist/entries/data.js +29 -0
- package/dist/entries/data.min.js +29 -0
- package/dist/entries/dom.js +45 -0
- package/dist/entries/dom.min.js +45 -0
- package/dist/entries/form.js +31 -0
- package/dist/entries/form.min.js +31 -0
- package/dist/entries/internal.js +123 -0
- package/dist/entries/internal.min.js +123 -0
- package/dist/entries/motion.js +23 -0
- package/dist/entries/motion.min.js +23 -0
- package/dist/entries/ui.js +25 -0
- package/dist/entries/ui.min.js +25 -0
- package/dist/env.js +5 -0
- package/dist/env.min.js +5 -0
- package/dist/errors.js +1518 -0
- package/dist/errors.min.js +548 -0
- package/dist/form.js +936 -0
- package/dist/form.min.js +703 -0
- package/dist/guardrails.js +84 -0
- package/dist/guardrails.min.js +55 -0
- package/dist/h.js +232 -0
- package/dist/h.min.js +171 -0
- package/dist/head.js +241 -0
- package/dist/head.min.js +207 -0
- package/dist/helpers.js +126 -0
- package/dist/helpers.min.js +98 -0
- package/dist/hooks.js +255 -0
- package/dist/hooks.min.js +153 -0
- package/dist/hot.js +215 -0
- package/dist/hot.min.js +24 -0
- package/dist/hydration-data.js +495 -0
- package/dist/hydration-data.min.js +371 -0
- package/dist/import-changes.js +273 -0
- package/dist/import-changes.min.js +272 -0
- package/dist/index.js +95 -0
- package/dist/index.min.js +95 -227
- package/dist/jsx-dev-runtime.js +10 -0
- package/dist/jsx-dev-runtime.min.js +10 -1
- package/dist/jsx-runtime.js +27 -0
- package/dist/jsx-runtime.min.js +15 -1
- package/dist/live.js +54 -0
- package/dist/live.min.js +49 -0
- package/dist/markup-rules.js +250 -0
- package/dist/markup-rules.min.js +213 -0
- package/dist/reactive.js +3334 -0
- package/dist/reactive.min.js +2033 -0
- package/dist/render.js +4746 -0
- package/dist/render.min.js +2797 -1
- package/dist/scheduler.js +225 -0
- package/dist/scheduler.min.js +162 -0
- package/dist/selector.js +11 -0
- package/dist/selector.min.js +10 -0
- package/dist/server-context.js +148 -0
- package/dist/server-context.min.js +121 -0
- package/dist/skeleton.js +342 -0
- package/dist/skeleton.min.js +310 -0
- package/dist/store.js +72 -0
- package/dist/store.min.js +50 -0
- package/dist/testing.js +720 -0
- package/dist/testing.min.js +458 -1
- package/dist/vnode-adoption.js +19 -0
- package/dist/vnode-adoption.min.js +19 -0
- package/dist/vnode-renderer.js +61 -0
- package/dist/vnode-renderer.min.js +47 -0
- package/dom.d.ts +44 -0
- package/form.d.ts +218 -0
- package/hot.d.ts +35 -0
- package/index.d.ts +421 -736
- package/internal.d.ts +284 -0
- package/jsx-runtime.d.ts +160 -137
- package/markup-rules.d.ts +83 -0
- package/motion.d.ts +156 -0
- package/package.json +117 -3
- package/render.d.ts +278 -29
- package/src/a11y.js +64 -59
- package/src/actions.js +226 -0
- package/src/animation.js +105 -57
- package/src/async.js +259 -0
- package/src/components.js +495 -144
- package/src/data.js +1410 -1159
- package/src/diagnostics.js +263 -0
- package/src/dom.js +1159 -872
- package/src/entries/a11y.js +24 -0
- package/src/entries/data.js +17 -0
- package/src/entries/dom.js +29 -0
- package/src/entries/form.js +16 -0
- package/src/entries/internal.js +63 -0
- package/src/entries/motion.js +13 -0
- package/src/entries/ui.js +13 -0
- package/src/env-development.js +12 -0
- package/src/env.js +33 -0
- package/src/errors.js +1144 -168
- package/src/form.js +723 -225
- package/src/guardrails.js +38 -126
- package/src/h.js +227 -152
- package/src/head.js +189 -19
- package/src/helpers.js +47 -75
- package/src/hooks.js +233 -248
- package/src/hot.js +316 -0
- package/src/hydration-data.js +859 -16
- package/src/import-changes.js +156 -0
- package/src/index.js +38 -188
- package/src/jsx-dev-runtime.js +7 -14
- package/src/jsx-runtime.js +25 -9
- package/src/live.js +80 -0
- package/src/markup-rules.js +387 -0
- package/src/reactive.js +4400 -862
- package/src/render.js +6502 -2570
- package/src/scheduler.js +56 -21
- package/src/selector.js +31 -0
- package/src/server-context.js +252 -22
- package/src/skeleton.js +22 -12
- package/src/store.js +17 -31
- package/src/testing.js +389 -63
- package/src/vnode-adoption.js +48 -0
- package/src/vnode-renderer.js +114 -0
- package/testing.d.ts +81 -1
- package/ui.d.ts +20 -0
- package/dist/chunk-6YOUZ6T4.min.js +0 -1
- package/dist/chunk-FN6HXME3.min.js +0 -11
- package/dist/chunk-VKZY7JPN.min.js +0 -1
- package/src/agent-context.js +0 -127
- package/src/warnings.js +0 -193
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// what-framework/a11y (what-core/a11y): focus management, ARIA state helpers,
|
|
2
|
+
// live-region announcements, ids and keyboard helpers. useId is on the root
|
|
3
|
+
// entry, as in React.
|
|
4
|
+
export {
|
|
5
|
+
useFocus,
|
|
6
|
+
useFocusRestore,
|
|
7
|
+
useFocusTrap,
|
|
8
|
+
FocusTrap,
|
|
9
|
+
announce,
|
|
10
|
+
announceAssertive,
|
|
11
|
+
SkipLink,
|
|
12
|
+
useAriaExpanded,
|
|
13
|
+
useAriaSelected,
|
|
14
|
+
useAriaChecked,
|
|
15
|
+
useRovingTabIndex,
|
|
16
|
+
VisuallyHidden,
|
|
17
|
+
LiveRegion,
|
|
18
|
+
useIds,
|
|
19
|
+
useDescribedBy,
|
|
20
|
+
useLabelledBy,
|
|
21
|
+
Keys,
|
|
22
|
+
onKey,
|
|
23
|
+
onKeys,
|
|
24
|
+
} from '../a11y.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// what-framework/data (what-core/data): one query cache on async values, the
|
|
2
|
+
// signal-native query() that reads it, the React-ecosystem hooks over it, and
|
|
3
|
+
// the cache operations (docs/DATA.md).
|
|
4
|
+
export {
|
|
5
|
+
query,
|
|
6
|
+
useFetch,
|
|
7
|
+
useSWR,
|
|
8
|
+
useQuery,
|
|
9
|
+
useInfiniteQuery,
|
|
10
|
+
invalidateQueries,
|
|
11
|
+
invalidatePath,
|
|
12
|
+
onRevalidate,
|
|
13
|
+
prefetchQuery,
|
|
14
|
+
setQueryData,
|
|
15
|
+
getQueryData,
|
|
16
|
+
clearCache,
|
|
17
|
+
} from '../data.js';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
// what-framework/dom (what-core/dom): the DOM read/write scheduler and DOM
|
|
2
|
+
// utilities.
|
|
3
|
+
|
|
4
|
+
// Scheduler: batch reads before writes so a frame never thrashes layout.
|
|
5
|
+
export {
|
|
6
|
+
scheduleRead,
|
|
7
|
+
scheduleWrite,
|
|
8
|
+
flushScheduler,
|
|
9
|
+
measure,
|
|
10
|
+
mutate,
|
|
11
|
+
useScheduledEffect,
|
|
12
|
+
nextFrame,
|
|
13
|
+
raf,
|
|
14
|
+
onResize,
|
|
15
|
+
onIntersect,
|
|
16
|
+
smoothScrollTo,
|
|
17
|
+
} from '../scheduler.js';
|
|
18
|
+
|
|
19
|
+
// Utilities
|
|
20
|
+
export {
|
|
21
|
+
cls,
|
|
22
|
+
style,
|
|
23
|
+
debounce,
|
|
24
|
+
throttle,
|
|
25
|
+
useMediaQuery,
|
|
26
|
+
useLocalStorage,
|
|
27
|
+
useClickOutside,
|
|
28
|
+
} from '../helpers.js';
|
|
29
|
+
export { clearHead } from '../head.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// what-framework/form (what-core/form): form state, validation and bound fields.
|
|
2
|
+
export {
|
|
3
|
+
useForm,
|
|
4
|
+
useFieldArray,
|
|
5
|
+
useField,
|
|
6
|
+
rules,
|
|
7
|
+
simpleResolver,
|
|
8
|
+
zodResolver,
|
|
9
|
+
yupResolver,
|
|
10
|
+
Input,
|
|
11
|
+
Textarea,
|
|
12
|
+
Select,
|
|
13
|
+
Checkbox,
|
|
14
|
+
Radio,
|
|
15
|
+
ErrorMessage,
|
|
16
|
+
} from '../form.js';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// what-core/internal: what what-core shares with its sibling packages and
|
|
2
|
+
// tools (what-server, what-devtools, what-devtools-mcp). Not for applications,
|
|
3
|
+
// and not covered by semver: a name here changes with the packages that use it.
|
|
4
|
+
|
|
5
|
+
// Devtools. what-devtools reads these, and the diagnostics read API below,
|
|
6
|
+
// from this module's namespace object.
|
|
7
|
+
export { _devAction, __setDevToolsHooks, __drainPreinstallBuffer, __depsOf, __subsOf, __currentEffect, __ownerOf, __ownerPath } from '../reactive.js';
|
|
8
|
+
export { __getCacheSnapshot, __invalidateFromDevtools, _tagQueries, _pathLoaded, _loadedQueries } from '../data.js';
|
|
9
|
+
// what-server's <Form>: the status useFormStatus() reads, and its submission.
|
|
10
|
+
export { _formStatusContext, _formStatus } from '../actions.js';
|
|
11
|
+
// what-router's navigation: progress written outside the transition it may
|
|
12
|
+
// run in (it shows at once), and the commit it waits for there; and the state
|
|
13
|
+
// each <Router> provides to what it renders.
|
|
14
|
+
export { _urgent, _currentTransition, _onCommit, _contextOf, _provide, _devHoldsState, _devNewContent, _devDropped } from '../reactive.js';
|
|
15
|
+
// Development: a page and the layouts inside an edited layout keep their
|
|
16
|
+
// state across its hot update.
|
|
17
|
+
export { _hotKeep } from '../render.js';
|
|
18
|
+
// The development flag, for sibling packages whose development-only text must
|
|
19
|
+
// fold away in a production build (what-router's error fixes).
|
|
20
|
+
export { __DEV__ } from '../reactive.js';
|
|
21
|
+
export { report as reportDiagnostic, subscribe as subscribeDiagnostics, getDiagnostics, _thrownMessage } from '../diagnostics.js';
|
|
22
|
+
export {
|
|
23
|
+
configureGuardrails,
|
|
24
|
+
getGuardrailConfig,
|
|
25
|
+
validateImports,
|
|
26
|
+
} from '../guardrails.js';
|
|
27
|
+
|
|
28
|
+
// The error catalogue, for tools that render or classify errors.
|
|
29
|
+
export { ERROR_CODES, createWhatError, classifyError } from '../errors.js';
|
|
30
|
+
|
|
31
|
+
// Where each name the root entry dropped in 0.15 went (validateImports, docs,
|
|
32
|
+
// lint), and where each name only a subpath exports lives.
|
|
33
|
+
export { IMPORT_CHANGES, SUBPATH_ONLY } from '../import-changes.js';
|
|
34
|
+
|
|
35
|
+
// Server rendering (what-server).
|
|
36
|
+
export {
|
|
37
|
+
getServerContext,
|
|
38
|
+
setServerContext,
|
|
39
|
+
runWithServerContext,
|
|
40
|
+
__installServerContextStorage,
|
|
41
|
+
_runComponentAsync,
|
|
42
|
+
_runComponentSync,
|
|
43
|
+
__markServerProcess,
|
|
44
|
+
_isServerProcess,
|
|
45
|
+
__flushOutsideServerContext,
|
|
46
|
+
__outsideServerContext,
|
|
47
|
+
} from '../server-context.js';
|
|
48
|
+
export { _engine } from '../reactive.js';
|
|
49
|
+
export { beginHeadCollection, endHeadCollection } from '../head.js';
|
|
50
|
+
export { escapeHtml as _escapeHtml } from '../markup-rules.js';
|
|
51
|
+
export { _isAriaAttr, _beginComponentSSR, _endComponentSSR, _runInComponentSSR, _resetForm, _formMember } from '../dom.js';
|
|
52
|
+
// The client renderer a '__portal' vnode carries (react-compat's createPortal).
|
|
53
|
+
export { createPortalDOM as _mountPortal } from '../dom.js';
|
|
54
|
+
export { _mapArrayToArray, _rowKeyDigest, isHydrating, _claimRegion, _afterWalk, _signalKeyed } from '../render.js';
|
|
55
|
+
// What a React tree native code places is created in (react-compat): the
|
|
56
|
+
// namespace compiled JSX placed the code in, and the tags only SVG has.
|
|
57
|
+
export { _placedNamespace } from '../render.js';
|
|
58
|
+
export { SVG_TAG as _svgOnlyTag } from '../vnode-renderer.js';
|
|
59
|
+
// The vnode brand: what-server's renderers and its compiled-markup runtime,
|
|
60
|
+
// islands and react-compat recognise vnodes by it.
|
|
61
|
+
export { isVNode } from '../vnode-renderer.js';
|
|
62
|
+
export { _symbolChild, _errorSource } from '../reactive.js';
|
|
63
|
+
export { __readHydrationData, __resetHydrationData, _assignOwnerPath, _ownerCounter, _currentOwnerPath, _actionStateKey, _actionKeySalt, _currentRowPath, _enterRow, _installRowKeys, _leaveRow, _renderSalt, _tracksRows, _errorFromRecord } from '../hydration-data.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// what-framework/motion (what-core/motion): springs, tweens, gestures and CSS
|
|
2
|
+
// transitions.
|
|
3
|
+
export {
|
|
4
|
+
spring,
|
|
5
|
+
tween,
|
|
6
|
+
easings,
|
|
7
|
+
useTween,
|
|
8
|
+
useGesture,
|
|
9
|
+
useAnimatedValue,
|
|
10
|
+
createTransitionClasses,
|
|
11
|
+
cssTransition,
|
|
12
|
+
} from '../animation.js';
|
|
13
|
+
export { transitionClass } from '../helpers.js';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// what-framework/ui (what-core/ui): skeletons and loading placeholders.
|
|
2
|
+
export {
|
|
3
|
+
Skeleton,
|
|
4
|
+
SkeletonText,
|
|
5
|
+
SkeletonAvatar,
|
|
6
|
+
SkeletonCard,
|
|
7
|
+
SkeletonTable,
|
|
8
|
+
IslandSkeleton,
|
|
9
|
+
useSkeleton,
|
|
10
|
+
Placeholder,
|
|
11
|
+
LoadingDots,
|
|
12
|
+
Spinner,
|
|
13
|
+
} from '../skeleton.js';
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// What Framework - Development flag, under the `development` condition
|
|
2
|
+
//
|
|
3
|
+
// reactive.js reads the flag through the package's `#env` import (package.json
|
|
4
|
+
// `imports`), which resolves here for every tool that resolves the
|
|
5
|
+
// `development` export condition: Vite's dev server, webpack and Rollup
|
|
6
|
+
// development builds, `bun build`, `node --conditions=development`. Their
|
|
7
|
+
// development builds run the development tier with its diagnostics wherever
|
|
8
|
+
// the code then runs, whether or not the page has a `process` or
|
|
9
|
+
// `import.meta.env`. `__WHAT_DEV__` still forces a tier, as in env.js.
|
|
10
|
+
|
|
11
|
+
/* global __WHAT_DEV__ */
|
|
12
|
+
export const __DEV__ = typeof __WHAT_DEV__ === 'boolean' ? __WHAT_DEV__ : true;
|
package/src/env.js
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// What Framework - Development flag
|
|
2
|
+
//
|
|
3
|
+
// What has two tiers, and __DEV__ is the only switch between them.
|
|
4
|
+
// reactive.js reads it through the package's `#env` import (package.json
|
|
5
|
+
// `imports`): this module by default, env-development.js under the
|
|
6
|
+
// `development` condition.
|
|
7
|
+
//
|
|
8
|
+
// - Production: scripts/build.js (dist/*.min.js) and what-compiler/vite (a
|
|
9
|
+
// production `vite build`, whether it resolves the dist or the source) define
|
|
10
|
+
// `__WHAT_DEV__` as `false`. The expression below then folds to `false` and
|
|
11
|
+
// the minifier removes every `if (__DEV__)` branch: dev code costs nothing.
|
|
12
|
+
// - Unbuilt (Node, the test suite, a page without a bundler): `__WHAT_DEV__`
|
|
13
|
+
// is an ordinary global, so setting `globalThis.__WHAT_DEV__ = true` or
|
|
14
|
+
// `false` before the framework loads forces a tier. Without it, Vite's
|
|
15
|
+
// import.meta.env.DEV decides, then process.env.NODE_ENV, and a browser with
|
|
16
|
+
// neither gets production behaviour. `process` counts only as a server
|
|
17
|
+
// runtime's (its `versions.node` is a string): a page's own markup can name
|
|
18
|
+
// a global `process` (`<form id="process"><input name="env">`), but never
|
|
19
|
+
// make a string of it, so markup cannot switch the tier.
|
|
20
|
+
//
|
|
21
|
+
// The bundler tier (dist/*.js, the `module` export condition) replaces this
|
|
22
|
+
// module and every use of the flag with a process.env.NODE_ENV test, which
|
|
23
|
+
// the bundlers that resolve it define (scripts/build.js, buildBundlerTier).
|
|
24
|
+
//
|
|
25
|
+
// This module imports nothing, so every module can read the flag from here
|
|
26
|
+
// without risking an import cycle.
|
|
27
|
+
|
|
28
|
+
/* global __WHAT_DEV__ */
|
|
29
|
+
export const __DEV__ =
|
|
30
|
+
typeof __WHAT_DEV__ === 'boolean' ? __WHAT_DEV__
|
|
31
|
+
: import.meta.env ? !!import.meta.env.DEV
|
|
32
|
+
: typeof process !== 'undefined' && typeof process.versions?.node === 'string' ? process.env.NODE_ENV !== 'production'
|
|
33
|
+
: false;
|