mates-devtools 0.1.0-beta.6 → 0.1.0-beta.7
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/mates-devtools.es.js +912 -734
- package/dist/mates-devtools.umd.js +132 -87
- package/dist/types/Mates-DevTools/src/MatesDevTools.d.ts.map +1 -1
- package/dist/types/Mates-DevTools/src/MatesDevToolsComponent.d.ts.map +1 -1
- package/dist/types/Mates-DevTools/src/components/Header.d.ts +3 -2
- package/dist/types/Mates-DevTools/src/components/Header.d.ts.map +1 -1
- package/dist/types/Mates-DevTools/src/components/UserLogsViewer.d.ts +6 -0
- package/dist/types/Mates-DevTools/src/components/UserLogsViewer.d.ts.map +1 -0
- package/dist/types/Mates-DevTools/src/userLogStore.d.ts +26 -0
- package/dist/types/Mates-DevTools/src/userLogStore.d.ts.map +1 -0
- package/dist/types/lib/Directives/animationClasses.d.ts +1 -1
- package/dist/types/lib/Directives/customEvent.d.ts +74 -0
- package/dist/types/lib/Directives/customEvent.d.ts.map +1 -0
- package/dist/types/lib/Directives/disappear.d.ts +23 -0
- package/dist/types/lib/Directives/disappear.d.ts.map +1 -0
- package/dist/types/lib/Directives/eleHook.d.ts.map +1 -1
- package/dist/types/lib/Directives/htmlHook.d.ts.map +1 -1
- package/dist/types/lib/Directives/index.d.ts +5 -3
- package/dist/types/lib/Directives/index.d.ts.map +1 -1
- package/dist/types/lib/Directives/onDirective.d.ts.map +1 -1
- package/dist/types/lib/Directives/onParentDirective.d.ts +1 -1
- package/dist/types/lib/Directives/timerDirective.d.ts +6 -6
- package/dist/types/lib/Directives/timerDirective.d.ts.map +1 -1
- package/dist/types/lib/Directives/virtualHelpers.d.ts +8 -6
- package/dist/types/lib/Directives/virtualHelpers.d.ts.map +1 -1
- package/dist/types/lib/Fetch/Fetch.d.ts +59 -13
- package/dist/types/lib/Fetch/Fetch.d.ts.map +1 -1
- package/dist/types/lib/MatesUtils/FetchUtils.d.ts +23 -0
- package/dist/types/lib/MatesUtils/FetchUtils.d.ts.map +1 -0
- package/dist/types/lib/MatesUtils/MatesUtils.d.ts +47 -0
- package/dist/types/lib/MatesUtils/MatesUtils.d.ts.map +1 -0
- package/dist/types/lib/MatesUtils/RouterUtils.d.ts +39 -0
- package/dist/types/lib/MatesUtils/RouterUtils.d.ts.map +1 -0
- package/dist/types/lib/MatesUtils/StorageUtils.d.ts +16 -0
- package/dist/types/lib/MatesUtils/StorageUtils.d.ts.map +1 -0
- package/dist/types/lib/MatesUtils/ThemeUtils.d.ts +18 -0
- package/dist/types/lib/MatesUtils/ThemeUtils.d.ts.map +1 -0
- package/dist/types/lib/MatesUtils/index.d.ts +6 -0
- package/dist/types/lib/MatesUtils/index.d.ts.map +1 -0
- package/dist/types/lib/Mutables/Extended Atoms/changeFlagAtom.d.ts +56 -0
- package/dist/types/lib/Mutables/Extended Atoms/changeFlagAtom.d.ts.map +1 -0
- package/dist/types/lib/Mutables/Extended Atoms/index.d.ts +1 -0
- package/dist/types/lib/Mutables/Extended Atoms/index.d.ts.map +1 -1
- package/dist/types/lib/Mutables/Extended Atoms/themeAtom.d.ts +3 -15
- package/dist/types/lib/Mutables/Extended Atoms/themeAtom.d.ts.map +1 -1
- package/dist/types/lib/Mutables/atom/atom.d.ts.map +1 -1
- package/dist/types/lib/Mutables/atom/delayAtom.d.ts +40 -0
- package/dist/types/lib/Mutables/atom/delayAtom.d.ts.map +1 -0
- package/dist/types/lib/Mutables/atom/index.d.ts +2 -1
- package/dist/types/lib/Mutables/atom/index.d.ts.map +1 -1
- package/dist/types/lib/Mutables/atom/storageAtom.d.ts +9 -31
- package/dist/types/lib/Mutables/atom/storageAtom.d.ts.map +1 -1
- package/dist/types/lib/Mutables/atom/titleAtom.d.ts +3 -9
- package/dist/types/lib/Mutables/atom/titleAtom.d.ts.map +1 -1
- package/dist/types/lib/Mutables/form/formAtom.d.ts +7 -5
- package/dist/types/lib/Mutables/form/formAtom.d.ts.map +1 -1
- package/dist/types/lib/Mutables/scope/scope.d.ts +32 -1
- package/dist/types/lib/Mutables/scope/scope.d.ts.map +1 -1
- package/dist/types/lib/Mutables/useStore/hostContext.d.ts.map +1 -1
- package/dist/types/lib/Mutables/useStore/subscription.d.ts +1 -1
- package/dist/types/lib/Mutables/useStore/subscription.d.ts.map +1 -1
- package/dist/types/lib/Router/Router.d.ts +2 -2
- package/dist/types/lib/Router/Router.d.ts.map +1 -1
- package/dist/types/lib/Router/animatedRouter.d.ts.map +1 -1
- package/dist/types/lib/Router/hashAtom.d.ts +7 -3
- package/dist/types/lib/Router/hashAtom.d.ts.map +1 -1
- package/dist/types/lib/Router/historyStateAtom.d.ts +8 -0
- package/dist/types/lib/Router/historyStateAtom.d.ts.map +1 -0
- package/dist/types/lib/Router/historyUtils.d.ts +14 -0
- package/dist/types/lib/Router/historyUtils.d.ts.map +1 -0
- package/dist/types/lib/Router/index.d.ts +2 -6
- package/dist/types/lib/Router/index.d.ts.map +1 -1
- package/dist/types/lib/Router/isPathMatching.d.ts +5 -1
- package/dist/types/lib/Router/isPathMatching.d.ts.map +1 -1
- package/dist/types/lib/Router/location.d.ts +4 -63
- package/dist/types/lib/Router/location.d.ts.map +1 -1
- package/dist/types/lib/Router/navigateTo.d.ts +8 -27
- package/dist/types/lib/Router/navigateTo.d.ts.map +1 -1
- package/dist/types/lib/Router/navigationLock.d.ts +5 -46
- package/dist/types/lib/Router/navigationLock.d.ts.map +1 -1
- package/dist/types/lib/Router/navigationRequest.d.ts +26 -0
- package/dist/types/lib/Router/navigationRequest.d.ts.map +1 -0
- package/dist/types/lib/Router/pathAtom.d.ts +16 -36
- package/dist/types/lib/Router/pathAtom.d.ts.map +1 -1
- package/dist/types/lib/Router/qsAtom.d.ts +7 -3
- package/dist/types/lib/Router/qsAtom.d.ts.map +1 -1
- package/dist/types/lib/Template/hmr.d.ts +6 -0
- package/dist/types/lib/Template/hmr.d.ts.map +1 -0
- package/dist/types/lib/Template/x-x.d.ts +1 -0
- package/dist/types/lib/Template/x-x.d.ts.map +1 -1
- package/dist/types/lib/Template/x-x.types.d.ts +0 -22
- package/dist/types/lib/Template/x-x.types.d.ts.map +1 -1
- package/dist/types/lib/Template/x.d.ts +19 -2
- package/dist/types/lib/Template/x.d.ts.map +1 -1
- package/dist/types/lib/TrackState/componentStatus.d.ts +0 -5
- package/dist/types/lib/TrackState/componentStatus.d.ts.map +1 -1
- package/dist/types/lib/TrackState/readTracking.d.ts.map +1 -1
- package/dist/types/lib/Utils/cookie.d.ts +2 -0
- package/dist/types/lib/Utils/cookie.d.ts.map +1 -0
- package/dist/types/lib/Utils/countdown.d.ts +48 -0
- package/dist/types/lib/Utils/countdown.d.ts.map +1 -0
- package/dist/types/lib/Utils/index.d.ts +3 -0
- package/dist/types/lib/Utils/index.d.ts.map +1 -1
- package/dist/types/lib/Utils/logEvent.d.ts +24 -0
- package/dist/types/lib/Utils/logEvent.d.ts.map +1 -0
- package/dist/types/lib/Utils/logger.d.ts +24 -13
- package/dist/types/lib/Utils/logger.d.ts.map +1 -1
- package/dist/types/lib/Utils/onceIdle.d.ts +28 -0
- package/dist/types/lib/Utils/onceIdle.d.ts.map +1 -0
- package/dist/types/lib/Utils/svgIcon.d.ts +2 -4
- package/dist/types/lib/Utils/svgIcon.d.ts.map +1 -1
- package/dist/types/lib/actions/asyncAction.d.ts.map +1 -1
- package/dist/types/lib/css-in-js/index.d.ts +1 -1
- package/dist/types/lib/css-in-js/index.d.ts.map +1 -1
- package/dist/types/lib/css-in-js/stylesheet.d.ts +15 -0
- package/dist/types/lib/css-in-js/stylesheet.d.ts.map +1 -1
- package/dist/types/lib/css-in-js/theme.d.ts +0 -8
- package/dist/types/lib/css-in-js/theme.d.ts.map +1 -1
- package/dist/types/lib/index.d.ts +25 -18
- package/dist/types/lib/index.d.ts.map +1 -1
- package/dist/types/lib/indexdb/index.d.ts +3 -0
- package/dist/types/lib/indexdb/index.d.ts.map +1 -0
- package/dist/types/lib/indexdb/indexdb.d.ts +86 -0
- package/dist/types/lib/indexdb/indexdb.d.ts.map +1 -0
- package/dist/types/lib/indexdb/types.d.ts +249 -0
- package/dist/types/lib/indexdb/types.d.ts.map +1 -0
- package/dist/types/lib/minidb/index.d.ts +3 -0
- package/dist/types/lib/minidb/index.d.ts.map +1 -0
- package/dist/types/lib/minidb/minidb.d.ts +105 -0
- package/dist/types/lib/minidb/minidb.d.ts.map +1 -0
- package/dist/types/lib/on/hooks.d.ts.map +1 -1
- package/dist/types/lib/portals/floating-container.d.ts +129 -0
- package/dist/types/lib/portals/floating-container.d.ts.map +1 -0
- package/dist/types/lib/portals/index.d.ts +5 -3
- package/dist/types/lib/portals/index.d.ts.map +1 -1
- package/dist/types/lib/portals/popup.d.ts +75 -11
- package/dist/types/lib/portals/popup.d.ts.map +1 -1
- package/dist/types/lib/portals/popupPlacement.d.ts +52 -0
- package/dist/types/lib/portals/popupPlacement.d.ts.map +1 -0
- package/dist/types/lib/portals/portal.d.ts +40 -16
- package/dist/types/lib/portals/portal.d.ts.map +1 -1
- package/dist/types/lib/socket/ws.d.ts +2 -2
- package/dist/types/lib/ssr/index.d.ts +1 -0
- package/dist/types/lib/ssr/index.d.ts.map +1 -1
- package/dist/types/lib/ssr/ssrFlag.d.ts +56 -21
- package/dist/types/lib/ssr/ssrFlag.d.ts.map +1 -1
- package/dist/types/lib/ssr/useCtx.d.ts +63 -0
- package/dist/types/lib/ssr/useCtx.d.ts.map +1 -0
- package/dist/types/lib/virtualizer/Virtualizer.d.ts +3 -2
- package/dist/types/lib/virtualizer/Virtualizer.d.ts.map +1 -1
- package/dist/types/lib/virtualizer/layouts/shared/BaseLayout.d.ts +8 -0
- package/dist/types/lib/virtualizer/layouts/shared/BaseLayout.d.ts.map +1 -1
- package/dist/types/lib/virtualizer/mates-adapter.d.ts +36 -88
- package/dist/types/lib/virtualizer/mates-adapter.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/types/lib/Router/pathResolver.d.ts +0 -9
- package/dist/types/lib/Router/pathResolver.d.ts.map +0 -1
- package/dist/types/lib/portals/tip.d.ts +0 -38
- package/dist/types/lib/portals/tip.d.ts.map +0 -1
- package/dist/types/lib/virtualizer/layouts/grid.d.ts +0 -25
- package/dist/types/lib/virtualizer/layouts/grid.d.ts.map +0 -1
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolves after the browser has finished all pending microtasks, effects
|
|
3
|
+
* and renders — i.e. once the current "work cycle" is fully idle.
|
|
4
|
+
*
|
|
5
|
+
* - Uses `requestIdleCallback` when available (Chromium, Firefox) so the
|
|
6
|
+
* callback only runs when the main thread has no higher-priority work left.
|
|
7
|
+
* - Falls back to `requestAnimationFrame` on browsers that don't support rIC
|
|
8
|
+
* (Safari). A single rAF fires after all queued microtasks drain, which
|
|
9
|
+
* covers the mates effectScheduler + globalScheduler flush cycle.
|
|
10
|
+
* - In SSR (no window) the promise resolves on the next microtask so
|
|
11
|
+
* server-side code can `await onceIdle()` without throwing.
|
|
12
|
+
*
|
|
13
|
+
* Accepts an optional `callback` that is invoked just before the promise
|
|
14
|
+
* resolves, making both usage patterns work:
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // await style — pause until idle, then continue
|
|
18
|
+
* await onceIdle();
|
|
19
|
+
* console.log("all renders have settled");
|
|
20
|
+
*
|
|
21
|
+
* // callback style — fire-and-forget
|
|
22
|
+
* onceIdle(() => expensiveWork());
|
|
23
|
+
*
|
|
24
|
+
* // callback + await — run work at the idle point, then continue
|
|
25
|
+
* await onceIdle(() => expensiveWork());
|
|
26
|
+
*/
|
|
27
|
+
export declare function onceIdle(callback?: () => void): Promise<void>;
|
|
28
|
+
//# sourceMappingURL=onceIdle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"onceIdle.d.ts","sourceRoot":"","sources":["../../../../../lib/Utils/onceIdle.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAsB7D"}
|
|
@@ -69,10 +69,8 @@ declare const svgIconDirective: (_markup: string, _config: SvgConfig) => import(
|
|
|
69
69
|
* ```ts
|
|
70
70
|
* import { safeSVG, html } from "mates";
|
|
71
71
|
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
* <path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5…"/>
|
|
75
|
-
* </svg>`;
|
|
72
|
+
* // markup must be a valid SVG string (starts with <svg ...>)
|
|
73
|
+
* const heartIcon = `<svg viewBox="0 0 24 24"><path d="M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5…"/></svg>`;
|
|
76
74
|
*
|
|
77
75
|
* html`<button>${safeSVG(heartIcon, { size: 24, fill: "currentColor" })}</button>`;
|
|
78
76
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"svgIcon.d.ts","sourceRoot":"","sources":["../../../../../lib/Utils/svgIcon.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,SAAS,EAAuB,MAAM,uBAAuB,CAAC;AAIvE;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB,6DAA6D;IAC7D,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACxB,8DAA8D;IAC9D,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,gEAAgE;IAChE,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,qDAAqD;IACrD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,6DAA6D;IAC7D,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,CA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AErC;AAED;;;;;;;;;GASG;AACH,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"asyncAction.d.ts","sourceRoot":"","sources":["../../../../../lib/actions/asyncAction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"asyncAction.d.ts","sourceRoot":"","sources":["../../../../../lib/actions/asyncAction.ts"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAGV,kBAAkB,EAClB,qBAAqB,EAGtB,MAAM,oBAAoB,CAAC;AAE5B,YAAY,EACV,2BAA2B,EAC3B,4BAA4B,EAC5B,kBAAkB,EAClB,qBAAqB,EACrB,iBAAiB,GAClB,MAAM,oBAAoB,CAAC;AAK5B,wBAAgB,WAAW,CAAC,CAAC,SAAS,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,OAAO,CAAC,GAAG,CAAC,EACpE,OAAO,EAAE,CAAC,EACV,OAAO,CAAC,EAAE,kBAAkB,GAC3B,qBAAqB,CAAC,CAAC,CAAC,CAoO1B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type { Cl } from "./cl";
|
|
2
2
|
export type { CSSBlock, CSSNestedBlock, CSSRulesInput, SerializeOptions, } from "./serialize";
|
|
3
3
|
export type { CSSKeyframeStops } from "./stylesheet";
|
|
4
|
-
export { configureCSS, globalCSS, keyframes, stylesheet } from "./stylesheet";
|
|
4
|
+
export { collectSSRStyles, configureCSS, globalCSS, keyframes, stylesheet, } from "./stylesheet";
|
|
5
5
|
export type { CssVars, GlobalThemeResult, ThemeMode, ThemesInput, ThemeTokenMap, } from "./theme";
|
|
6
6
|
export { globalTheme, rootCSS } from "./theme";
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../lib/css-in-js/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC/B,YAAY,EACV,QAAQ,EACR,cAAc,EACd,aAAa,EACb,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../lib/css-in-js/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,EAAE,EAAE,MAAM,MAAM,CAAC;AAC/B,YAAY,EACV,QAAQ,EACR,cAAc,EACd,aAAa,EACb,gBAAgB,GACjB,MAAM,aAAa,CAAC;AACrB,YAAY,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AACrD,OAAO,EACL,gBAAgB,EAChB,YAAY,EACZ,SAAS,EACT,SAAS,EACT,UAAU,GACX,MAAM,cAAc,CAAC;AACtB,YAAY,EACV,OAAO,EACP,iBAAiB,EACjB,SAAS,EACT,WAAW,EACX,aAAa,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -8,6 +8,14 @@ import type { Cl, CSSRulesInput } from "./cl";
|
|
|
8
8
|
* Keys are `"from"`, `"to"`, or percentage strings like `"0%"`, `"50%"`.
|
|
9
9
|
*/
|
|
10
10
|
export type CSSKeyframeStops = Record<string, CSS.Properties>;
|
|
11
|
+
/**
|
|
12
|
+
* Collect all CSS text from every registered stylesheet instance.
|
|
13
|
+
* Call this after rendering a page on the server to get the full CSS string
|
|
14
|
+
* to inline into the HTML <head> as `<style id="mates-ssr-styles">`.
|
|
15
|
+
*
|
|
16
|
+
* @returns A single CSS string (all instances joined with newlines), or "" if none.
|
|
17
|
+
*/
|
|
18
|
+
export declare function collectSSRStyles(): string;
|
|
11
19
|
/**
|
|
12
20
|
* A ref-counted, lazily-mounted CSS stylesheet.
|
|
13
21
|
*
|
|
@@ -20,6 +28,7 @@ export type CSSKeyframeStops = Record<string, CSS.Properties>;
|
|
|
20
28
|
*/
|
|
21
29
|
declare class StylesheetInstance {
|
|
22
30
|
#private;
|
|
31
|
+
constructor();
|
|
23
32
|
/**
|
|
24
33
|
* Register a `@keyframes` animation into this sheet.
|
|
25
34
|
*
|
|
@@ -64,6 +73,12 @@ declare class StylesheetInstance {
|
|
|
64
73
|
get cssText(): string;
|
|
65
74
|
get isMounted(): boolean;
|
|
66
75
|
get sheet(): CSSStyleSheet | null;
|
|
76
|
+
/**
|
|
77
|
+
* Returns all CSS text owned by this instance — both the already-flushed
|
|
78
|
+
* `#cssText` and any still-pending rules that haven't been committed to the
|
|
79
|
+
* CSSStyleSheet yet. Used by `collectSSRStyles()` during server-side rendering.
|
|
80
|
+
*/
|
|
81
|
+
getAllCSS(): string;
|
|
67
82
|
}
|
|
68
83
|
/**
|
|
69
84
|
* Create a per-component stylesheet.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stylesheet.d.ts","sourceRoot":"","sources":["../../../../../lib/css-in-js/stylesheet.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,gBAAgB,EAAkB,MAAM,aAAa,CAAC;AAEpE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,KAAK,KAAK,GAAG,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"stylesheet.d.ts","sourceRoot":"","sources":["../../../../../lib/css-in-js/stylesheet.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,KAAK,gBAAgB,EAAkB,MAAM,aAAa,CAAC;AAEpE,YAAY,EAAE,QAAQ,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC3E,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,KAAK,KAAK,GAAG,MAAM,SAAS,CAAC;AAKpC,OAAO,KAA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AgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAOvE;AAID;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,aAAa,EAC/C,KAAK,EAAE,CAAC,EACR,OAAO,CAAC,EAAE,gBAAgB,GACzB,EAAE,CAAC,CAAC,CAAC,CAYP;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAI9C;AAID;;;;;;GAMG;AACH,wBAAgB,gBAAgB,IAAI,IAAI,CAGvC;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type ThemeAtomType } from "../Mutables/Extended Atoms/themeAtom";
|
|
2
1
|
/**
|
|
3
2
|
* A flat map of token names to CSS values.
|
|
4
3
|
* Keys may include or omit the leading "--".
|
|
@@ -33,13 +32,6 @@ export type ThemeMode<T extends ThemesInput> = "auto" | (string & keyof T);
|
|
|
33
32
|
export type GlobalThemeResult<T extends ThemesInput> = {
|
|
34
33
|
/** Plain object: tokenKey → "--token-key" (the CSS variable name, no var() wrapper). */
|
|
35
34
|
cssVars: CssVars<T[keyof T]>;
|
|
36
|
-
/**
|
|
37
|
-
* The singleton theme atom shared across the entire app.
|
|
38
|
-
* Call `.setToDark()`, `.setToLight()`, `.setToAuto()`, or `.toggle()`.
|
|
39
|
-
* Reads/writes localStorage & data-theme on <html>.
|
|
40
|
-
* Always the same instance as `themeAtom()` from mates.
|
|
41
|
-
*/
|
|
42
|
-
themeAtom: ThemeAtomType;
|
|
43
35
|
};
|
|
44
36
|
/**
|
|
45
37
|
* Define your application's themes as named token maps.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../lib/css-in-js/theme.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"theme.d.ts","sourceRoot":"","sources":["../../../../../lib/css-in-js/theme.ts"],"names":[],"mappings":"AAmBA;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAEnD;;;;;;;;;;GAUG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAExD;;;;;GAKG;AACH,MAAM,MAAM,OAAO,CAAC,CAAC,SAAS,aAAa,IAAI;IAC7C,QAAQ,EAAE,CAAC,IAAI,MAAM,CAAC,GAAG,MAAM;CAChC,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,SAAS,CAAC,CAAC,SAAS,WAAW,IAAI,MAAM,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,CAAC,CAAC;AAE3E,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,WAAW,IAAI;IACrD,wFAAwF;IACxF,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;CAC9B,CAAC;AA4CF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,wBAAgB,WAAW,CAAC,CAAC,SAAS,WAAW,EAC/C,MAAM,EAAE,CAAC,GACR,iBAAiB,CAAC,CAAC,CAAC,CAgDtB;AAID;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,OAAO,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAQtE"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export type { TemplateResult } from "lit-html";
|
|
2
2
|
export { html, noChange, nothing, render, svg } from "lit-html";
|
|
3
|
-
export { unsafeHTML } from "lit-html/directives/unsafe-html.js";
|
|
4
3
|
export { asyncAppend } from "lit-html/directives/async-append.js";
|
|
5
4
|
export { asyncReplace } from "lit-html/directives/async-replace.js";
|
|
6
5
|
export { cache as litCache } from "lit-html/directives/cache.js";
|
|
@@ -13,34 +12,42 @@ export { live } from "lit-html/directives/live.js";
|
|
|
13
12
|
export { range } from "lit-html/directives/range.js";
|
|
14
13
|
export { repeat } from "lit-html/directives/repeat.js";
|
|
15
14
|
export { styleMap } from "lit-html/directives/style-map.js";
|
|
15
|
+
export { unsafeHTML } from "lit-html/directives/unsafe-html.js";
|
|
16
16
|
export { until } from "lit-html/directives/until.js";
|
|
17
17
|
export { when } from "lit-html/directives/when.js";
|
|
18
18
|
import "./Template/x-x";
|
|
19
19
|
import "./Template/xProvider";
|
|
20
20
|
import "./Directives/animationClasses";
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export { type TrackingSnapshot, isReadTrackingEnabled, getStoresBeingRead, isEffectRunning, addStoreBeingRead, pushEffect, popEffect, saveAndEnableTracking, restoreTracking, startTracking, stopTracking, } from "./TrackState/readTracking";
|
|
24
|
-
export { createManagedTimer } from "./Timers";
|
|
25
|
-
export { type ActionAfterInterceptor, type ActionBeforeInterceptor, type ActionFn, type ActionReturnType, type ActionSubscriber, type AnimateDirectiveConfig, type AnimateKeyframes, type AnimateOptions, type AnimationHandle, type AnimationPreset, type AsyncActionAfterInterceptor, type AsyncActionBeforeInterceptor, type AsyncActionOptions, type AsyncActionReturnType, type AsyncActionStatus, action, asyncAction, blurInPreset, blurOutPreset, bouncePreset, type CacheManager, cache as cacheFn, createCacheManager, createPollingManager, collapseWidthPreset, debounce, deleteAction, type ElementTarget, expandWidthPreset, type FetchBody, fadeInPreset, fadeOutPreset, fetchAction, flipInPreset, flipOutPreset, getAction, type PaginatedAsyncActionReturnType, paginatedAsyncAction, patchAction, type PollingManager, postAction, pulsePreset, putAction, type SlideDirection, scaleInPreset, scaleOutPreset, shakePreset, slideInPreset, slideOutPreset, spinPreset, springInPreset, type Task, type TaskActionType, type TaskStatus, taskAction, throttle, withStaggerPreset, } from "./actions";
|
|
21
|
+
export { FetchUtils, MatesUtils, RouterUtils, StorageUtils, ThemeUtils, } from "./MatesUtils";
|
|
22
|
+
export { type ActionAfterInterceptor, type ActionBeforeInterceptor, type ActionFn, type ActionReturnType, type ActionSubscriber, type AnimateDirectiveConfig, type AnimateKeyframes, type AnimateOptions, type AnimationHandle, type AnimationPreset, type AsyncActionAfterInterceptor, type AsyncActionBeforeInterceptor, type AsyncActionOptions, type AsyncActionReturnType, type AsyncActionStatus, action, asyncAction, blurInPreset, blurOutPreset, bouncePreset, type CacheManager, cache as cacheFn, collapseWidthPreset, createCacheManager, createPollingManager, debounce, deleteAction, type ElementTarget, expandWidthPreset, type FetchBody, fadeInPreset, fadeOutPreset, fetchAction, flipInPreset, flipOutPreset, getAction, type PaginatedAsyncActionReturnType, type PollingManager, paginatedAsyncAction, patchAction, postAction, pulsePreset, putAction, type SlideDirection, scaleInPreset, scaleOutPreset, shakePreset, slideInPreset, slideOutPreset, spinPreset, springInPreset, type Task, type TaskActionType, type TaskStatus, taskAction, throttle, withStaggerPreset, } from "./actions";
|
|
26
23
|
export type { Cl, CSSBlock, CSSKeyframeStops, CSSNestedBlock, CSSRulesInput, CssVars, GlobalThemeResult, SerializeOptions, ThemeMode, ThemesInput, ThemeTokenMap, } from "./css-in-js";
|
|
27
|
-
export { configureCSS, globalCSS, globalTheme, keyframes, rootCSS, stylesheet, } from "./css-in-js";
|
|
28
|
-
export { $, type AnimatedIfConfig, type AnimatedXConfig, type AttrMap, type AttrValue, animatedIf, animatedX, attr, type ClassEntry, type ClassesInput, type ConnectCallback, classes, type DisconnectCallback, type DollarChain, type EleHookLifecycle, type EleHookMountFn, eleHook, type HtmlHookLifecycle, type HtmlHookMountFn, type HtmlHookRenderFn, htmlHook, type IntersectCallback, type IntersectOptions, type LazyLoadCallback, type LazyLoadOptions, lazyLoad, type MasonryGridOptions, type MasonryItemTemplate, type MasonryKeyFn, type MatesCustomEventMap, type MemoKeys, type MemoTemplateFn, masonryGrid, memoTemplate, type OnEventMap, type OnParentMap, on, onConnect, onDisconnect, onHidden, onIntersect, onParent, onScrolledIntoView, onVisible, removeAttr, removeClasses, removeOn, removeStyle, renderSwitch, type ScrolledIntoViewCallback, type ScrolledIntoViewOptions, type StyleMap, type StyleValue, type SwitchCase, type SwitchEntry, style, type TimerContent,
|
|
24
|
+
export { collectSSRStyles, configureCSS, globalCSS, globalTheme, keyframes, rootCSS, stylesheet, } from "./css-in-js";
|
|
25
|
+
export { $, type AnimatedIfConfig, type AnimatedXConfig, type AttrMap, type AttrValue, animatedIf, animatedX, attr, type ClassEntry, type ClassesInput, type ConnectCallback, classes, type DisconnectCallback, type DollarChain, disappear, type EleEventHandler, type EleHookLifecycle, type EleHookMountFn, eleHook, type HtmlHookLifecycle, type HtmlHookMountFn, type HtmlHookRenderFn, htmlHook, type IntersectCallback, type IntersectOptions, type LazyLoadCallback, type LazyLoadOptions, lazyLoad, type MasonryGridOptions, type MasonryItemTemplate, type MasonryKeyFn, type MatesCustomEventMap, type MemoKeys, type MemoTemplateFn, masonryGrid, memoTemplate, type OnEventMap, type OnParentMap, on as onEvent, onConnect, onDisconnect, onEleEvent, onHidden, onIntersect, onParent, onScrolledIntoView, onVisible, removeAttr, removeClasses, removeOn, removeStyle, renderSwitch, type ScrolledIntoViewCallback, type ScrolledIntoViewOptions, type StyleMap, type StyleValue, type SwitchCase, type SwitchEntry, style, type TimerContent, timerTemplate, type UpdateCallback, useEleEvent, type VirtualListOptions, type VirtualMasonryOptions, virtualList, virtualMasonry, } from "./Directives";
|
|
29
26
|
export type { Measurements } from "./Directives/$";
|
|
30
27
|
export { injectMatesAnimations, MA, type MatesAnimationClass, } from "./Directives/animationClasses";
|
|
31
28
|
export { type DevToolsHooks, installDevToolsHooks, isDevToolsInstalled, } from "./devtools";
|
|
32
|
-
export { type AfterInterceptor, type BeforeInterceptor, buildRequestUrl,
|
|
33
|
-
export
|
|
29
|
+
export { type AfterInterceptor, type BeforeInterceptor, buildRequestUrl, type ErrorInterceptor, type ErrorType, ErrorTypes, type FetchActionConfig, FetchClient, type FetchRequest, isApiResponseSuccess, runWithGlobalInterceptors, setSSRApiLookup, setSSRRequest, withAuth, withBaseUrl, withLogging, } from "./Fetch";
|
|
30
|
+
export type { DBInstanceType, DBTableAtom, DBTableType, IDBKey, IndexDBConfig, IndexQueryBuilderType, MigratorType, RangeBuilder, TransactionScopeType, } from "./indexdb";
|
|
31
|
+
export { indexDB } from "./indexdb";
|
|
32
|
+
export { _, _subToView, type AtomConfig, type AtomType, atom, type CacheAtomType, type ChangeFlagAtomType, cacheAtom, changeFlagAtom, createReactiveRunner, createTimedAtom, debouncedAtom, delayAtom, df, type EventType, effect, event, type FormAtom, formAtom, getCurrentHost, getParentScope, getParentScope as getScope, type IAtomType, iAtom, iAtom as signal, isEmail, isMax, isMin, isPattern, isRequired, mapAtom, maxLength, memo, minLength, on, on as watch, onAllMount, onCleanup, onError, onMount, onPaint, onReferenceChange, type PaginationAtomType, paginationAtom, type Ref, ref, type SetterReturnType, type StorageAtomType, type StorageValue, type Subscribable, type SuperAtomOptions, type SuperAtomType, safetyCheck, scope, setAtom, setRef, setter, superAtom, type ThemeAtomType, type ThemeValue, throttledAtom, trackAndSubscribe, useContext, useFetch, useRouter, useScope, useStorage, useTheme, useUtils, registerGlobalScopes, getGlobalScopeClasses, useState, useStore, type ValidateAllResult, type ValidatorFn, validateAll, validateReactiveFunction, withHost, type XTabEventType, xTabEvent, } from "./Mutables";
|
|
33
|
+
export { store } from "./Mutables/store";
|
|
34
|
+
export type { MiniDBInstance, MiniDBList, MiniDBMigrateFn, MiniDBMigrator, } from "./minidb";
|
|
35
|
+
export { miniDB } from "./minidb";
|
|
34
36
|
export { onBlur, onClickAway, onCopy, onCut, onDOMReady, onFileDrop, onFocus, onInterval, onKeyDown, onKeyUp, onNavigate, onOffline, onOnline, onPaste, onResize, onScroll, onSelectionChange, onSocket, onStorageChange, onTimeout, onUpdate, onVisibilityChange, onWindow, onWindowCapture, onWindowResize, onWindowScroll, type WheelDirectionEvent, type WindowHookEventName, type WindowHookHandler, } from "./on";
|
|
35
|
-
export type { DialogOptions, Placement, PopupOptions, PopupPlacement, PortalOptions,
|
|
36
|
-
export { computeAutoPlacement, dialog, getCoords, placementTransform, popup, portal,
|
|
37
|
-
export { type AnimatedRouteConfig, type AnimatedRouterOptions, animatedRouter, buildPath,
|
|
37
|
+
export type { DialogOptions, FloatingContainer, FloatingContainerOptions, Placement, PopupOpenAtom, PopupOptions, PopupPlacement, PortalOptions, } from "./portals";
|
|
38
|
+
export { computeAutoPlacement, createFloatingContainer, dialog, getCoords, placementTransform, popup, portal, } from "./portals";
|
|
39
|
+
export { type AnimatedRouteConfig, type AnimatedRouterOptions, animatedRouter, buildPath, isPathMatching, type NavigationRequestDetail, replaceParams, route, Router, } from "./Router";
|
|
38
40
|
export type { WsConfig, WsConnection, WsStatus } from "./socket";
|
|
39
41
|
export { ws } from "./socket";
|
|
40
|
-
export { isSSR, setSSRMode } from "./ssr";
|
|
41
|
-
export
|
|
42
|
-
export {
|
|
43
|
-
export {
|
|
44
|
-
export {
|
|
42
|
+
export { decrementSsrAsyncCounter, done, getSsrAsyncCounter, incrementSsrAsyncCounter, isDev, isSSR, setSSRMode, setSsrDoneCallback, } from "./ssr";
|
|
43
|
+
export { useCtx, useIsSSR, type Ctx } from "./ssr";
|
|
44
|
+
export type { Component, ComponentElement, ComponentType, HostElement, LazyComponent, Props, Setter, TemplateFn, } from "./Template";
|
|
45
|
+
export { cleanupScheduler, effectScheduler, globalScheduler, isAsyncValue, renderX, resetComponentState, resolveAsyncValue, unwrapModule, WithScope, x, } from "./Template";
|
|
46
|
+
export { renderTemplate, template, view } from "./Template/x";
|
|
47
|
+
export { createManagedTimer } from "./Timers";
|
|
48
|
+
export { assertComponentOuterContext, assertNotInRestrictedContext, componentRunningStatus, isInRestrictedContext, } from "./TrackState/componentStatus";
|
|
49
|
+
export { addStoreBeingRead, getStoresBeingRead, isEffectRunning, isReadTrackingEnabled, popEffect, pushEffect, restoreTracking, saveAndEnableTracking, startTracking, stopTracking, type TrackingSnapshot, } from "./TrackState/readTracking";
|
|
50
|
+
export { Context, type Countdown, type CountdownState, chunk, clamp, countdown, deepClone, deepFreeze, get, getAllProps, getCookieObj, groupBy, type IterateDeeplyCallback, isAction, isAsyncAction, isAsyncFunction, isAtom, isChannel, isConfirmationEvent, isDefinedAsGetter, isEmpty, isEvent, isFunction, isGetter, isSetter, isUnit, iterateDeeply, log, logError, logWarning, type MatesLogEventDetail, matesLogEvent, merge, NotificationManager, omit, onceIdle, pick, range as arrayRange, registerCleanup, type SvgConfig, SyncNotificationManager, safeClone, safeSVG, safeSVG as unsafeSVG, uniqBy, uuid, uuid as randomId, } from "./Utils";
|
|
45
51
|
export { type DateInput, type DateUnit, type DateValues, date, getAllTimezones, getCalendar, getLocale, getMonths, getTimezoneOffset, type MatesDate, type MonthInfo, setLocale, setTimezone, setTimezoneOffset, type TimezoneEntry, } from "./Utils/Date";
|
|
52
|
+
export { ZeroPromise } from "./ZeroPromise";
|
|
46
53
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/index.ts"],"names":[],"mappings":"AAKA,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../lib/index.ts"],"names":[],"mappings":"AAKA,YAAY,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE/C,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,qCAAqC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,s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AAK,EAEL,mBAAmB,EACnB,IAAI,EACJ,QAAQ,EACR,IAAI,EAEJ,KAAK,IAAI,UAAU,EAEnB,eAAe,EACf,KAAK,SAAS,EACd,uBAAuB,EACvB,SAAS,EACT,OAAO,EACP,OAAO,IAAI,SAAS,EACpB,MAAM,EACN,IAAI,EACJ,IAAI,IAAI,QAAQ,GACjB,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,KAAK,SAAS,EACd,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,IAAI,EACJ,eAAe,EACf,WAAW,EACX,SAAS,EACT,SAAS,EACT,iBAAiB,EACjB,KAAK,SAAS,EACd,KAAK,SAAS,EACd,SAAS,EACT,WAAW,EACX,iBAAiB,EACjB,KAAK,aAAa,GACnB,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../lib/indexdb/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EACV,cAAc,EACd,WAAW,EACX,WAAW,EACX,MAAM,EACN,aAAa,EACb,qBAAqB,EACrB,YAAY,EACZ,YAAY,EACZ,oBAAoB,GACrB,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { DBInstanceType, IndexDBConfig } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Opens (or creates / upgrades) an IndexedDB database and returns a typed
|
|
4
|
+
* `DBInstanceType` handle.
|
|
5
|
+
*
|
|
6
|
+
* **SSR:** rejects immediately — IndexedDB is a browser-only API.
|
|
7
|
+
*
|
|
8
|
+
* @param name Database name.
|
|
9
|
+
* @param config `{ version, upgrade? }` — provide `upgrade(migrator, oldVersion)`
|
|
10
|
+
* to define the schema and handle migrations.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```ts
|
|
14
|
+
* interface User { id: string; name: string; age: number; role: string; createdAt: number }
|
|
15
|
+
*
|
|
16
|
+
* const db = await indexDB("app-db", {
|
|
17
|
+
* version: 2,
|
|
18
|
+
* upgrade(migrator, oldVersion) {
|
|
19
|
+
* if (oldVersion < 1) {
|
|
20
|
+
* migrator.createTable("users", "id", ["age", "role", "createdAt"]);
|
|
21
|
+
* }
|
|
22
|
+
* if (oldVersion < 2) {
|
|
23
|
+
* migrator.addIndex("users", "name");
|
|
24
|
+
* }
|
|
25
|
+
* },
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* const users = db.table<User>("users", "id");
|
|
29
|
+
*
|
|
30
|
+
* // ── Writes ───────────────────────────────────────────────────────────────
|
|
31
|
+
* await users.add({ id: "u1", name: "Alice", age: 30, role: "admin", createdAt: Date.now() });
|
|
32
|
+
* await users.set("u1", { ...updated });
|
|
33
|
+
* await users.update("u1", (u) => { u.age += 1; });
|
|
34
|
+
* await users.delete("u1");
|
|
35
|
+
* await users.clear();
|
|
36
|
+
*
|
|
37
|
+
* // ── Point reads ──────────────────────────────────────────────────────────
|
|
38
|
+
* await users.get("u1"); // User | undefined
|
|
39
|
+
* await users.has("u1"); // boolean
|
|
40
|
+
* await users.count(); // number
|
|
41
|
+
*
|
|
42
|
+
* // ── All rows ─────────────────────────────────────────────────────────────
|
|
43
|
+
* const all = await users.toArray(); // DBTableAtom<User>
|
|
44
|
+
* all(); // User[] — reactive
|
|
45
|
+
*
|
|
46
|
+
* // ── Direct pagination (cursor-based, efficient) ───────────────────────────
|
|
47
|
+
* const p1 = await users.page(1, 20); // DBTableAtom<User>
|
|
48
|
+
*
|
|
49
|
+
* // ── Native index filter — only reads matching rows ────────────────────────
|
|
50
|
+
* const admins = await users.filterByIndex("role", (r) => r.equals("admin")).toArray();
|
|
51
|
+
* const adults = await users.filterByIndex("age", (r) => r.greaterThan(18)).page(1, 20);
|
|
52
|
+
* const alices = await users.filterByIndex("name", (r) => r.startsWith("Al")).toArray();
|
|
53
|
+
* const midRange = await users.filterByIndex("age", (r) => r.between(20, 40)).toArray();
|
|
54
|
+
*
|
|
55
|
+
* // ── Native index sort — cursor-driven, no JS sort ────────────────────────
|
|
56
|
+
* const byDate = await users.sortByIndex("createdAt", "desc").page(1, 20);
|
|
57
|
+
*
|
|
58
|
+
* // ── Combined: same index → single cursor pass ─────────────────────────────
|
|
59
|
+
* const adminsByDate = await users
|
|
60
|
+
* .filterByIndex("role", (r) => r.equals("admin"))
|
|
61
|
+
* .sortByIndex("role", "asc") // same index → one cursor, zero JS
|
|
62
|
+
* .page(1, 20);
|
|
63
|
+
*
|
|
64
|
+
* // ── Combined: different indexes → filter native, sort in JS ──────────────
|
|
65
|
+
* const adultsByDate = await users
|
|
66
|
+
* .filterByIndex("age", (r) => r.greaterThan(18))
|
|
67
|
+
* .sortByIndex("createdAt", "desc") // different → JS sort on subset only
|
|
68
|
+
* .page(1, 20);
|
|
69
|
+
*
|
|
70
|
+
* // ── Item-level atom mutations (write-through to IDB) ─────────────────────
|
|
71
|
+
* await byDate.updateItem("u1", (u) => { u.name = "Bob"; });
|
|
72
|
+
* await byDate.setItem("u1", newUser);
|
|
73
|
+
* await byDate.removeItem("u1");
|
|
74
|
+
* await byDate.refresh(); // re-run query, replace atom value
|
|
75
|
+
*
|
|
76
|
+
* // ── Atomic transaction ───────────────────────────────────────────────────
|
|
77
|
+
* await db.transaction(["users", "logs"], async (tx) => {
|
|
78
|
+
* await tx.table<User>("users", "id").update("u1", (u) => { u.role = "mod"; });
|
|
79
|
+
* await tx.table<Log>("logs", "id").add({ id: "l1", userId: "u1", action: "role_change" });
|
|
80
|
+
* });
|
|
81
|
+
*
|
|
82
|
+
* db.close();
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
export declare function indexDB(name: string, config: IndexDBConfig): Promise<DBInstanceType>;
|
|
86
|
+
//# sourceMappingURL=indexdb.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"indexdb.d.ts","sourceRoot":"","sources":["../../../../../lib/indexdb/indexdb.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,cAAc,EAId,aAAa,EAKd,MAAM,SAAS,CAAC;AA8YjB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkFG;AACH,wBAAgB,OAAO,CACrB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,aAAa,GACpB,OAAO,CAAC,cAAc,CAAC,CAgFzB"}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import type { AtomType } from "../Mutables/atom/atom";
|
|
2
|
+
/** Alias for the browser's `IDBValidKey` union type. */
|
|
3
|
+
export type IDBKey = IDBValidKey;
|
|
4
|
+
/**
|
|
5
|
+
* Passed to the `upgrade` callback when a database version change is detected.
|
|
6
|
+
* Use this to define or evolve the schema — create stores, add/remove indexes,
|
|
7
|
+
* or drop obsolete stores.
|
|
8
|
+
*
|
|
9
|
+
* All methods are no-ops when the target already exists (or doesn't, for
|
|
10
|
+
* removals), so conditional guards like `if (oldVersion < 2)` are sufficient
|
|
11
|
+
* without extra existence checks.
|
|
12
|
+
*/
|
|
13
|
+
export type MigratorType = {
|
|
14
|
+
/**
|
|
15
|
+
* Creates a new object store with an inline primary key.
|
|
16
|
+
* No-op if the store already exists.
|
|
17
|
+
*
|
|
18
|
+
* @param name Store name.
|
|
19
|
+
* @param primaryKey Field name used as the keyPath (inline key).
|
|
20
|
+
* @param indexes Optional secondary index field names to create.
|
|
21
|
+
*/
|
|
22
|
+
createTable(name: string, primaryKey: string, indexes?: string[]): void;
|
|
23
|
+
/**
|
|
24
|
+
* Adds a secondary index to an existing store.
|
|
25
|
+
* No-op if the index already exists.
|
|
26
|
+
*
|
|
27
|
+
* @param storeName Target object store name.
|
|
28
|
+
* @param indexName Field name to index.
|
|
29
|
+
* @param options Optional `IDBIndexParameters` (e.g. `{ unique: true }`).
|
|
30
|
+
*/
|
|
31
|
+
addIndex(storeName: string, indexName: string, options?: IDBIndexParameters): void;
|
|
32
|
+
/**
|
|
33
|
+
* Removes a secondary index from an existing store.
|
|
34
|
+
* No-op if the index does not exist.
|
|
35
|
+
*/
|
|
36
|
+
removeIndex(storeName: string, indexName: string): void;
|
|
37
|
+
/**
|
|
38
|
+
* Drops an entire object store.
|
|
39
|
+
* No-op if the store does not exist.
|
|
40
|
+
*/
|
|
41
|
+
dropTable(name: string): void;
|
|
42
|
+
};
|
|
43
|
+
export type IndexDBConfig = {
|
|
44
|
+
/** Target database version. Increment this to trigger the `upgrade` callback. */
|
|
45
|
+
version: number;
|
|
46
|
+
/**
|
|
47
|
+
* Called when the database is created or upgraded to the new `version`.
|
|
48
|
+
*
|
|
49
|
+
* @param migrator Schema helper — use `createTable`, `addIndex`, etc.
|
|
50
|
+
* @param oldVersion Previous version number (`0` for a brand-new database).
|
|
51
|
+
*/
|
|
52
|
+
upgrade?: (migrator: MigratorType, oldVersion: number) => void;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Fluent helper passed to `filterByIndex()`.
|
|
56
|
+
* Wraps the static `IDBKeyRange` factory methods with readable names.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```ts
|
|
60
|
+
* users.filterByIndex("age", (r) => r.greaterThan(18))
|
|
61
|
+
* users.filterByIndex("role", (r) => r.equals("admin"))
|
|
62
|
+
* users.filterByIndex("name", (r) => r.startsWith("Al"))
|
|
63
|
+
* users.filterByIndex("price",(r) => r.between(10, 100))
|
|
64
|
+
* ```
|
|
65
|
+
*/
|
|
66
|
+
export type RangeBuilder = {
|
|
67
|
+
/** Matches only the exact `value`. Wraps `IDBKeyRange.only`. */
|
|
68
|
+
equals(value: IDBValidKey): IDBKeyRange;
|
|
69
|
+
/** Matches keys strictly greater than `value`. Wraps `IDBKeyRange.lowerBound(value, true)`. */
|
|
70
|
+
greaterThan(value: IDBValidKey): IDBKeyRange;
|
|
71
|
+
/** Matches keys greater than or equal to `value`. Wraps `IDBKeyRange.lowerBound(value, false)`. */
|
|
72
|
+
greaterThanOrEqual(value: IDBValidKey): IDBKeyRange;
|
|
73
|
+
/** Matches keys strictly less than `value`. Wraps `IDBKeyRange.upperBound(value, true)`. */
|
|
74
|
+
lessThan(value: IDBValidKey): IDBKeyRange;
|
|
75
|
+
/** Matches keys less than or equal to `value`. Wraps `IDBKeyRange.upperBound(value, false)`. */
|
|
76
|
+
lessThanOrEqual(value: IDBValidKey): IDBKeyRange;
|
|
77
|
+
/**
|
|
78
|
+
* Matches keys between `lower` and `upper`.
|
|
79
|
+
* Bounds are **inclusive** by default.
|
|
80
|
+
* Wraps `IDBKeyRange.bound`.
|
|
81
|
+
*
|
|
82
|
+
* @param options.lowerOpen Exclude the lower bound (default `false`).
|
|
83
|
+
* @param options.upperOpen Exclude the upper bound (default `false`).
|
|
84
|
+
*/
|
|
85
|
+
between(lower: IDBValidKey, upper: IDBValidKey, options?: {
|
|
86
|
+
lowerOpen?: boolean;
|
|
87
|
+
upperOpen?: boolean;
|
|
88
|
+
}): IDBKeyRange;
|
|
89
|
+
/**
|
|
90
|
+
* Matches all string keys that begin with `prefix`.
|
|
91
|
+
* Uses the range `[prefix, prefix + "\uffff"]`.
|
|
92
|
+
*/
|
|
93
|
+
startsWith(prefix: string): IDBKeyRange;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Lazy, immutable native-IDB query chain returned by `filterByIndex()` and
|
|
97
|
+
* `sortByIndex()`.
|
|
98
|
+
*
|
|
99
|
+
* Nothing runs against IndexedDB until a terminal operation (`toArray` /
|
|
100
|
+
* `page`) is called. Chaining methods always return a **new** builder so the
|
|
101
|
+
* original is never mutated.
|
|
102
|
+
*
|
|
103
|
+
* @template T Row type.
|
|
104
|
+
*/
|
|
105
|
+
export type IndexQueryBuilderType<T> = {
|
|
106
|
+
/**
|
|
107
|
+
* Narrow results to a key range on a secondary index.
|
|
108
|
+
* Uses a native `IDBKeyRange` — no JS-side scanning.
|
|
109
|
+
*
|
|
110
|
+
* Replaces any previously set index filter on this chain.
|
|
111
|
+
*
|
|
112
|
+
* @param indexName Secondary index name (must exist in the schema).
|
|
113
|
+
* @param fn Receives a {@link RangeBuilder} and returns an
|
|
114
|
+
* `IDBKeyRange`.
|
|
115
|
+
*/
|
|
116
|
+
filterByIndex(indexName: string, fn: (r: RangeBuilder) => IDBKeyRange): IndexQueryBuilderType<T>;
|
|
117
|
+
/**
|
|
118
|
+
* Return rows in the natural order of a secondary index.
|
|
119
|
+
* Uses a native IDB cursor — no JS-side sort.
|
|
120
|
+
*
|
|
121
|
+
* When combined with `filterByIndex` on the **same** index, a single cursor
|
|
122
|
+
* pass performs both operations. When the indexes differ, the filter runs
|
|
123
|
+
* natively and the sort falls back to JS on the filtered subset only.
|
|
124
|
+
*
|
|
125
|
+
* @param indexName Secondary index name.
|
|
126
|
+
* @param direction `"asc"` (default) or `"desc"`.
|
|
127
|
+
*/
|
|
128
|
+
sortByIndex(indexName: string, direction?: "asc" | "desc"): IndexQueryBuilderType<T>;
|
|
129
|
+
/**
|
|
130
|
+
* Execute the query and return a reactive `DBTableAtom<T>` of all matching
|
|
131
|
+
* rows.
|
|
132
|
+
*/
|
|
133
|
+
toArray(): Promise<DBTableAtom<T>>;
|
|
134
|
+
/**
|
|
135
|
+
* Execute the query and return a reactive `DBTableAtom<T>` of one page.
|
|
136
|
+
*
|
|
137
|
+
* When `sortByIndex` is active, skipping is done via `cursor.advance()` —
|
|
138
|
+
* IDB never loads the skipped rows into memory.
|
|
139
|
+
*
|
|
140
|
+
* @param pageNum 1-based page number.
|
|
141
|
+
* @param perPage Rows per page.
|
|
142
|
+
*/
|
|
143
|
+
page(pageNum: number, perPage: number): Promise<DBTableAtom<T>>;
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Reactive array atom returned by `.toArray()` / `.page()`.
|
|
147
|
+
*
|
|
148
|
+
* Behaves like a plain atom — callable (`result()`), participates in the
|
|
149
|
+
* reactive graph, has `__subscribe`, `__version__`, etc. — but replaces the
|
|
150
|
+
* generic `set` / `update` with item-level mutations that also write back to
|
|
151
|
+
* IndexedDB.
|
|
152
|
+
*
|
|
153
|
+
* @template T Row type.
|
|
154
|
+
*/
|
|
155
|
+
export type DBTableAtom<T> = Omit<AtomType<T[]>, "set" | "update"> & {
|
|
156
|
+
/**
|
|
157
|
+
* Mutate one row in-place via a draft function, then persist to IDB.
|
|
158
|
+
* No-op when the key is not found in the current snapshot.
|
|
159
|
+
*/
|
|
160
|
+
updateItem(key: IDBKey, fn: (item: T) => void): Promise<void>;
|
|
161
|
+
/**
|
|
162
|
+
* Replace one row entirely, then persist to IDB.
|
|
163
|
+
* No-op when the key is not found in the current snapshot.
|
|
164
|
+
*/
|
|
165
|
+
setItem(key: IDBKey, item: T): Promise<void>;
|
|
166
|
+
/**
|
|
167
|
+
* Remove one row from the local snapshot and delete it from IDB.
|
|
168
|
+
* No-op when the key is not found in the current snapshot.
|
|
169
|
+
*/
|
|
170
|
+
removeItem(key: IDBKey): Promise<void>;
|
|
171
|
+
/**
|
|
172
|
+
* Re-execute the original query (filters, sort, pagination included) and
|
|
173
|
+
* replace the atom's value with the fresh results.
|
|
174
|
+
*/
|
|
175
|
+
refresh(): Promise<void>;
|
|
176
|
+
/** Discriminator tag — always `"dbTableAtom"`. */
|
|
177
|
+
readonly name: "dbTableAtom";
|
|
178
|
+
};
|
|
179
|
+
/**
|
|
180
|
+
* Typed handle to an IndexedDB object store.
|
|
181
|
+
*
|
|
182
|
+
* Extends `IndexQueryBuilderType` — `filterByIndex`, `sortByIndex`,
|
|
183
|
+
* `toArray`, and `page` are all available directly on the table.
|
|
184
|
+
*
|
|
185
|
+
* @template T Row type.
|
|
186
|
+
*/
|
|
187
|
+
export type DBTableType<T> = IndexQueryBuilderType<T> & {
|
|
188
|
+
/**
|
|
189
|
+
* Insert a new row.
|
|
190
|
+
* Rejects when an item with the same primary key already exists.
|
|
191
|
+
*
|
|
192
|
+
* @returns The primary key of the newly inserted item.
|
|
193
|
+
*/
|
|
194
|
+
add(item: T): Promise<IDBValidKey>;
|
|
195
|
+
/**
|
|
196
|
+
* Upsert a row — insert if absent, replace if present.
|
|
197
|
+
* The key is read from the item's `keyPath` field, so it must be correct.
|
|
198
|
+
*
|
|
199
|
+
* @param key For call-site clarity; the actual IDB key comes from the
|
|
200
|
+
* item's keyPath field.
|
|
201
|
+
* @param item Full replacement item.
|
|
202
|
+
*/
|
|
203
|
+
set(key: IDBKey, item: T): Promise<void>;
|
|
204
|
+
/**
|
|
205
|
+
* Read a row by key, apply a draft mutation, then write it back atomically.
|
|
206
|
+
* No-op when the key does not exist in the store.
|
|
207
|
+
*/
|
|
208
|
+
update(key: IDBKey, fn: (item: T) => void): Promise<void>;
|
|
209
|
+
/** Delete a row by primary key. */
|
|
210
|
+
delete(key: IDBKey): Promise<void>;
|
|
211
|
+
/** Remove **all** rows from the store. */
|
|
212
|
+
clear(): Promise<void>;
|
|
213
|
+
/** Return the total number of rows in the store. */
|
|
214
|
+
count(): Promise<number>;
|
|
215
|
+
/** Fetch a single row by primary key, or `undefined` when absent. */
|
|
216
|
+
get(key: IDBKey): Promise<T | undefined>;
|
|
217
|
+
/** Return `true` when a row with the given primary key exists. */
|
|
218
|
+
has(key: IDBKey): Promise<boolean>;
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* Passed to the `db.transaction()` callback.
|
|
222
|
+
* All tables obtained from this scope share the same underlying
|
|
223
|
+
* `IDBTransaction`, ensuring atomicity across stores.
|
|
224
|
+
*/
|
|
225
|
+
export type TransactionScopeType = {
|
|
226
|
+
table<T>(storeName: string, primaryKey: string): DBTableType<T>;
|
|
227
|
+
};
|
|
228
|
+
/** Opened database handle returned by `indexDB()`. */
|
|
229
|
+
export type DBInstanceType = {
|
|
230
|
+
/**
|
|
231
|
+
* Return a typed handle to an object store.
|
|
232
|
+
* The store must already exist — define it in the `upgrade` callback.
|
|
233
|
+
*/
|
|
234
|
+
table<T>(storeName: string, primaryKey: string): DBTableType<T>;
|
|
235
|
+
/**
|
|
236
|
+
* Run multiple operations inside a single atomic `readwrite` transaction.
|
|
237
|
+
*
|
|
238
|
+
* If the callback throws or rejects, the transaction is automatically
|
|
239
|
+
* aborted and the error propagates to the caller.
|
|
240
|
+
*
|
|
241
|
+
* **IDB constraint:** avoid `await`-ing non-IDB promises (e.g. `fetch`)
|
|
242
|
+
* inside the callback — the transaction may auto-commit if no IDB request
|
|
243
|
+
* is pending when the microtask queue drains.
|
|
244
|
+
*/
|
|
245
|
+
transaction(storeNames: string[], fn: (tx: TransactionScopeType) => Promise<void>): Promise<void>;
|
|
246
|
+
/** Close the database connection. */
|
|
247
|
+
close(): void;
|
|
248
|
+
};
|
|
249
|
+
//# sourceMappingURL=types.d.ts.map
|