11423 lines
464 KiB
JavaScript
11423 lines
464 KiB
JavaScript
(globalThis.TURBOPACK || (globalThis.TURBOPACK = [])).push([typeof document === "object" ? document.currentScript : undefined,
|
|
"[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/next@16.0.3_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/next/navigation.js [app-client] (ecmascript)", ((__turbopack_context__, module, exports) => {
|
|
|
|
module.exports = __turbopack_context__.r("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/next@16.0.3_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/next/dist/client/components/navigation.js [app-client] (ecmascript)");
|
|
}),
|
|
"[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/@vercel+analytics@1.5.0_next@16.0.3_react-dom@19.2.0_react@19.2.0__react@19.2.0__react@19.2.0/node_modules/@vercel/analytics/dist/next/index.mjs [app-client] (ecmascript)", ((__turbopack_context__) => {
|
|
"use strict";
|
|
|
|
__turbopack_context__.s([
|
|
"Analytics",
|
|
()=>Analytics2
|
|
]);
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$build$2f$polyfills$2f$process$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = /*#__PURE__*/ __turbopack_context__.i("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/next@16.0.3_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/next/dist/build/polyfills/process.js [app-client] (ecmascript)");
|
|
// src/nextjs/index.tsx
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/next@16.0.3_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/next/dist/compiled/react/index.js [app-client] (ecmascript)");
|
|
// src/nextjs/utils.ts
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$navigation$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/next@16.0.3_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/next/navigation.js [app-client] (ecmascript)");
|
|
"use client";
|
|
;
|
|
;
|
|
// package.json
|
|
var name = "@vercel/analytics";
|
|
var version = "1.5.0";
|
|
// src/queue.ts
|
|
var initQueue = ()=>{
|
|
if (window.va) return;
|
|
window.va = function a(...params) {
|
|
(window.vaq = window.vaq || []).push(params);
|
|
};
|
|
};
|
|
// src/utils.ts
|
|
function isBrowser() {
|
|
return typeof window !== "undefined";
|
|
}
|
|
function detectEnvironment() {
|
|
try {
|
|
const env = ("TURBOPACK compile-time value", "development");
|
|
if ("TURBOPACK compile-time truthy", 1) {
|
|
return "development";
|
|
}
|
|
} catch (e) {}
|
|
return "production";
|
|
}
|
|
function setMode(mode = "auto") {
|
|
if (mode === "auto") {
|
|
window.vam = detectEnvironment();
|
|
return;
|
|
}
|
|
window.vam = mode;
|
|
}
|
|
function getMode() {
|
|
const mode = isBrowser() ? window.vam : detectEnvironment();
|
|
return mode || "production";
|
|
}
|
|
function isDevelopment() {
|
|
return getMode() === "development";
|
|
}
|
|
function computeRoute(pathname, pathParams) {
|
|
if (!pathname || !pathParams) {
|
|
return pathname;
|
|
}
|
|
let result = pathname;
|
|
try {
|
|
const entries = Object.entries(pathParams);
|
|
for (const [key, value] of entries){
|
|
if (!Array.isArray(value)) {
|
|
const matcher = turnValueToRegExp(value);
|
|
if (matcher.test(result)) {
|
|
result = result.replace(matcher, `/[${key}]`);
|
|
}
|
|
}
|
|
}
|
|
for (const [key, value] of entries){
|
|
if (Array.isArray(value)) {
|
|
const matcher = turnValueToRegExp(value.join("/"));
|
|
if (matcher.test(result)) {
|
|
result = result.replace(matcher, `/[...${key}]`);
|
|
}
|
|
}
|
|
}
|
|
return result;
|
|
} catch (e) {
|
|
return pathname;
|
|
}
|
|
}
|
|
function turnValueToRegExp(value) {
|
|
return new RegExp(`/${escapeRegExp(value)}(?=[/?#]|$)`);
|
|
}
|
|
function escapeRegExp(string) {
|
|
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
}
|
|
function getScriptSrc(props) {
|
|
if (props.scriptSrc) {
|
|
return props.scriptSrc;
|
|
}
|
|
if (isDevelopment()) {
|
|
return "https://va.vercel-scripts.com/v1/script.debug.js";
|
|
}
|
|
if (props.basePath) {
|
|
return `${props.basePath}/insights/script.js`;
|
|
}
|
|
return "/_vercel/insights/script.js";
|
|
}
|
|
// src/generic.ts
|
|
function inject(props = {
|
|
debug: true
|
|
}) {
|
|
var _a;
|
|
if (!isBrowser()) return;
|
|
setMode(props.mode);
|
|
initQueue();
|
|
if (props.beforeSend) {
|
|
(_a = window.va) == null ? void 0 : _a.call(window, "beforeSend", props.beforeSend);
|
|
}
|
|
const src = getScriptSrc(props);
|
|
if (document.head.querySelector(`script[src*="${src}"]`)) return;
|
|
const script = document.createElement("script");
|
|
script.src = src;
|
|
script.defer = true;
|
|
script.dataset.sdkn = name + (props.framework ? `/${props.framework}` : "");
|
|
script.dataset.sdkv = version;
|
|
if (props.disableAutoTrack) {
|
|
script.dataset.disableAutoTrack = "1";
|
|
}
|
|
if (props.endpoint) {
|
|
script.dataset.endpoint = props.endpoint;
|
|
} else if (props.basePath) {
|
|
script.dataset.endpoint = `${props.basePath}/insights`;
|
|
}
|
|
if (props.dsn) {
|
|
script.dataset.dsn = props.dsn;
|
|
}
|
|
script.onerror = ()=>{
|
|
const errorMessage = isDevelopment() ? "Please check if any ad blockers are enabled and try again." : "Be sure to enable Web Analytics for your project and deploy again. See https://vercel.com/docs/analytics/quickstart for more information.";
|
|
console.log(`[Vercel Web Analytics] Failed to load script from ${src}. ${errorMessage}`);
|
|
};
|
|
if (isDevelopment() && props.debug === false) {
|
|
script.dataset.debug = "false";
|
|
}
|
|
document.head.appendChild(script);
|
|
}
|
|
function pageview({ route, path }) {
|
|
var _a;
|
|
(_a = window.va) == null ? void 0 : _a.call(window, "pageview", {
|
|
route,
|
|
path
|
|
});
|
|
}
|
|
// src/react/utils.ts
|
|
function getBasePath() {
|
|
if (typeof __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$build$2f$polyfills$2f$process$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"] === "undefined" || typeof __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$build$2f$polyfills$2f$process$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].env === "undefined") {
|
|
return void 0;
|
|
}
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$build$2f$polyfills$2f$process$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].env.REACT_APP_VERCEL_OBSERVABILITY_BASEPATH;
|
|
}
|
|
// src/react/index.tsx
|
|
function Analytics(props) {
|
|
(0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useEffect"])({
|
|
"Analytics.useEffect": ()=>{
|
|
var _a;
|
|
if (props.beforeSend) {
|
|
(_a = window.va) == null ? void 0 : _a.call(window, "beforeSend", props.beforeSend);
|
|
}
|
|
}
|
|
}["Analytics.useEffect"], [
|
|
props.beforeSend
|
|
]);
|
|
(0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useEffect"])({
|
|
"Analytics.useEffect": ()=>{
|
|
inject({
|
|
framework: props.framework || "react",
|
|
basePath: props.basePath ?? getBasePath(),
|
|
...props.route !== void 0 && {
|
|
disableAutoTrack: true
|
|
},
|
|
...props
|
|
});
|
|
}
|
|
}["Analytics.useEffect"], []);
|
|
(0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useEffect"])({
|
|
"Analytics.useEffect": ()=>{
|
|
if (props.route && props.path) {
|
|
pageview({
|
|
route: props.route,
|
|
path: props.path
|
|
});
|
|
}
|
|
}
|
|
}["Analytics.useEffect"], [
|
|
props.route,
|
|
props.path
|
|
]);
|
|
return null;
|
|
}
|
|
;
|
|
var useRoute = ()=>{
|
|
const params = (0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$navigation$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useParams"])();
|
|
const searchParams = (0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$navigation$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useSearchParams"])();
|
|
const path = (0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$navigation$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["usePathname"])();
|
|
if (!params) {
|
|
return {
|
|
route: null,
|
|
path
|
|
};
|
|
}
|
|
const finalParams = Object.keys(params).length ? params : Object.fromEntries(searchParams.entries());
|
|
return {
|
|
route: computeRoute(path, finalParams),
|
|
path
|
|
};
|
|
};
|
|
function getBasePath2() {
|
|
if (typeof __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$build$2f$polyfills$2f$process$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"] === "undefined" || typeof __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$build$2f$polyfills$2f$process$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].env === "undefined") {
|
|
return void 0;
|
|
}
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$build$2f$polyfills$2f$process$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].env.NEXT_PUBLIC_VERCEL_OBSERVABILITY_BASEPATH;
|
|
}
|
|
// src/nextjs/index.tsx
|
|
function AnalyticsComponent(props) {
|
|
const { route, path } = useRoute();
|
|
return /* @__PURE__ */ __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement(Analytics, {
|
|
path,
|
|
route,
|
|
...props,
|
|
basePath: getBasePath2(),
|
|
framework: "next"
|
|
});
|
|
}
|
|
function Analytics2(props) {
|
|
return /* @__PURE__ */ __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement(__TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["Suspense"], {
|
|
fallback: null
|
|
}, /* @__PURE__ */ __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].createElement(AnalyticsComponent, {
|
|
...props
|
|
}));
|
|
}
|
|
;
|
|
//# sourceMappingURL=index.mjs.map
|
|
}),
|
|
"[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/next@16.0.3_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/next/dist/compiled/react/cjs/react-jsx-dev-runtime.development.js [app-client] (ecmascript)", ((__turbopack_context__, module, exports) => {
|
|
"use strict";
|
|
|
|
/**
|
|
* @license React
|
|
* react-jsx-dev-runtime.development.js
|
|
*
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/ var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$build$2f$polyfills$2f$process$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = /*#__PURE__*/ __turbopack_context__.i("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/next@16.0.3_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/next/dist/build/polyfills/process.js [app-client] (ecmascript)");
|
|
"use strict";
|
|
"production" !== ("TURBOPACK compile-time value", "development") && function() {
|
|
function getComponentNameFromType(type) {
|
|
if (null == type) return null;
|
|
if ("function" === typeof type) return type.$$typeof === REACT_CLIENT_REFERENCE ? null : type.displayName || type.name || null;
|
|
if ("string" === typeof type) return type;
|
|
switch(type){
|
|
case REACT_FRAGMENT_TYPE:
|
|
return "Fragment";
|
|
case REACT_PROFILER_TYPE:
|
|
return "Profiler";
|
|
case REACT_STRICT_MODE_TYPE:
|
|
return "StrictMode";
|
|
case REACT_SUSPENSE_TYPE:
|
|
return "Suspense";
|
|
case REACT_SUSPENSE_LIST_TYPE:
|
|
return "SuspenseList";
|
|
case REACT_ACTIVITY_TYPE:
|
|
return "Activity";
|
|
case REACT_VIEW_TRANSITION_TYPE:
|
|
return "ViewTransition";
|
|
}
|
|
if ("object" === typeof type) switch("number" === typeof type.tag && console.error("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), type.$$typeof){
|
|
case REACT_PORTAL_TYPE:
|
|
return "Portal";
|
|
case REACT_CONTEXT_TYPE:
|
|
return type.displayName || "Context";
|
|
case REACT_CONSUMER_TYPE:
|
|
return (type._context.displayName || "Context") + ".Consumer";
|
|
case REACT_FORWARD_REF_TYPE:
|
|
var innerType = type.render;
|
|
type = type.displayName;
|
|
type || (type = innerType.displayName || innerType.name || "", type = "" !== type ? "ForwardRef(" + type + ")" : "ForwardRef");
|
|
return type;
|
|
case REACT_MEMO_TYPE:
|
|
return innerType = type.displayName || null, null !== innerType ? innerType : getComponentNameFromType(type.type) || "Memo";
|
|
case REACT_LAZY_TYPE:
|
|
innerType = type._payload;
|
|
type = type._init;
|
|
try {
|
|
return getComponentNameFromType(type(innerType));
|
|
} catch (x) {}
|
|
}
|
|
return null;
|
|
}
|
|
function testStringCoercion(value) {
|
|
return "" + value;
|
|
}
|
|
function checkKeyStringCoercion(value) {
|
|
try {
|
|
testStringCoercion(value);
|
|
var JSCompiler_inline_result = !1;
|
|
} catch (e) {
|
|
JSCompiler_inline_result = !0;
|
|
}
|
|
if (JSCompiler_inline_result) {
|
|
JSCompiler_inline_result = console;
|
|
var JSCompiler_temp_const = JSCompiler_inline_result.error;
|
|
var JSCompiler_inline_result$jscomp$0 = "function" === typeof Symbol && Symbol.toStringTag && value[Symbol.toStringTag] || value.constructor.name || "Object";
|
|
JSCompiler_temp_const.call(JSCompiler_inline_result, "The provided key is an unsupported type %s. This value must be coerced to a string before using it here.", JSCompiler_inline_result$jscomp$0);
|
|
return testStringCoercion(value);
|
|
}
|
|
}
|
|
function getTaskName(type) {
|
|
if (type === REACT_FRAGMENT_TYPE) return "<>";
|
|
if ("object" === typeof type && null !== type && type.$$typeof === REACT_LAZY_TYPE) return "<...>";
|
|
try {
|
|
var name = getComponentNameFromType(type);
|
|
return name ? "<" + name + ">" : "<...>";
|
|
} catch (x) {
|
|
return "<...>";
|
|
}
|
|
}
|
|
function getOwner() {
|
|
var dispatcher = ReactSharedInternals.A;
|
|
return null === dispatcher ? null : dispatcher.getOwner();
|
|
}
|
|
function UnknownOwner() {
|
|
return Error("react-stack-top-frame");
|
|
}
|
|
function hasValidKey(config) {
|
|
if (hasOwnProperty.call(config, "key")) {
|
|
var getter = Object.getOwnPropertyDescriptor(config, "key").get;
|
|
if (getter && getter.isReactWarning) return !1;
|
|
}
|
|
return void 0 !== config.key;
|
|
}
|
|
function defineKeyPropWarningGetter(props, displayName) {
|
|
function warnAboutAccessingKey() {
|
|
specialPropKeyWarningShown || (specialPropKeyWarningShown = !0, console.error("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)", displayName));
|
|
}
|
|
warnAboutAccessingKey.isReactWarning = !0;
|
|
Object.defineProperty(props, "key", {
|
|
get: warnAboutAccessingKey,
|
|
configurable: !0
|
|
});
|
|
}
|
|
function elementRefGetterWithDeprecationWarning() {
|
|
var componentName = getComponentNameFromType(this.type);
|
|
didWarnAboutElementRef[componentName] || (didWarnAboutElementRef[componentName] = !0, console.error("Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."));
|
|
componentName = this.props.ref;
|
|
return void 0 !== componentName ? componentName : null;
|
|
}
|
|
function ReactElement(type, key, props, owner, debugStack, debugTask) {
|
|
var refProp = props.ref;
|
|
type = {
|
|
$$typeof: REACT_ELEMENT_TYPE,
|
|
type: type,
|
|
key: key,
|
|
props: props,
|
|
_owner: owner
|
|
};
|
|
null !== (void 0 !== refProp ? refProp : null) ? Object.defineProperty(type, "ref", {
|
|
enumerable: !1,
|
|
get: elementRefGetterWithDeprecationWarning
|
|
}) : Object.defineProperty(type, "ref", {
|
|
enumerable: !1,
|
|
value: null
|
|
});
|
|
type._store = {};
|
|
Object.defineProperty(type._store, "validated", {
|
|
configurable: !1,
|
|
enumerable: !1,
|
|
writable: !0,
|
|
value: 0
|
|
});
|
|
Object.defineProperty(type, "_debugInfo", {
|
|
configurable: !1,
|
|
enumerable: !1,
|
|
writable: !0,
|
|
value: null
|
|
});
|
|
Object.defineProperty(type, "_debugStack", {
|
|
configurable: !1,
|
|
enumerable: !1,
|
|
writable: !0,
|
|
value: debugStack
|
|
});
|
|
Object.defineProperty(type, "_debugTask", {
|
|
configurable: !1,
|
|
enumerable: !1,
|
|
writable: !0,
|
|
value: debugTask
|
|
});
|
|
Object.freeze && (Object.freeze(type.props), Object.freeze(type));
|
|
return type;
|
|
}
|
|
function jsxDEVImpl(type, config, maybeKey, isStaticChildren, debugStack, debugTask) {
|
|
var children = config.children;
|
|
if (void 0 !== children) if (isStaticChildren) if (isArrayImpl(children)) {
|
|
for(isStaticChildren = 0; isStaticChildren < children.length; isStaticChildren++)validateChildKeys(children[isStaticChildren]);
|
|
Object.freeze && Object.freeze(children);
|
|
} else console.error("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
else validateChildKeys(children);
|
|
if (hasOwnProperty.call(config, "key")) {
|
|
children = getComponentNameFromType(type);
|
|
var keys = Object.keys(config).filter(function(k) {
|
|
return "key" !== k;
|
|
});
|
|
isStaticChildren = 0 < keys.length ? "{key: someKey, " + keys.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
didWarnAboutKeySpread[children + isStaticChildren] || (keys = 0 < keys.length ? "{" + keys.join(": ..., ") + ": ...}" : "{}", console.error('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />', isStaticChildren, children, keys, children), didWarnAboutKeySpread[children + isStaticChildren] = !0);
|
|
}
|
|
children = null;
|
|
void 0 !== maybeKey && (checkKeyStringCoercion(maybeKey), children = "" + maybeKey);
|
|
hasValidKey(config) && (checkKeyStringCoercion(config.key), children = "" + config.key);
|
|
if ("key" in config) {
|
|
maybeKey = {};
|
|
for(var propName in config)"key" !== propName && (maybeKey[propName] = config[propName]);
|
|
} else maybeKey = config;
|
|
children && defineKeyPropWarningGetter(maybeKey, "function" === typeof type ? type.displayName || type.name || "Unknown" : type);
|
|
return ReactElement(type, children, maybeKey, getOwner(), debugStack, debugTask);
|
|
}
|
|
function validateChildKeys(node) {
|
|
isValidElement(node) ? node._store && (node._store.validated = 1) : "object" === typeof node && null !== node && node.$$typeof === REACT_LAZY_TYPE && ("fulfilled" === node._payload.status ? isValidElement(node._payload.value) && node._payload.value._store && (node._payload.value._store.validated = 1) : node._store && (node._store.validated = 1));
|
|
}
|
|
function isValidElement(object) {
|
|
return "object" === typeof object && null !== object && object.$$typeof === REACT_ELEMENT_TYPE;
|
|
}
|
|
var React = __turbopack_context__.r("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/next@16.0.3_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/next/dist/compiled/react/index.js [app-client] (ecmascript)"), REACT_ELEMENT_TYPE = Symbol.for("react.transitional.element"), REACT_PORTAL_TYPE = Symbol.for("react.portal"), REACT_FRAGMENT_TYPE = Symbol.for("react.fragment"), REACT_STRICT_MODE_TYPE = Symbol.for("react.strict_mode"), REACT_PROFILER_TYPE = Symbol.for("react.profiler"), REACT_CONSUMER_TYPE = Symbol.for("react.consumer"), REACT_CONTEXT_TYPE = Symbol.for("react.context"), REACT_FORWARD_REF_TYPE = Symbol.for("react.forward_ref"), REACT_SUSPENSE_TYPE = Symbol.for("react.suspense"), REACT_SUSPENSE_LIST_TYPE = Symbol.for("react.suspense_list"), REACT_MEMO_TYPE = Symbol.for("react.memo"), REACT_LAZY_TYPE = Symbol.for("react.lazy"), REACT_ACTIVITY_TYPE = Symbol.for("react.activity"), REACT_VIEW_TRANSITION_TYPE = Symbol.for("react.view_transition"), REACT_CLIENT_REFERENCE = Symbol.for("react.client.reference"), ReactSharedInternals = React.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, hasOwnProperty = Object.prototype.hasOwnProperty, isArrayImpl = Array.isArray, createTask = console.createTask ? console.createTask : function() {
|
|
return null;
|
|
};
|
|
React = {
|
|
react_stack_bottom_frame: function(callStackForError) {
|
|
return callStackForError();
|
|
}
|
|
};
|
|
var specialPropKeyWarningShown;
|
|
var didWarnAboutElementRef = {};
|
|
var unknownOwnerDebugStack = React.react_stack_bottom_frame.bind(React, UnknownOwner)();
|
|
var unknownOwnerDebugTask = createTask(getTaskName(UnknownOwner));
|
|
var didWarnAboutKeySpread = {};
|
|
exports.Fragment = REACT_FRAGMENT_TYPE;
|
|
exports.jsxDEV = function(type, config, maybeKey, isStaticChildren) {
|
|
var trackActualOwner = 1e4 > ReactSharedInternals.recentlyCreatedOwnerStacks++;
|
|
if (trackActualOwner) {
|
|
var previousStackTraceLimit = Error.stackTraceLimit;
|
|
Error.stackTraceLimit = 10;
|
|
var debugStackDEV = Error("react-stack-top-frame");
|
|
Error.stackTraceLimit = previousStackTraceLimit;
|
|
} else debugStackDEV = unknownOwnerDebugStack;
|
|
return jsxDEVImpl(type, config, maybeKey, isStaticChildren, debugStackDEV, trackActualOwner ? createTask(getTaskName(type)) : unknownOwnerDebugTask);
|
|
};
|
|
}();
|
|
}),
|
|
"[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/next@16.0.3_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/next/dist/compiled/react/jsx-dev-runtime.js [app-client] (ecmascript)", ((__turbopack_context__, module, exports) => {
|
|
"use strict";
|
|
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$build$2f$polyfills$2f$process$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = /*#__PURE__*/ __turbopack_context__.i("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/next@16.0.3_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/next/dist/build/polyfills/process.js [app-client] (ecmascript)");
|
|
'use strict';
|
|
if ("TURBOPACK compile-time falsy", 0) //TURBOPACK unreachable
|
|
;
|
|
else {
|
|
module.exports = __turbopack_context__.r("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/next@16.0.3_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/next/dist/compiled/react/cjs/react-jsx-dev-runtime.development.js [app-client] (ecmascript)");
|
|
}
|
|
}),
|
|
"[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/dexie@4.2.1/node_modules/dexie/dist/dexie.js [app-client] (ecmascript)", ((__turbopack_context__, module, exports) => {
|
|
|
|
/*
|
|
* Dexie.js - a minimalistic wrapper for IndexedDB
|
|
* ===============================================
|
|
*
|
|
* By David Fahlander, david.fahlander@gmail.com
|
|
*
|
|
* Version 4.2.1, Sat Oct 04 2025
|
|
*
|
|
* https://dexie.org
|
|
*
|
|
* Apache License Version 2.0, January 2004, http://www.apache.org/licenses/
|
|
*/ (function(global, factory) {
|
|
("TURBOPACK compile-time truthy", 1) ? module.exports = factory() : "TURBOPACK unreachable";
|
|
})(/*TURBOPACK member replacement*/ __turbopack_context__.e, function() {
|
|
'use strict';
|
|
/*! *****************************************************************************
|
|
Copyright (c) Microsoft Corporation.
|
|
Permission to use, copy, modify, and/or distribute this software for any
|
|
purpose with or without fee is hereby granted.
|
|
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
PERFORMANCE OF THIS SOFTWARE.
|
|
***************************************************************************** */ var extendStatics = function(d, b) {
|
|
extendStatics = Object.setPrototypeOf || ({
|
|
__proto__: []
|
|
}) instanceof Array && function(d, b) {
|
|
d.__proto__ = b;
|
|
} || function(d, b) {
|
|
for(var p in b)if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p];
|
|
};
|
|
return extendStatics(d, b);
|
|
};
|
|
function __extends(d, b) {
|
|
if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
extendStatics(d, b);
|
|
function __() {
|
|
this.constructor = d;
|
|
}
|
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
}
|
|
var __assign = function() {
|
|
__assign = Object.assign || function __assign(t) {
|
|
for(var s, i = 1, n = arguments.length; i < n; i++){
|
|
s = arguments[i];
|
|
for(var p in s)if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
}
|
|
return t;
|
|
};
|
|
return __assign.apply(this, arguments);
|
|
};
|
|
function __spreadArray(to, from, pack) {
|
|
if (pack || arguments.length === 2) for(var i = 0, l = from.length, ar; i < l; i++){
|
|
if (ar || !(i in from)) {
|
|
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
ar[i] = from[i];
|
|
}
|
|
}
|
|
return to.concat(ar || Array.prototype.slice.call(from));
|
|
}
|
|
var _global = typeof globalThis !== 'undefined' ? globalThis : typeof self !== 'undefined' ? self : typeof window !== 'undefined' ? window : /*TURBOPACK member replacement*/ __turbopack_context__.g;
|
|
var keys = Object.keys;
|
|
var isArray = Array.isArray;
|
|
if (typeof Promise !== 'undefined' && !_global.Promise) {
|
|
_global.Promise = Promise;
|
|
}
|
|
function extend(obj, extension) {
|
|
if (typeof extension !== 'object') return obj;
|
|
keys(extension).forEach(function(key) {
|
|
obj[key] = extension[key];
|
|
});
|
|
return obj;
|
|
}
|
|
var getProto = Object.getPrototypeOf;
|
|
var _hasOwn = {}.hasOwnProperty;
|
|
function hasOwn(obj, prop) {
|
|
return _hasOwn.call(obj, prop);
|
|
}
|
|
function props(proto, extension) {
|
|
if (typeof extension === 'function') extension = extension(getProto(proto));
|
|
(typeof Reflect === "undefined" ? keys : Reflect.ownKeys)(extension).forEach(function(key) {
|
|
setProp(proto, key, extension[key]);
|
|
});
|
|
}
|
|
var defineProperty = Object.defineProperty;
|
|
function setProp(obj, prop, functionOrGetSet, options) {
|
|
defineProperty(obj, prop, extend(functionOrGetSet && hasOwn(functionOrGetSet, "get") && typeof functionOrGetSet.get === 'function' ? {
|
|
get: functionOrGetSet.get,
|
|
set: functionOrGetSet.set,
|
|
configurable: true
|
|
} : {
|
|
value: functionOrGetSet,
|
|
configurable: true,
|
|
writable: true
|
|
}, options));
|
|
}
|
|
function derive(Child) {
|
|
return {
|
|
from: function(Parent) {
|
|
Child.prototype = Object.create(Parent.prototype);
|
|
setProp(Child.prototype, "constructor", Child);
|
|
return {
|
|
extend: props.bind(null, Child.prototype)
|
|
};
|
|
}
|
|
};
|
|
}
|
|
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
|
|
function getPropertyDescriptor(obj, prop) {
|
|
var pd = getOwnPropertyDescriptor(obj, prop);
|
|
var proto;
|
|
return pd || (proto = getProto(obj)) && getPropertyDescriptor(proto, prop);
|
|
}
|
|
var _slice = [].slice;
|
|
function slice(args, start, end) {
|
|
return _slice.call(args, start, end);
|
|
}
|
|
function override(origFunc, overridedFactory) {
|
|
return overridedFactory(origFunc);
|
|
}
|
|
function assert(b) {
|
|
if (!b) throw new Error("Assertion Failed");
|
|
}
|
|
function asap$1(fn) {
|
|
if (_global.setImmediate) setImmediate(fn);
|
|
else setTimeout(fn, 0);
|
|
}
|
|
function arrayToObject(array, extractor) {
|
|
return array.reduce(function(result, item, i) {
|
|
var nameAndValue = extractor(item, i);
|
|
if (nameAndValue) result[nameAndValue[0]] = nameAndValue[1];
|
|
return result;
|
|
}, {});
|
|
}
|
|
function getByKeyPath(obj, keyPath) {
|
|
if (typeof keyPath === 'string' && hasOwn(obj, keyPath)) return obj[keyPath];
|
|
if (!keyPath) return obj;
|
|
if (typeof keyPath !== 'string') {
|
|
var rv = [];
|
|
for(var i = 0, l = keyPath.length; i < l; ++i){
|
|
var val = getByKeyPath(obj, keyPath[i]);
|
|
rv.push(val);
|
|
}
|
|
return rv;
|
|
}
|
|
var period = keyPath.indexOf('.');
|
|
if (period !== -1) {
|
|
var innerObj = obj[keyPath.substr(0, period)];
|
|
return innerObj == null ? undefined : getByKeyPath(innerObj, keyPath.substr(period + 1));
|
|
}
|
|
return undefined;
|
|
}
|
|
function setByKeyPath(obj, keyPath, value) {
|
|
if (!obj || keyPath === undefined) return;
|
|
if ('isFrozen' in Object && Object.isFrozen(obj)) return;
|
|
if (typeof keyPath !== 'string' && 'length' in keyPath) {
|
|
assert(typeof value !== 'string' && 'length' in value);
|
|
for(var i = 0, l = keyPath.length; i < l; ++i){
|
|
setByKeyPath(obj, keyPath[i], value[i]);
|
|
}
|
|
} else {
|
|
var period = keyPath.indexOf('.');
|
|
if (period !== -1) {
|
|
var currentKeyPath = keyPath.substr(0, period);
|
|
var remainingKeyPath = keyPath.substr(period + 1);
|
|
if (remainingKeyPath === "") if (value === undefined) {
|
|
if (isArray(obj) && !isNaN(parseInt(currentKeyPath))) obj.splice(currentKeyPath, 1);
|
|
else delete obj[currentKeyPath];
|
|
} else obj[currentKeyPath] = value;
|
|
else {
|
|
var innerObj = obj[currentKeyPath];
|
|
if (!innerObj || !hasOwn(obj, currentKeyPath)) innerObj = obj[currentKeyPath] = {};
|
|
setByKeyPath(innerObj, remainingKeyPath, value);
|
|
}
|
|
} else {
|
|
if (value === undefined) {
|
|
if (isArray(obj) && !isNaN(parseInt(keyPath))) obj.splice(keyPath, 1);
|
|
else delete obj[keyPath];
|
|
} else obj[keyPath] = value;
|
|
}
|
|
}
|
|
}
|
|
function delByKeyPath(obj, keyPath) {
|
|
if (typeof keyPath === 'string') setByKeyPath(obj, keyPath, undefined);
|
|
else if ('length' in keyPath) [].map.call(keyPath, function(kp) {
|
|
setByKeyPath(obj, kp, undefined);
|
|
});
|
|
}
|
|
function shallowClone(obj) {
|
|
var rv = {};
|
|
for(var m in obj){
|
|
if (hasOwn(obj, m)) rv[m] = obj[m];
|
|
}
|
|
return rv;
|
|
}
|
|
var concat = [].concat;
|
|
function flatten(a) {
|
|
return concat.apply([], a);
|
|
}
|
|
var intrinsicTypeNames = "BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(',').concat(flatten([
|
|
8,
|
|
16,
|
|
32,
|
|
64
|
|
].map(function(num) {
|
|
return [
|
|
"Int",
|
|
"Uint",
|
|
"Float"
|
|
].map(function(t) {
|
|
return t + num + "Array";
|
|
});
|
|
}))).filter(function(t) {
|
|
return _global[t];
|
|
});
|
|
var intrinsicTypes = new Set(intrinsicTypeNames.map(function(t) {
|
|
return _global[t];
|
|
}));
|
|
function cloneSimpleObjectTree(o) {
|
|
var rv = {};
|
|
for(var k in o)if (hasOwn(o, k)) {
|
|
var v = o[k];
|
|
rv[k] = !v || typeof v !== 'object' || intrinsicTypes.has(v.constructor) ? v : cloneSimpleObjectTree(v);
|
|
}
|
|
return rv;
|
|
}
|
|
function objectIsEmpty(o) {
|
|
for(var k in o)if (hasOwn(o, k)) return false;
|
|
return true;
|
|
}
|
|
var circularRefs = null;
|
|
function deepClone(any) {
|
|
circularRefs = new WeakMap();
|
|
var rv = innerDeepClone(any);
|
|
circularRefs = null;
|
|
return rv;
|
|
}
|
|
function innerDeepClone(x) {
|
|
if (!x || typeof x !== 'object') return x;
|
|
var rv = circularRefs.get(x);
|
|
if (rv) return rv;
|
|
if (isArray(x)) {
|
|
rv = [];
|
|
circularRefs.set(x, rv);
|
|
for(var i = 0, l = x.length; i < l; ++i){
|
|
rv.push(innerDeepClone(x[i]));
|
|
}
|
|
} else if (intrinsicTypes.has(x.constructor)) {
|
|
rv = x;
|
|
} else {
|
|
var proto = getProto(x);
|
|
rv = proto === Object.prototype ? {} : Object.create(proto);
|
|
circularRefs.set(x, rv);
|
|
for(var prop in x){
|
|
if (hasOwn(x, prop)) {
|
|
rv[prop] = innerDeepClone(x[prop]);
|
|
}
|
|
}
|
|
}
|
|
return rv;
|
|
}
|
|
var toString = {}.toString;
|
|
function toStringTag(o) {
|
|
return toString.call(o).slice(8, -1);
|
|
}
|
|
var iteratorSymbol = typeof Symbol !== 'undefined' ? Symbol.iterator : '@@iterator';
|
|
var getIteratorOf = typeof iteratorSymbol === "symbol" ? function(x) {
|
|
var i;
|
|
return x != null && (i = x[iteratorSymbol]) && i.apply(x);
|
|
} : function() {
|
|
return null;
|
|
};
|
|
function delArrayItem(a, x) {
|
|
var i = a.indexOf(x);
|
|
if (i >= 0) a.splice(i, 1);
|
|
return i >= 0;
|
|
}
|
|
var NO_CHAR_ARRAY = {};
|
|
function getArrayOf(arrayLike) {
|
|
var i, a, x, it;
|
|
if (arguments.length === 1) {
|
|
if (isArray(arrayLike)) return arrayLike.slice();
|
|
if (this === NO_CHAR_ARRAY && typeof arrayLike === 'string') return [
|
|
arrayLike
|
|
];
|
|
if (it = getIteratorOf(arrayLike)) {
|
|
a = [];
|
|
while(x = it.next(), !x.done)a.push(x.value);
|
|
return a;
|
|
}
|
|
if (arrayLike == null) return [
|
|
arrayLike
|
|
];
|
|
i = arrayLike.length;
|
|
if (typeof i === 'number') {
|
|
a = new Array(i);
|
|
while(i--)a[i] = arrayLike[i];
|
|
return a;
|
|
}
|
|
return [
|
|
arrayLike
|
|
];
|
|
}
|
|
i = arguments.length;
|
|
a = new Array(i);
|
|
while(i--)a[i] = arguments[i];
|
|
return a;
|
|
}
|
|
var isAsyncFunction = typeof Symbol !== 'undefined' ? function(fn) {
|
|
return fn[Symbol.toStringTag] === 'AsyncFunction';
|
|
} : function() {
|
|
return false;
|
|
};
|
|
var dexieErrorNames = [
|
|
'Modify',
|
|
'Bulk',
|
|
'OpenFailed',
|
|
'VersionChange',
|
|
'Schema',
|
|
'Upgrade',
|
|
'InvalidTable',
|
|
'MissingAPI',
|
|
'NoSuchDatabase',
|
|
'InvalidArgument',
|
|
'SubTransaction',
|
|
'Unsupported',
|
|
'Internal',
|
|
'DatabaseClosed',
|
|
'PrematureCommit',
|
|
'ForeignAwait'
|
|
];
|
|
var idbDomErrorNames = [
|
|
'Unknown',
|
|
'Constraint',
|
|
'Data',
|
|
'TransactionInactive',
|
|
'ReadOnly',
|
|
'Version',
|
|
'NotFound',
|
|
'InvalidState',
|
|
'InvalidAccess',
|
|
'Abort',
|
|
'Timeout',
|
|
'QuotaExceeded',
|
|
'Syntax',
|
|
'DataClone'
|
|
];
|
|
var errorList = dexieErrorNames.concat(idbDomErrorNames);
|
|
var defaultTexts = {
|
|
VersionChanged: "Database version changed by other database connection",
|
|
DatabaseClosed: "Database has been closed",
|
|
Abort: "Transaction aborted",
|
|
TransactionInactive: "Transaction has already completed or failed",
|
|
MissingAPI: "IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"
|
|
};
|
|
function DexieError(name, msg) {
|
|
this.name = name;
|
|
this.message = msg;
|
|
}
|
|
derive(DexieError).from(Error).extend({
|
|
toString: function() {
|
|
return this.name + ": " + this.message;
|
|
}
|
|
});
|
|
function getMultiErrorMessage(msg, failures) {
|
|
return msg + ". Errors: " + Object.keys(failures).map(function(key) {
|
|
return failures[key].toString();
|
|
}).filter(function(v, i, s) {
|
|
return s.indexOf(v) === i;
|
|
}).join('\n');
|
|
}
|
|
function ModifyError(msg, failures, successCount, failedKeys) {
|
|
this.failures = failures;
|
|
this.failedKeys = failedKeys;
|
|
this.successCount = successCount;
|
|
this.message = getMultiErrorMessage(msg, failures);
|
|
}
|
|
derive(ModifyError).from(DexieError);
|
|
function BulkError(msg, failures) {
|
|
this.name = "BulkError";
|
|
this.failures = Object.keys(failures).map(function(pos) {
|
|
return failures[pos];
|
|
});
|
|
this.failuresByPos = failures;
|
|
this.message = getMultiErrorMessage(msg, this.failures);
|
|
}
|
|
derive(BulkError).from(DexieError);
|
|
var errnames = errorList.reduce(function(obj, name) {
|
|
return obj[name] = name + "Error", obj;
|
|
}, {});
|
|
var BaseException = DexieError;
|
|
var exceptions = errorList.reduce(function(obj, name) {
|
|
var fullName = name + "Error";
|
|
function DexieError(msgOrInner, inner) {
|
|
this.name = fullName;
|
|
if (!msgOrInner) {
|
|
this.message = defaultTexts[name] || fullName;
|
|
this.inner = null;
|
|
} else if (typeof msgOrInner === 'string') {
|
|
this.message = "".concat(msgOrInner).concat(!inner ? '' : '\n ' + inner);
|
|
this.inner = inner || null;
|
|
} else if (typeof msgOrInner === 'object') {
|
|
this.message = "".concat(msgOrInner.name, " ").concat(msgOrInner.message);
|
|
this.inner = msgOrInner;
|
|
}
|
|
}
|
|
derive(DexieError).from(BaseException);
|
|
obj[name] = DexieError;
|
|
return obj;
|
|
}, {});
|
|
exceptions.Syntax = SyntaxError;
|
|
exceptions.Type = TypeError;
|
|
exceptions.Range = RangeError;
|
|
var exceptionMap = idbDomErrorNames.reduce(function(obj, name) {
|
|
obj[name + "Error"] = exceptions[name];
|
|
return obj;
|
|
}, {});
|
|
function mapError(domError, message) {
|
|
if (!domError || domError instanceof DexieError || domError instanceof TypeError || domError instanceof SyntaxError || !domError.name || !exceptionMap[domError.name]) return domError;
|
|
var rv = new exceptionMap[domError.name](message || domError.message, domError);
|
|
if ("stack" in domError) {
|
|
setProp(rv, "stack", {
|
|
get: function() {
|
|
return this.inner.stack;
|
|
}
|
|
});
|
|
}
|
|
return rv;
|
|
}
|
|
var fullNameExceptions = errorList.reduce(function(obj, name) {
|
|
if ([
|
|
"Syntax",
|
|
"Type",
|
|
"Range"
|
|
].indexOf(name) === -1) obj[name + "Error"] = exceptions[name];
|
|
return obj;
|
|
}, {});
|
|
fullNameExceptions.ModifyError = ModifyError;
|
|
fullNameExceptions.DexieError = DexieError;
|
|
fullNameExceptions.BulkError = BulkError;
|
|
function nop() {}
|
|
function mirror(val) {
|
|
return val;
|
|
}
|
|
function pureFunctionChain(f1, f2) {
|
|
if (f1 == null || f1 === mirror) return f2;
|
|
return function(val) {
|
|
return f2(f1(val));
|
|
};
|
|
}
|
|
function callBoth(on1, on2) {
|
|
return function() {
|
|
on1.apply(this, arguments);
|
|
on2.apply(this, arguments);
|
|
};
|
|
}
|
|
function hookCreatingChain(f1, f2) {
|
|
if (f1 === nop) return f2;
|
|
return function() {
|
|
var res = f1.apply(this, arguments);
|
|
if (res !== undefined) arguments[0] = res;
|
|
var onsuccess = this.onsuccess, onerror = this.onerror;
|
|
this.onsuccess = null;
|
|
this.onerror = null;
|
|
var res2 = f2.apply(this, arguments);
|
|
if (onsuccess) this.onsuccess = this.onsuccess ? callBoth(onsuccess, this.onsuccess) : onsuccess;
|
|
if (onerror) this.onerror = this.onerror ? callBoth(onerror, this.onerror) : onerror;
|
|
return res2 !== undefined ? res2 : res;
|
|
};
|
|
}
|
|
function hookDeletingChain(f1, f2) {
|
|
if (f1 === nop) return f2;
|
|
return function() {
|
|
f1.apply(this, arguments);
|
|
var onsuccess = this.onsuccess, onerror = this.onerror;
|
|
this.onsuccess = this.onerror = null;
|
|
f2.apply(this, arguments);
|
|
if (onsuccess) this.onsuccess = this.onsuccess ? callBoth(onsuccess, this.onsuccess) : onsuccess;
|
|
if (onerror) this.onerror = this.onerror ? callBoth(onerror, this.onerror) : onerror;
|
|
};
|
|
}
|
|
function hookUpdatingChain(f1, f2) {
|
|
if (f1 === nop) return f2;
|
|
return function(modifications) {
|
|
var res = f1.apply(this, arguments);
|
|
extend(modifications, res);
|
|
var onsuccess = this.onsuccess, onerror = this.onerror;
|
|
this.onsuccess = null;
|
|
this.onerror = null;
|
|
var res2 = f2.apply(this, arguments);
|
|
if (onsuccess) this.onsuccess = this.onsuccess ? callBoth(onsuccess, this.onsuccess) : onsuccess;
|
|
if (onerror) this.onerror = this.onerror ? callBoth(onerror, this.onerror) : onerror;
|
|
return res === undefined ? res2 === undefined ? undefined : res2 : extend(res, res2);
|
|
};
|
|
}
|
|
function reverseStoppableEventChain(f1, f2) {
|
|
if (f1 === nop) return f2;
|
|
return function() {
|
|
if (f2.apply(this, arguments) === false) return false;
|
|
return f1.apply(this, arguments);
|
|
};
|
|
}
|
|
function promisableChain(f1, f2) {
|
|
if (f1 === nop) return f2;
|
|
return function() {
|
|
var res = f1.apply(this, arguments);
|
|
if (res && typeof res.then === 'function') {
|
|
var thiz = this, i = arguments.length, args = new Array(i);
|
|
while(i--)args[i] = arguments[i];
|
|
return res.then(function() {
|
|
return f2.apply(thiz, args);
|
|
});
|
|
}
|
|
return f2.apply(this, arguments);
|
|
};
|
|
}
|
|
var debug = typeof location !== 'undefined' && /^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);
|
|
function setDebug(value, filter) {
|
|
debug = value;
|
|
}
|
|
var INTERNAL = {};
|
|
var ZONE_ECHO_LIMIT = 100, _a$1 = typeof Promise === 'undefined' ? [] : function() {
|
|
var globalP = Promise.resolve();
|
|
if (typeof crypto === 'undefined' || !crypto.subtle) return [
|
|
globalP,
|
|
getProto(globalP),
|
|
globalP
|
|
];
|
|
var nativeP = crypto.subtle.digest("SHA-512", new Uint8Array([
|
|
0
|
|
]));
|
|
return [
|
|
nativeP,
|
|
getProto(nativeP),
|
|
globalP
|
|
];
|
|
}(), resolvedNativePromise = _a$1[0], nativePromiseProto = _a$1[1], resolvedGlobalPromise = _a$1[2], nativePromiseThen = nativePromiseProto && nativePromiseProto.then;
|
|
var NativePromise = resolvedNativePromise && resolvedNativePromise.constructor;
|
|
var patchGlobalPromise = !!resolvedGlobalPromise;
|
|
function schedulePhysicalTick() {
|
|
queueMicrotask(physicalTick);
|
|
}
|
|
var asap = function(callback, args) {
|
|
microtickQueue.push([
|
|
callback,
|
|
args
|
|
]);
|
|
if (needsNewPhysicalTick) {
|
|
schedulePhysicalTick();
|
|
needsNewPhysicalTick = false;
|
|
}
|
|
};
|
|
var isOutsideMicroTick = true, needsNewPhysicalTick = true, unhandledErrors = [], rejectingErrors = [], rejectionMapper = mirror;
|
|
var globalPSD = {
|
|
id: 'global',
|
|
global: true,
|
|
ref: 0,
|
|
unhandleds: [],
|
|
onunhandled: nop,
|
|
pgp: false,
|
|
env: {},
|
|
finalize: nop
|
|
};
|
|
var PSD = globalPSD;
|
|
var microtickQueue = [];
|
|
var numScheduledCalls = 0;
|
|
var tickFinalizers = [];
|
|
function DexiePromise(fn) {
|
|
if (typeof this !== 'object') throw new TypeError('Promises must be constructed via new');
|
|
this._listeners = [];
|
|
this._lib = false;
|
|
var psd = this._PSD = PSD;
|
|
if (typeof fn !== 'function') {
|
|
if (fn !== INTERNAL) throw new TypeError('Not a function');
|
|
this._state = arguments[1];
|
|
this._value = arguments[2];
|
|
if (this._state === false) handleRejection(this, this._value);
|
|
return;
|
|
}
|
|
this._state = null;
|
|
this._value = null;
|
|
++psd.ref;
|
|
executePromiseTask(this, fn);
|
|
}
|
|
var thenProp = {
|
|
get: function() {
|
|
var psd = PSD, microTaskId = totalEchoes;
|
|
function then(onFulfilled, onRejected) {
|
|
var _this = this;
|
|
var possibleAwait = !psd.global && (psd !== PSD || microTaskId !== totalEchoes);
|
|
var cleanup = possibleAwait && !decrementExpectedAwaits();
|
|
var rv = new DexiePromise(function(resolve, reject) {
|
|
propagateToListener(_this, new Listener(nativeAwaitCompatibleWrap(onFulfilled, psd, possibleAwait, cleanup), nativeAwaitCompatibleWrap(onRejected, psd, possibleAwait, cleanup), resolve, reject, psd));
|
|
});
|
|
if (this._consoleTask) rv._consoleTask = this._consoleTask;
|
|
return rv;
|
|
}
|
|
then.prototype = INTERNAL;
|
|
return then;
|
|
},
|
|
set: function(value) {
|
|
setProp(this, 'then', value && value.prototype === INTERNAL ? thenProp : {
|
|
get: function() {
|
|
return value;
|
|
},
|
|
set: thenProp.set
|
|
});
|
|
}
|
|
};
|
|
props(DexiePromise.prototype, {
|
|
then: thenProp,
|
|
_then: function(onFulfilled, onRejected) {
|
|
propagateToListener(this, new Listener(null, null, onFulfilled, onRejected, PSD));
|
|
},
|
|
catch: function(onRejected) {
|
|
if (arguments.length === 1) return this.then(null, onRejected);
|
|
var type = arguments[0], handler = arguments[1];
|
|
return typeof type === 'function' ? this.then(null, function(err) {
|
|
return err instanceof type ? handler(err) : PromiseReject(err);
|
|
}) : this.then(null, function(err) {
|
|
return err && err.name === type ? handler(err) : PromiseReject(err);
|
|
});
|
|
},
|
|
finally: function(onFinally) {
|
|
return this.then(function(value) {
|
|
return DexiePromise.resolve(onFinally()).then(function() {
|
|
return value;
|
|
});
|
|
}, function(err) {
|
|
return DexiePromise.resolve(onFinally()).then(function() {
|
|
return PromiseReject(err);
|
|
});
|
|
});
|
|
},
|
|
timeout: function(ms, msg) {
|
|
var _this = this;
|
|
return ms < Infinity ? new DexiePromise(function(resolve, reject) {
|
|
var handle = setTimeout(function() {
|
|
return reject(new exceptions.Timeout(msg));
|
|
}, ms);
|
|
_this.then(resolve, reject).finally(clearTimeout.bind(null, handle));
|
|
}) : this;
|
|
}
|
|
});
|
|
if (typeof Symbol !== 'undefined' && Symbol.toStringTag) setProp(DexiePromise.prototype, Symbol.toStringTag, 'Dexie.Promise');
|
|
globalPSD.env = snapShot();
|
|
function Listener(onFulfilled, onRejected, resolve, reject, zone) {
|
|
this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;
|
|
this.onRejected = typeof onRejected === 'function' ? onRejected : null;
|
|
this.resolve = resolve;
|
|
this.reject = reject;
|
|
this.psd = zone;
|
|
}
|
|
props(DexiePromise, {
|
|
all: function() {
|
|
var values = getArrayOf.apply(null, arguments).map(onPossibleParallellAsync);
|
|
return new DexiePromise(function(resolve, reject) {
|
|
if (values.length === 0) resolve([]);
|
|
var remaining = values.length;
|
|
values.forEach(function(a, i) {
|
|
return DexiePromise.resolve(a).then(function(x) {
|
|
values[i] = x;
|
|
if (!--remaining) resolve(values);
|
|
}, reject);
|
|
});
|
|
});
|
|
},
|
|
resolve: function(value) {
|
|
if (value instanceof DexiePromise) return value;
|
|
if (value && typeof value.then === 'function') return new DexiePromise(function(resolve, reject) {
|
|
value.then(resolve, reject);
|
|
});
|
|
var rv = new DexiePromise(INTERNAL, true, value);
|
|
return rv;
|
|
},
|
|
reject: PromiseReject,
|
|
race: function() {
|
|
var values = getArrayOf.apply(null, arguments).map(onPossibleParallellAsync);
|
|
return new DexiePromise(function(resolve, reject) {
|
|
values.map(function(value) {
|
|
return DexiePromise.resolve(value).then(resolve, reject);
|
|
});
|
|
});
|
|
},
|
|
PSD: {
|
|
get: function() {
|
|
return PSD;
|
|
},
|
|
set: function(value) {
|
|
return PSD = value;
|
|
}
|
|
},
|
|
totalEchoes: {
|
|
get: function() {
|
|
return totalEchoes;
|
|
}
|
|
},
|
|
newPSD: newScope,
|
|
usePSD: usePSD,
|
|
scheduler: {
|
|
get: function() {
|
|
return asap;
|
|
},
|
|
set: function(value) {
|
|
asap = value;
|
|
}
|
|
},
|
|
rejectionMapper: {
|
|
get: function() {
|
|
return rejectionMapper;
|
|
},
|
|
set: function(value) {
|
|
rejectionMapper = value;
|
|
}
|
|
},
|
|
follow: function(fn, zoneProps) {
|
|
return new DexiePromise(function(resolve, reject) {
|
|
return newScope(function(resolve, reject) {
|
|
var psd = PSD;
|
|
psd.unhandleds = [];
|
|
psd.onunhandled = reject;
|
|
psd.finalize = callBoth(function() {
|
|
var _this = this;
|
|
run_at_end_of_this_or_next_physical_tick(function() {
|
|
_this.unhandleds.length === 0 ? resolve() : reject(_this.unhandleds[0]);
|
|
});
|
|
}, psd.finalize);
|
|
fn();
|
|
}, zoneProps, resolve, reject);
|
|
});
|
|
}
|
|
});
|
|
if (NativePromise) {
|
|
if (NativePromise.allSettled) setProp(DexiePromise, "allSettled", function() {
|
|
var possiblePromises = getArrayOf.apply(null, arguments).map(onPossibleParallellAsync);
|
|
return new DexiePromise(function(resolve) {
|
|
if (possiblePromises.length === 0) resolve([]);
|
|
var remaining = possiblePromises.length;
|
|
var results = new Array(remaining);
|
|
possiblePromises.forEach(function(p, i) {
|
|
return DexiePromise.resolve(p).then(function(value) {
|
|
return results[i] = {
|
|
status: "fulfilled",
|
|
value: value
|
|
};
|
|
}, function(reason) {
|
|
return results[i] = {
|
|
status: "rejected",
|
|
reason: reason
|
|
};
|
|
}).then(function() {
|
|
return --remaining || resolve(results);
|
|
});
|
|
});
|
|
});
|
|
});
|
|
if (NativePromise.any && typeof AggregateError !== 'undefined') setProp(DexiePromise, "any", function() {
|
|
var possiblePromises = getArrayOf.apply(null, arguments).map(onPossibleParallellAsync);
|
|
return new DexiePromise(function(resolve, reject) {
|
|
if (possiblePromises.length === 0) reject(new AggregateError([]));
|
|
var remaining = possiblePromises.length;
|
|
var failures = new Array(remaining);
|
|
possiblePromises.forEach(function(p, i) {
|
|
return DexiePromise.resolve(p).then(function(value) {
|
|
return resolve(value);
|
|
}, function(failure) {
|
|
failures[i] = failure;
|
|
if (!--remaining) reject(new AggregateError(failures));
|
|
});
|
|
});
|
|
});
|
|
});
|
|
if (NativePromise.withResolvers) DexiePromise.withResolvers = NativePromise.withResolvers;
|
|
}
|
|
function executePromiseTask(promise, fn) {
|
|
try {
|
|
fn(function(value) {
|
|
if (promise._state !== null) return;
|
|
if (value === promise) throw new TypeError('A promise cannot be resolved with itself.');
|
|
var shouldExecuteTick = promise._lib && beginMicroTickScope();
|
|
if (value && typeof value.then === 'function') {
|
|
executePromiseTask(promise, function(resolve, reject) {
|
|
value instanceof DexiePromise ? value._then(resolve, reject) : value.then(resolve, reject);
|
|
});
|
|
} else {
|
|
promise._state = true;
|
|
promise._value = value;
|
|
propagateAllListeners(promise);
|
|
}
|
|
if (shouldExecuteTick) endMicroTickScope();
|
|
}, handleRejection.bind(null, promise));
|
|
} catch (ex) {
|
|
handleRejection(promise, ex);
|
|
}
|
|
}
|
|
function handleRejection(promise, reason) {
|
|
rejectingErrors.push(reason);
|
|
if (promise._state !== null) return;
|
|
var shouldExecuteTick = promise._lib && beginMicroTickScope();
|
|
reason = rejectionMapper(reason);
|
|
promise._state = false;
|
|
promise._value = reason;
|
|
addPossiblyUnhandledError(promise);
|
|
propagateAllListeners(promise);
|
|
if (shouldExecuteTick) endMicroTickScope();
|
|
}
|
|
function propagateAllListeners(promise) {
|
|
var listeners = promise._listeners;
|
|
promise._listeners = [];
|
|
for(var i = 0, len = listeners.length; i < len; ++i){
|
|
propagateToListener(promise, listeners[i]);
|
|
}
|
|
var psd = promise._PSD;
|
|
--psd.ref || psd.finalize();
|
|
if (numScheduledCalls === 0) {
|
|
++numScheduledCalls;
|
|
asap(function() {
|
|
if (--numScheduledCalls === 0) finalizePhysicalTick();
|
|
}, []);
|
|
}
|
|
}
|
|
function propagateToListener(promise, listener) {
|
|
if (promise._state === null) {
|
|
promise._listeners.push(listener);
|
|
return;
|
|
}
|
|
var cb = promise._state ? listener.onFulfilled : listener.onRejected;
|
|
if (cb === null) {
|
|
return (promise._state ? listener.resolve : listener.reject)(promise._value);
|
|
}
|
|
++listener.psd.ref;
|
|
++numScheduledCalls;
|
|
asap(callListener, [
|
|
cb,
|
|
promise,
|
|
listener
|
|
]);
|
|
}
|
|
function callListener(cb, promise, listener) {
|
|
try {
|
|
var ret, value = promise._value;
|
|
if (!promise._state && rejectingErrors.length) rejectingErrors = [];
|
|
ret = debug && promise._consoleTask ? promise._consoleTask.run(function() {
|
|
return cb(value);
|
|
}) : cb(value);
|
|
if (!promise._state && rejectingErrors.indexOf(value) === -1) {
|
|
markErrorAsHandled(promise);
|
|
}
|
|
listener.resolve(ret);
|
|
} catch (e) {
|
|
listener.reject(e);
|
|
} finally{
|
|
if (--numScheduledCalls === 0) finalizePhysicalTick();
|
|
--listener.psd.ref || listener.psd.finalize();
|
|
}
|
|
}
|
|
function physicalTick() {
|
|
usePSD(globalPSD, {
|
|
"physicalTick.usePSD": function() {
|
|
beginMicroTickScope() && endMicroTickScope();
|
|
}
|
|
}["physicalTick.usePSD"]);
|
|
}
|
|
function beginMicroTickScope() {
|
|
var wasRootExec = isOutsideMicroTick;
|
|
isOutsideMicroTick = false;
|
|
needsNewPhysicalTick = false;
|
|
return wasRootExec;
|
|
}
|
|
function endMicroTickScope() {
|
|
var callbacks, i, l;
|
|
do {
|
|
while(microtickQueue.length > 0){
|
|
callbacks = microtickQueue;
|
|
microtickQueue = [];
|
|
l = callbacks.length;
|
|
for(i = 0; i < l; ++i){
|
|
var item = callbacks[i];
|
|
item[0].apply(null, item[1]);
|
|
}
|
|
}
|
|
}while (microtickQueue.length > 0)
|
|
isOutsideMicroTick = true;
|
|
needsNewPhysicalTick = true;
|
|
}
|
|
function finalizePhysicalTick() {
|
|
var unhandledErrs = unhandledErrors;
|
|
unhandledErrors = [];
|
|
unhandledErrs.forEach(function(p) {
|
|
p._PSD.onunhandled.call(null, p._value, p);
|
|
});
|
|
var finalizers = tickFinalizers.slice(0);
|
|
var i = finalizers.length;
|
|
while(i)finalizers[--i]();
|
|
}
|
|
function run_at_end_of_this_or_next_physical_tick(fn) {
|
|
function finalizer() {
|
|
fn();
|
|
tickFinalizers.splice(tickFinalizers.indexOf(finalizer), 1);
|
|
}
|
|
tickFinalizers.push(finalizer);
|
|
++numScheduledCalls;
|
|
asap(function() {
|
|
if (--numScheduledCalls === 0) finalizePhysicalTick();
|
|
}, []);
|
|
}
|
|
function addPossiblyUnhandledError(promise) {
|
|
if (!unhandledErrors.some(function(p) {
|
|
return p._value === promise._value;
|
|
})) unhandledErrors.push(promise);
|
|
}
|
|
function markErrorAsHandled(promise) {
|
|
var i = unhandledErrors.length;
|
|
while(i)if (unhandledErrors[--i]._value === promise._value) {
|
|
unhandledErrors.splice(i, 1);
|
|
return;
|
|
}
|
|
}
|
|
function PromiseReject(reason) {
|
|
return new DexiePromise(INTERNAL, false, reason);
|
|
}
|
|
function wrap(fn, errorCatcher) {
|
|
var psd = PSD;
|
|
return function() {
|
|
var wasRootExec = beginMicroTickScope(), outerScope = PSD;
|
|
try {
|
|
switchToZone(psd, true);
|
|
return fn.apply(this, arguments);
|
|
} catch (e) {
|
|
errorCatcher && errorCatcher(e);
|
|
} finally{
|
|
switchToZone(outerScope, false);
|
|
if (wasRootExec) endMicroTickScope();
|
|
}
|
|
};
|
|
}
|
|
var task = {
|
|
awaits: 0,
|
|
echoes: 0,
|
|
id: 0
|
|
};
|
|
var taskCounter = 0;
|
|
var zoneStack = [];
|
|
var zoneEchoes = 0;
|
|
var totalEchoes = 0;
|
|
var zone_id_counter = 0;
|
|
function newScope(fn, props, a1, a2) {
|
|
var parent = PSD, psd = Object.create(parent);
|
|
psd.parent = parent;
|
|
psd.ref = 0;
|
|
psd.global = false;
|
|
psd.id = ++zone_id_counter;
|
|
globalPSD.env;
|
|
psd.env = patchGlobalPromise ? {
|
|
Promise: DexiePromise,
|
|
PromiseProp: {
|
|
value: DexiePromise,
|
|
configurable: true,
|
|
writable: true
|
|
},
|
|
all: DexiePromise.all,
|
|
race: DexiePromise.race,
|
|
allSettled: DexiePromise.allSettled,
|
|
any: DexiePromise.any,
|
|
resolve: DexiePromise.resolve,
|
|
reject: DexiePromise.reject
|
|
} : {};
|
|
if (props) extend(psd, props);
|
|
++parent.ref;
|
|
psd.finalize = function() {
|
|
--this.parent.ref || this.parent.finalize();
|
|
};
|
|
var rv = usePSD(psd, fn, a1, a2);
|
|
if (psd.ref === 0) psd.finalize();
|
|
return rv;
|
|
}
|
|
function incrementExpectedAwaits() {
|
|
if (!task.id) task.id = ++taskCounter;
|
|
++task.awaits;
|
|
task.echoes += ZONE_ECHO_LIMIT;
|
|
return task.id;
|
|
}
|
|
function decrementExpectedAwaits() {
|
|
if (!task.awaits) return false;
|
|
if (--task.awaits === 0) task.id = 0;
|
|
task.echoes = task.awaits * ZONE_ECHO_LIMIT;
|
|
return true;
|
|
}
|
|
if (('' + nativePromiseThen).indexOf('[native code]') === -1) {
|
|
incrementExpectedAwaits = decrementExpectedAwaits = nop;
|
|
}
|
|
function onPossibleParallellAsync(possiblePromise) {
|
|
if (task.echoes && possiblePromise && possiblePromise.constructor === NativePromise) {
|
|
incrementExpectedAwaits();
|
|
return possiblePromise.then(function(x) {
|
|
decrementExpectedAwaits();
|
|
return x;
|
|
}, function(e) {
|
|
decrementExpectedAwaits();
|
|
return rejection(e);
|
|
});
|
|
}
|
|
return possiblePromise;
|
|
}
|
|
function zoneEnterEcho(targetZone) {
|
|
++totalEchoes;
|
|
if (!task.echoes || --task.echoes === 0) {
|
|
task.echoes = task.awaits = task.id = 0;
|
|
}
|
|
zoneStack.push(PSD);
|
|
switchToZone(targetZone, true);
|
|
}
|
|
function zoneLeaveEcho() {
|
|
var zone = zoneStack[zoneStack.length - 1];
|
|
zoneStack.pop();
|
|
switchToZone(zone, false);
|
|
}
|
|
function switchToZone(targetZone, bEnteringZone) {
|
|
var currentZone = PSD;
|
|
if (bEnteringZone ? task.echoes && (!zoneEchoes++ || targetZone !== PSD) : zoneEchoes && (!--zoneEchoes || targetZone !== PSD)) {
|
|
queueMicrotask(bEnteringZone ? zoneEnterEcho.bind(null, targetZone) : zoneLeaveEcho);
|
|
}
|
|
if (targetZone === PSD) return;
|
|
PSD = targetZone;
|
|
if (currentZone === globalPSD) globalPSD.env = snapShot();
|
|
if (patchGlobalPromise) {
|
|
var GlobalPromise = globalPSD.env.Promise;
|
|
var targetEnv = targetZone.env;
|
|
if (currentZone.global || targetZone.global) {
|
|
Object.defineProperty(_global, 'Promise', targetEnv.PromiseProp);
|
|
GlobalPromise.all = targetEnv.all;
|
|
GlobalPromise.race = targetEnv.race;
|
|
GlobalPromise.resolve = targetEnv.resolve;
|
|
GlobalPromise.reject = targetEnv.reject;
|
|
if (targetEnv.allSettled) GlobalPromise.allSettled = targetEnv.allSettled;
|
|
if (targetEnv.any) GlobalPromise.any = targetEnv.any;
|
|
}
|
|
}
|
|
}
|
|
function snapShot() {
|
|
var GlobalPromise = _global.Promise;
|
|
return patchGlobalPromise ? {
|
|
Promise: GlobalPromise,
|
|
PromiseProp: Object.getOwnPropertyDescriptor(_global, "Promise"),
|
|
all: GlobalPromise.all,
|
|
race: GlobalPromise.race,
|
|
allSettled: GlobalPromise.allSettled,
|
|
any: GlobalPromise.any,
|
|
resolve: GlobalPromise.resolve,
|
|
reject: GlobalPromise.reject
|
|
} : {};
|
|
}
|
|
function usePSD(psd, fn, a1, a2, a3) {
|
|
var outerScope = PSD;
|
|
try {
|
|
switchToZone(psd, true);
|
|
return fn(a1, a2, a3);
|
|
} finally{
|
|
switchToZone(outerScope, false);
|
|
}
|
|
}
|
|
function nativeAwaitCompatibleWrap(fn, zone, possibleAwait, cleanup) {
|
|
return typeof fn !== 'function' ? fn : function() {
|
|
var outerZone = PSD;
|
|
if (possibleAwait) incrementExpectedAwaits();
|
|
switchToZone(zone, true);
|
|
try {
|
|
return fn.apply(this, arguments);
|
|
} finally{
|
|
switchToZone(outerZone, false);
|
|
if (cleanup) queueMicrotask(decrementExpectedAwaits);
|
|
}
|
|
};
|
|
}
|
|
function execInGlobalContext(cb) {
|
|
if (Promise === NativePromise && task.echoes === 0) {
|
|
if (zoneEchoes === 0) {
|
|
cb();
|
|
} else {
|
|
enqueueNativeMicroTask(cb);
|
|
}
|
|
} else {
|
|
setTimeout(cb, 0);
|
|
}
|
|
}
|
|
var rejection = DexiePromise.reject;
|
|
function tempTransaction(db, mode, storeNames, fn) {
|
|
if (!db.idbdb || !db._state.openComplete && !PSD.letThrough && !db._vip) {
|
|
if (db._state.openComplete) {
|
|
return rejection(new exceptions.DatabaseClosed(db._state.dbOpenError));
|
|
}
|
|
if (!db._state.isBeingOpened) {
|
|
if (!db._state.autoOpen) return rejection(new exceptions.DatabaseClosed());
|
|
db.open().catch(nop);
|
|
}
|
|
return db._state.dbReadyPromise.then(function() {
|
|
return tempTransaction(db, mode, storeNames, fn);
|
|
});
|
|
} else {
|
|
var trans = db._createTransaction(mode, storeNames, db._dbSchema);
|
|
try {
|
|
trans.create();
|
|
db._state.PR1398_maxLoop = 3;
|
|
} catch (ex) {
|
|
if (ex.name === errnames.InvalidState && db.isOpen() && --db._state.PR1398_maxLoop > 0) {
|
|
console.warn('Dexie: Need to reopen db');
|
|
db.close({
|
|
disableAutoOpen: false
|
|
});
|
|
return db.open().then(function() {
|
|
return tempTransaction(db, mode, storeNames, fn);
|
|
});
|
|
}
|
|
return rejection(ex);
|
|
}
|
|
return trans._promise(mode, function(resolve, reject) {
|
|
return newScope(function() {
|
|
PSD.trans = trans;
|
|
return fn(resolve, reject, trans);
|
|
});
|
|
}).then(function(result) {
|
|
if (mode === 'readwrite') try {
|
|
trans.idbtrans.commit();
|
|
} catch (_a) {}
|
|
return mode === 'readonly' ? result : trans._completion.then(function() {
|
|
return result;
|
|
});
|
|
});
|
|
}
|
|
}
|
|
var DEXIE_VERSION = '4.2.1';
|
|
var maxString = String.fromCharCode(65535);
|
|
var minKey = -Infinity;
|
|
var INVALID_KEY_ARGUMENT = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.";
|
|
var STRING_EXPECTED = "String expected.";
|
|
var connections = [];
|
|
var DBNAMES_DB = '__dbnames';
|
|
var READONLY = 'readonly';
|
|
var READWRITE = 'readwrite';
|
|
function combine(filter1, filter2) {
|
|
return filter1 ? filter2 ? function() {
|
|
return filter1.apply(this, arguments) && filter2.apply(this, arguments);
|
|
} : filter1 : filter2;
|
|
}
|
|
var AnyRange = {
|
|
type: 3,
|
|
lower: -Infinity,
|
|
lowerOpen: false,
|
|
upper: [
|
|
[]
|
|
],
|
|
upperOpen: false
|
|
};
|
|
function workaroundForUndefinedPrimKey(keyPath) {
|
|
return typeof keyPath === "string" && !/\./.test(keyPath) ? function(obj) {
|
|
if (obj[keyPath] === undefined && keyPath in obj) {
|
|
obj = deepClone(obj);
|
|
delete obj[keyPath];
|
|
}
|
|
return obj;
|
|
} : function(obj) {
|
|
return obj;
|
|
};
|
|
}
|
|
function Entity() {
|
|
throw exceptions.Type("Entity instances must never be new:ed. Instances are generated by the framework bypassing the constructor.");
|
|
}
|
|
function cmp(a, b) {
|
|
try {
|
|
var ta = type(a);
|
|
var tb = type(b);
|
|
if (ta !== tb) {
|
|
if (ta === 'Array') return 1;
|
|
if (tb === 'Array') return -1;
|
|
if (ta === 'binary') return 1;
|
|
if (tb === 'binary') return -1;
|
|
if (ta === 'string') return 1;
|
|
if (tb === 'string') return -1;
|
|
if (ta === 'Date') return 1;
|
|
if (tb !== 'Date') return NaN;
|
|
return -1;
|
|
}
|
|
switch(ta){
|
|
case 'number':
|
|
case 'Date':
|
|
case 'string':
|
|
return a > b ? 1 : a < b ? -1 : 0;
|
|
case 'binary':
|
|
{
|
|
return compareUint8Arrays(getUint8Array(a), getUint8Array(b));
|
|
}
|
|
case 'Array':
|
|
return compareArrays(a, b);
|
|
}
|
|
} catch (_a) {}
|
|
return NaN;
|
|
}
|
|
function compareArrays(a, b) {
|
|
var al = a.length;
|
|
var bl = b.length;
|
|
var l = al < bl ? al : bl;
|
|
for(var i = 0; i < l; ++i){
|
|
var res = cmp(a[i], b[i]);
|
|
if (res !== 0) return res;
|
|
}
|
|
return al === bl ? 0 : al < bl ? -1 : 1;
|
|
}
|
|
function compareUint8Arrays(a, b) {
|
|
var al = a.length;
|
|
var bl = b.length;
|
|
var l = al < bl ? al : bl;
|
|
for(var i = 0; i < l; ++i){
|
|
if (a[i] !== b[i]) return a[i] < b[i] ? -1 : 1;
|
|
}
|
|
return al === bl ? 0 : al < bl ? -1 : 1;
|
|
}
|
|
function type(x) {
|
|
var t = typeof x;
|
|
if (t !== 'object') return t;
|
|
if (ArrayBuffer.isView(x)) return 'binary';
|
|
var tsTag = toStringTag(x);
|
|
return tsTag === 'ArrayBuffer' ? 'binary' : tsTag;
|
|
}
|
|
function getUint8Array(a) {
|
|
if (a instanceof Uint8Array) return a;
|
|
if (ArrayBuffer.isView(a)) return new Uint8Array(a.buffer, a.byteOffset, a.byteLength);
|
|
return new Uint8Array(a);
|
|
}
|
|
function builtInDeletionTrigger(table, keys, res) {
|
|
var yProps = table.schema.yProps;
|
|
if (!yProps) return res;
|
|
if (keys && res.numFailures > 0) keys = keys.filter(function(_, i) {
|
|
return !res.failures[i];
|
|
});
|
|
return Promise.all(yProps.map(function(_a) {
|
|
var updatesTable = _a.updatesTable;
|
|
return keys ? table.db.table(updatesTable).where('k').anyOf(keys).delete() : table.db.table(updatesTable).clear();
|
|
})).then(function() {
|
|
return res;
|
|
});
|
|
}
|
|
var PropModification = function() {
|
|
function PropModification(spec) {
|
|
this["@@propmod"] = spec;
|
|
}
|
|
PropModification.prototype.execute = function(value) {
|
|
var _a;
|
|
var spec = this["@@propmod"];
|
|
if (spec.add !== undefined) {
|
|
var term = spec.add;
|
|
if (isArray(term)) {
|
|
return __spreadArray(__spreadArray([], isArray(value) ? value : [], true), term, true).sort();
|
|
}
|
|
if (typeof term === 'number') return (Number(value) || 0) + term;
|
|
if (typeof term === 'bigint') {
|
|
try {
|
|
return BigInt(value) + term;
|
|
} catch (_b) {
|
|
return BigInt(0) + term;
|
|
}
|
|
}
|
|
throw new TypeError("Invalid term ".concat(term));
|
|
}
|
|
if (spec.remove !== undefined) {
|
|
var subtrahend_1 = spec.remove;
|
|
if (isArray(subtrahend_1)) {
|
|
return isArray(value) ? value.filter(function(item) {
|
|
return !subtrahend_1.includes(item);
|
|
}).sort() : [];
|
|
}
|
|
if (typeof subtrahend_1 === 'number') return Number(value) - subtrahend_1;
|
|
if (typeof subtrahend_1 === 'bigint') {
|
|
try {
|
|
return BigInt(value) - subtrahend_1;
|
|
} catch (_c) {
|
|
return BigInt(0) - subtrahend_1;
|
|
}
|
|
}
|
|
throw new TypeError("Invalid subtrahend ".concat(subtrahend_1));
|
|
}
|
|
var prefixToReplace = (_a = spec.replacePrefix) === null || _a === void 0 ? void 0 : _a[0];
|
|
if (prefixToReplace && typeof value === 'string' && value.startsWith(prefixToReplace)) {
|
|
return spec.replacePrefix[1] + value.substring(prefixToReplace.length);
|
|
}
|
|
return value;
|
|
};
|
|
return PropModification;
|
|
}();
|
|
function applyUpdateSpec(obj, changes) {
|
|
var keyPaths = keys(changes);
|
|
var numKeys = keyPaths.length;
|
|
var anythingModified = false;
|
|
for(var i = 0; i < numKeys; ++i){
|
|
var keyPath = keyPaths[i];
|
|
var value = changes[keyPath];
|
|
var origValue = getByKeyPath(obj, keyPath);
|
|
if (value instanceof PropModification) {
|
|
setByKeyPath(obj, keyPath, value.execute(origValue));
|
|
anythingModified = true;
|
|
} else if (origValue !== value) {
|
|
setByKeyPath(obj, keyPath, value);
|
|
anythingModified = true;
|
|
}
|
|
}
|
|
return anythingModified;
|
|
}
|
|
var Table = function() {
|
|
function Table() {}
|
|
Table.prototype._trans = function(mode, fn, writeLocked) {
|
|
var trans = this._tx || PSD.trans;
|
|
var tableName = this.name;
|
|
var task = debug && typeof console !== 'undefined' && console.createTask && console.createTask("Dexie: ".concat(mode === 'readonly' ? 'read' : 'write', " ").concat(this.name));
|
|
function checkTableInTransaction(resolve, reject, trans) {
|
|
if (!trans.schema[tableName]) throw new exceptions.NotFound("Table " + tableName + " not part of transaction");
|
|
return fn(trans.idbtrans, trans);
|
|
}
|
|
var wasRootExec = beginMicroTickScope();
|
|
try {
|
|
var p = trans && trans.db._novip === this.db._novip ? trans === PSD.trans ? trans._promise(mode, checkTableInTransaction, writeLocked) : newScope(function() {
|
|
return trans._promise(mode, checkTableInTransaction, writeLocked);
|
|
}, {
|
|
trans: trans,
|
|
transless: PSD.transless || PSD
|
|
}) : tempTransaction(this.db, mode, [
|
|
this.name
|
|
], checkTableInTransaction);
|
|
if (task) {
|
|
p._consoleTask = task;
|
|
p = p.catch(function(err) {
|
|
console.trace(err);
|
|
return rejection(err);
|
|
});
|
|
}
|
|
return p;
|
|
} finally{
|
|
if (wasRootExec) endMicroTickScope();
|
|
}
|
|
};
|
|
Table.prototype.get = function(keyOrCrit, cb) {
|
|
var _this = this;
|
|
if (keyOrCrit && keyOrCrit.constructor === Object) return this.where(keyOrCrit).first(cb);
|
|
if (keyOrCrit == null) return rejection(new exceptions.Type("Invalid argument to Table.get()"));
|
|
return this._trans('readonly', function(trans) {
|
|
return _this.core.get({
|
|
trans: trans,
|
|
key: keyOrCrit
|
|
}).then(function(res) {
|
|
return _this.hook.reading.fire(res);
|
|
});
|
|
}).then(cb);
|
|
};
|
|
Table.prototype.where = function(indexOrCrit) {
|
|
if (typeof indexOrCrit === 'string') return new this.db.WhereClause(this, indexOrCrit);
|
|
if (isArray(indexOrCrit)) return new this.db.WhereClause(this, "[".concat(indexOrCrit.join('+'), "]"));
|
|
var keyPaths = keys(indexOrCrit);
|
|
if (keyPaths.length === 1) return this.where(keyPaths[0]).equals(indexOrCrit[keyPaths[0]]);
|
|
var compoundIndex = this.schema.indexes.concat(this.schema.primKey).filter(function(ix) {
|
|
if (ix.compound && keyPaths.every(function(keyPath) {
|
|
return ix.keyPath.indexOf(keyPath) >= 0;
|
|
})) {
|
|
for(var i = 0; i < keyPaths.length; ++i){
|
|
if (keyPaths.indexOf(ix.keyPath[i]) === -1) return false;
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
}).sort(function(a, b) {
|
|
return a.keyPath.length - b.keyPath.length;
|
|
})[0];
|
|
if (compoundIndex && this.db._maxKey !== maxString) {
|
|
var keyPathsInValidOrder = compoundIndex.keyPath.slice(0, keyPaths.length);
|
|
return this.where(keyPathsInValidOrder).equals(keyPathsInValidOrder.map(function(kp) {
|
|
return indexOrCrit[kp];
|
|
}));
|
|
}
|
|
if (!compoundIndex && debug) console.warn("The query ".concat(JSON.stringify(indexOrCrit), " on ").concat(this.name, " would benefit from a ") + "compound index [".concat(keyPaths.join('+'), "]"));
|
|
var idxByName = this.schema.idxByName;
|
|
function equals(a, b) {
|
|
return cmp(a, b) === 0;
|
|
}
|
|
var _a = keyPaths.reduce(function(_a, keyPath) {
|
|
var prevIndex = _a[0], prevFilterFn = _a[1];
|
|
var index = idxByName[keyPath];
|
|
var value = indexOrCrit[keyPath];
|
|
return [
|
|
prevIndex || index,
|
|
prevIndex || !index ? combine(prevFilterFn, index && index.multi ? function(x) {
|
|
var prop = getByKeyPath(x, keyPath);
|
|
return isArray(prop) && prop.some(function(item) {
|
|
return equals(value, item);
|
|
});
|
|
} : function(x) {
|
|
return equals(value, getByKeyPath(x, keyPath));
|
|
}) : prevFilterFn
|
|
];
|
|
}, [
|
|
null,
|
|
null
|
|
]), idx = _a[0], filterFunction = _a[1];
|
|
return idx ? this.where(idx.name).equals(indexOrCrit[idx.keyPath]).filter(filterFunction) : compoundIndex ? this.filter(filterFunction) : this.where(keyPaths).equals('');
|
|
};
|
|
Table.prototype.filter = function(filterFunction) {
|
|
return this.toCollection().and(filterFunction);
|
|
};
|
|
Table.prototype.count = function(thenShortcut) {
|
|
return this.toCollection().count(thenShortcut);
|
|
};
|
|
Table.prototype.offset = function(offset) {
|
|
return this.toCollection().offset(offset);
|
|
};
|
|
Table.prototype.limit = function(numRows) {
|
|
return this.toCollection().limit(numRows);
|
|
};
|
|
Table.prototype.each = function(callback) {
|
|
return this.toCollection().each(callback);
|
|
};
|
|
Table.prototype.toArray = function(thenShortcut) {
|
|
return this.toCollection().toArray(thenShortcut);
|
|
};
|
|
Table.prototype.toCollection = function() {
|
|
return new this.db.Collection(new this.db.WhereClause(this));
|
|
};
|
|
Table.prototype.orderBy = function(index) {
|
|
return new this.db.Collection(new this.db.WhereClause(this, isArray(index) ? "[".concat(index.join('+'), "]") : index));
|
|
};
|
|
Table.prototype.reverse = function() {
|
|
return this.toCollection().reverse();
|
|
};
|
|
Table.prototype.mapToClass = function(constructor) {
|
|
var _a = this, db = _a.db, tableName = _a.name;
|
|
this.schema.mappedClass = constructor;
|
|
if (constructor.prototype instanceof Entity) {
|
|
constructor = function(_super) {
|
|
__extends(class_1, _super);
|
|
function class_1() {
|
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
}
|
|
Object.defineProperty(class_1.prototype, "db", {
|
|
get: function() {
|
|
return db;
|
|
},
|
|
enumerable: false,
|
|
configurable: true
|
|
});
|
|
class_1.prototype.table = function() {
|
|
return tableName;
|
|
};
|
|
return class_1;
|
|
}(constructor);
|
|
}
|
|
var inheritedProps = new Set();
|
|
for(var proto = constructor.prototype; proto; proto = getProto(proto)){
|
|
Object.getOwnPropertyNames(proto).forEach(function(propName) {
|
|
return inheritedProps.add(propName);
|
|
});
|
|
}
|
|
var readHook = function(obj) {
|
|
if (!obj) return obj;
|
|
var res = Object.create(constructor.prototype);
|
|
for(var m in obj)if (!inheritedProps.has(m)) try {
|
|
res[m] = obj[m];
|
|
} catch (_) {}
|
|
return res;
|
|
};
|
|
if (this.schema.readHook) {
|
|
this.hook.reading.unsubscribe(this.schema.readHook);
|
|
}
|
|
this.schema.readHook = readHook;
|
|
this.hook("reading", readHook);
|
|
return constructor;
|
|
};
|
|
Table.prototype.defineClass = function() {
|
|
function Class(content) {
|
|
extend(this, content);
|
|
}
|
|
return this.mapToClass(Class);
|
|
};
|
|
Table.prototype.add = function(obj, key) {
|
|
var _this = this;
|
|
var _a = this.schema.primKey, auto = _a.auto, keyPath = _a.keyPath;
|
|
var objToAdd = obj;
|
|
if (keyPath && auto) {
|
|
objToAdd = workaroundForUndefinedPrimKey(keyPath)(obj);
|
|
}
|
|
return this._trans('readwrite', function(trans) {
|
|
return _this.core.mutate({
|
|
trans: trans,
|
|
type: 'add',
|
|
keys: key != null ? [
|
|
key
|
|
] : null,
|
|
values: [
|
|
objToAdd
|
|
]
|
|
});
|
|
}).then(function(res) {
|
|
return res.numFailures ? DexiePromise.reject(res.failures[0]) : res.lastResult;
|
|
}).then(function(lastResult) {
|
|
if (keyPath) {
|
|
try {
|
|
setByKeyPath(obj, keyPath, lastResult);
|
|
} catch (_) {}
|
|
}
|
|
return lastResult;
|
|
});
|
|
};
|
|
Table.prototype.upsert = function(key, modifications) {
|
|
var _this = this;
|
|
var keyPath = this.schema.primKey.keyPath;
|
|
return this._trans('readwrite', function(trans) {
|
|
return _this.core.get({
|
|
trans: trans,
|
|
key: key
|
|
}).then(function(existing) {
|
|
var obj = existing !== null && existing !== void 0 ? existing : {};
|
|
applyUpdateSpec(obj, modifications);
|
|
if (keyPath) setByKeyPath(obj, keyPath, key);
|
|
return _this.core.mutate({
|
|
trans: trans,
|
|
type: 'put',
|
|
values: [
|
|
obj
|
|
],
|
|
keys: [
|
|
key
|
|
],
|
|
upsert: true,
|
|
updates: {
|
|
keys: [
|
|
key
|
|
],
|
|
changeSpecs: [
|
|
modifications
|
|
]
|
|
}
|
|
}).then(function(res) {
|
|
return res.numFailures ? DexiePromise.reject(res.failures[0]) : !!existing;
|
|
});
|
|
});
|
|
});
|
|
};
|
|
Table.prototype.update = function(keyOrObject, modifications) {
|
|
if (typeof keyOrObject === 'object' && !isArray(keyOrObject)) {
|
|
var key = getByKeyPath(keyOrObject, this.schema.primKey.keyPath);
|
|
if (key === undefined) return rejection(new exceptions.InvalidArgument("Given object does not contain its primary key"));
|
|
return this.where(":id").equals(key).modify(modifications);
|
|
} else {
|
|
return this.where(":id").equals(keyOrObject).modify(modifications);
|
|
}
|
|
};
|
|
Table.prototype.put = function(obj, key) {
|
|
var _this = this;
|
|
var _a = this.schema.primKey, auto = _a.auto, keyPath = _a.keyPath;
|
|
var objToAdd = obj;
|
|
if (keyPath && auto) {
|
|
objToAdd = workaroundForUndefinedPrimKey(keyPath)(obj);
|
|
}
|
|
return this._trans('readwrite', function(trans) {
|
|
return _this.core.mutate({
|
|
trans: trans,
|
|
type: 'put',
|
|
values: [
|
|
objToAdd
|
|
],
|
|
keys: key != null ? [
|
|
key
|
|
] : null
|
|
});
|
|
}).then(function(res) {
|
|
return res.numFailures ? DexiePromise.reject(res.failures[0]) : res.lastResult;
|
|
}).then(function(lastResult) {
|
|
if (keyPath) {
|
|
try {
|
|
setByKeyPath(obj, keyPath, lastResult);
|
|
} catch (_) {}
|
|
}
|
|
return lastResult;
|
|
});
|
|
};
|
|
Table.prototype.delete = function(key) {
|
|
var _this = this;
|
|
return this._trans('readwrite', function(trans) {
|
|
return _this.core.mutate({
|
|
trans: trans,
|
|
type: 'delete',
|
|
keys: [
|
|
key
|
|
]
|
|
}).then(function(res) {
|
|
return builtInDeletionTrigger(_this, [
|
|
key
|
|
], res);
|
|
}).then(function(res) {
|
|
return res.numFailures ? DexiePromise.reject(res.failures[0]) : undefined;
|
|
});
|
|
});
|
|
};
|
|
Table.prototype.clear = function() {
|
|
var _this = this;
|
|
return this._trans('readwrite', function(trans) {
|
|
return _this.core.mutate({
|
|
trans: trans,
|
|
type: 'deleteRange',
|
|
range: AnyRange
|
|
}).then(function(res) {
|
|
return builtInDeletionTrigger(_this, null, res);
|
|
});
|
|
}).then(function(res) {
|
|
return res.numFailures ? DexiePromise.reject(res.failures[0]) : undefined;
|
|
});
|
|
};
|
|
Table.prototype.bulkGet = function(keys) {
|
|
var _this = this;
|
|
return this._trans('readonly', function(trans) {
|
|
return _this.core.getMany({
|
|
keys: keys,
|
|
trans: trans
|
|
}).then(function(result) {
|
|
return result.map(function(res) {
|
|
return _this.hook.reading.fire(res);
|
|
});
|
|
});
|
|
});
|
|
};
|
|
Table.prototype.bulkAdd = function(objects, keysOrOptions, options) {
|
|
var _this = this;
|
|
var keys = Array.isArray(keysOrOptions) ? keysOrOptions : undefined;
|
|
options = options || (keys ? undefined : keysOrOptions);
|
|
var wantResults = options ? options.allKeys : undefined;
|
|
return this._trans('readwrite', function(trans) {
|
|
var _a = _this.schema.primKey, auto = _a.auto, keyPath = _a.keyPath;
|
|
if (keyPath && keys) throw new exceptions.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");
|
|
if (keys && keys.length !== objects.length) throw new exceptions.InvalidArgument("Arguments objects and keys must have the same length");
|
|
var numObjects = objects.length;
|
|
var objectsToAdd = keyPath && auto ? objects.map(workaroundForUndefinedPrimKey(keyPath)) : objects;
|
|
return _this.core.mutate({
|
|
trans: trans,
|
|
type: 'add',
|
|
keys: keys,
|
|
values: objectsToAdd,
|
|
wantResults: wantResults
|
|
}).then(function(_a) {
|
|
var numFailures = _a.numFailures, results = _a.results, lastResult = _a.lastResult, failures = _a.failures;
|
|
var result = wantResults ? results : lastResult;
|
|
if (numFailures === 0) return result;
|
|
throw new BulkError("".concat(_this.name, ".bulkAdd(): ").concat(numFailures, " of ").concat(numObjects, " operations failed"), failures);
|
|
});
|
|
});
|
|
};
|
|
Table.prototype.bulkPut = function(objects, keysOrOptions, options) {
|
|
var _this = this;
|
|
var keys = Array.isArray(keysOrOptions) ? keysOrOptions : undefined;
|
|
options = options || (keys ? undefined : keysOrOptions);
|
|
var wantResults = options ? options.allKeys : undefined;
|
|
return this._trans('readwrite', function(trans) {
|
|
var _a = _this.schema.primKey, auto = _a.auto, keyPath = _a.keyPath;
|
|
if (keyPath && keys) throw new exceptions.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");
|
|
if (keys && keys.length !== objects.length) throw new exceptions.InvalidArgument("Arguments objects and keys must have the same length");
|
|
var numObjects = objects.length;
|
|
var objectsToPut = keyPath && auto ? objects.map(workaroundForUndefinedPrimKey(keyPath)) : objects;
|
|
return _this.core.mutate({
|
|
trans: trans,
|
|
type: 'put',
|
|
keys: keys,
|
|
values: objectsToPut,
|
|
wantResults: wantResults
|
|
}).then(function(_a) {
|
|
var numFailures = _a.numFailures, results = _a.results, lastResult = _a.lastResult, failures = _a.failures;
|
|
var result = wantResults ? results : lastResult;
|
|
if (numFailures === 0) return result;
|
|
throw new BulkError("".concat(_this.name, ".bulkPut(): ").concat(numFailures, " of ").concat(numObjects, " operations failed"), failures);
|
|
});
|
|
});
|
|
};
|
|
Table.prototype.bulkUpdate = function(keysAndChanges) {
|
|
var _this = this;
|
|
var coreTable = this.core;
|
|
var keys = keysAndChanges.map(function(entry) {
|
|
return entry.key;
|
|
});
|
|
var changeSpecs = keysAndChanges.map(function(entry) {
|
|
return entry.changes;
|
|
});
|
|
var offsetMap = [];
|
|
return this._trans('readwrite', function(trans) {
|
|
return coreTable.getMany({
|
|
trans: trans,
|
|
keys: keys,
|
|
cache: 'clone'
|
|
}).then(function(objs) {
|
|
var resultKeys = [];
|
|
var resultObjs = [];
|
|
keysAndChanges.forEach(function(_a, idx) {
|
|
var key = _a.key, changes = _a.changes;
|
|
var obj = objs[idx];
|
|
if (obj) {
|
|
for(var _i = 0, _b = Object.keys(changes); _i < _b.length; _i++){
|
|
var keyPath = _b[_i];
|
|
var value = changes[keyPath];
|
|
if (keyPath === _this.schema.primKey.keyPath) {
|
|
if (cmp(value, key) !== 0) {
|
|
throw new exceptions.Constraint("Cannot update primary key in bulkUpdate()");
|
|
}
|
|
} else {
|
|
setByKeyPath(obj, keyPath, value);
|
|
}
|
|
}
|
|
offsetMap.push(idx);
|
|
resultKeys.push(key);
|
|
resultObjs.push(obj);
|
|
}
|
|
});
|
|
var numEntries = resultKeys.length;
|
|
return coreTable.mutate({
|
|
trans: trans,
|
|
type: 'put',
|
|
keys: resultKeys,
|
|
values: resultObjs,
|
|
updates: {
|
|
keys: keys,
|
|
changeSpecs: changeSpecs
|
|
}
|
|
}).then(function(_a) {
|
|
var numFailures = _a.numFailures, failures = _a.failures;
|
|
if (numFailures === 0) return numEntries;
|
|
for(var _i = 0, _b = Object.keys(failures); _i < _b.length; _i++){
|
|
var offset = _b[_i];
|
|
var mappedOffset = offsetMap[Number(offset)];
|
|
if (mappedOffset != null) {
|
|
var failure = failures[offset];
|
|
delete failures[offset];
|
|
failures[mappedOffset] = failure;
|
|
}
|
|
}
|
|
throw new BulkError("".concat(_this.name, ".bulkUpdate(): ").concat(numFailures, " of ").concat(numEntries, " operations failed"), failures);
|
|
});
|
|
});
|
|
});
|
|
};
|
|
Table.prototype.bulkDelete = function(keys) {
|
|
var _this = this;
|
|
var numKeys = keys.length;
|
|
return this._trans('readwrite', function(trans) {
|
|
return _this.core.mutate({
|
|
trans: trans,
|
|
type: 'delete',
|
|
keys: keys
|
|
}).then(function(res) {
|
|
return builtInDeletionTrigger(_this, keys, res);
|
|
});
|
|
}).then(function(_a) {
|
|
var numFailures = _a.numFailures, lastResult = _a.lastResult, failures = _a.failures;
|
|
if (numFailures === 0) return lastResult;
|
|
throw new BulkError("".concat(_this.name, ".bulkDelete(): ").concat(numFailures, " of ").concat(numKeys, " operations failed"), failures);
|
|
});
|
|
};
|
|
return Table;
|
|
}();
|
|
function Events(ctx) {
|
|
var evs = {};
|
|
var rv = function(eventName, subscriber) {
|
|
if (subscriber) {
|
|
var i = arguments.length, args = new Array(i - 1);
|
|
while(--i)args[i - 1] = arguments[i];
|
|
evs[eventName].subscribe.apply(null, args);
|
|
return ctx;
|
|
} else if (typeof eventName === 'string') {
|
|
return evs[eventName];
|
|
}
|
|
};
|
|
rv.addEventType = add;
|
|
for(var i = 1, l = arguments.length; i < l; ++i){
|
|
add(arguments[i]);
|
|
}
|
|
return rv;
|
|
//TURBOPACK unreachable
|
|
;
|
|
function add(eventName, chainFunction, defaultFunction) {
|
|
if (typeof eventName === 'object') return addConfiguredEvents(eventName);
|
|
if (!chainFunction) chainFunction = reverseStoppableEventChain;
|
|
if (!defaultFunction) defaultFunction = nop;
|
|
var context = {
|
|
subscribers: [],
|
|
fire: defaultFunction,
|
|
subscribe: function(cb) {
|
|
if (context.subscribers.indexOf(cb) === -1) {
|
|
context.subscribers.push(cb);
|
|
context.fire = chainFunction(context.fire, cb);
|
|
}
|
|
},
|
|
unsubscribe: function(cb) {
|
|
context.subscribers = context.subscribers.filter(function(fn) {
|
|
return fn !== cb;
|
|
});
|
|
context.fire = context.subscribers.reduce(chainFunction, defaultFunction);
|
|
}
|
|
};
|
|
evs[eventName] = rv[eventName] = context;
|
|
return context;
|
|
}
|
|
function addConfiguredEvents(cfg) {
|
|
keys(cfg).forEach(function(eventName) {
|
|
var args = cfg[eventName];
|
|
if (isArray(args)) {
|
|
add(eventName, cfg[eventName][0], cfg[eventName][1]);
|
|
} else if (args === 'asap') {
|
|
var context = add(eventName, mirror, function fire() {
|
|
var i = arguments.length, args = new Array(i);
|
|
while(i--)args[i] = arguments[i];
|
|
context.subscribers.forEach(function(fn) {
|
|
asap$1(function fireEvent() {
|
|
fn.apply(null, args);
|
|
});
|
|
});
|
|
});
|
|
} else throw new exceptions.InvalidArgument("Invalid event config");
|
|
});
|
|
}
|
|
}
|
|
function makeClassConstructor(prototype, constructor) {
|
|
derive(constructor).from({
|
|
prototype: prototype
|
|
});
|
|
return constructor;
|
|
}
|
|
function createTableConstructor(db) {
|
|
return makeClassConstructor(Table.prototype, function Table(name, tableSchema, trans) {
|
|
this.db = db;
|
|
this._tx = trans;
|
|
this.name = name;
|
|
this.schema = tableSchema;
|
|
this.hook = db._allTables[name] ? db._allTables[name].hook : Events(null, {
|
|
"creating": [
|
|
hookCreatingChain,
|
|
nop
|
|
],
|
|
"reading": [
|
|
pureFunctionChain,
|
|
mirror
|
|
],
|
|
"updating": [
|
|
hookUpdatingChain,
|
|
nop
|
|
],
|
|
"deleting": [
|
|
hookDeletingChain,
|
|
nop
|
|
]
|
|
});
|
|
});
|
|
}
|
|
function isPlainKeyRange(ctx, ignoreLimitFilter) {
|
|
return !(ctx.filter || ctx.algorithm || ctx.or) && (ignoreLimitFilter ? ctx.justLimit : !ctx.replayFilter);
|
|
}
|
|
function addFilter(ctx, fn) {
|
|
ctx.filter = combine(ctx.filter, fn);
|
|
}
|
|
function addReplayFilter(ctx, factory, isLimitFilter) {
|
|
var curr = ctx.replayFilter;
|
|
ctx.replayFilter = curr ? function() {
|
|
return combine(curr(), factory());
|
|
} : factory;
|
|
ctx.justLimit = isLimitFilter && !curr;
|
|
}
|
|
function addMatchFilter(ctx, fn) {
|
|
ctx.isMatch = combine(ctx.isMatch, fn);
|
|
}
|
|
function getIndexOrStore(ctx, coreSchema) {
|
|
if (ctx.isPrimKey) return coreSchema.primaryKey;
|
|
var index = coreSchema.getIndexByKeyPath(ctx.index);
|
|
if (!index) throw new exceptions.Schema("KeyPath " + ctx.index + " on object store " + coreSchema.name + " is not indexed");
|
|
return index;
|
|
}
|
|
function openCursor(ctx, coreTable, trans) {
|
|
var index = getIndexOrStore(ctx, coreTable.schema);
|
|
return coreTable.openCursor({
|
|
trans: trans,
|
|
values: !ctx.keysOnly,
|
|
reverse: ctx.dir === 'prev',
|
|
unique: !!ctx.unique,
|
|
query: {
|
|
index: index,
|
|
range: ctx.range
|
|
}
|
|
});
|
|
}
|
|
function iter(ctx, fn, coreTrans, coreTable) {
|
|
var filter = ctx.replayFilter ? combine(ctx.filter, ctx.replayFilter()) : ctx.filter;
|
|
if (!ctx.or) {
|
|
return iterate(openCursor(ctx, coreTable, coreTrans), combine(ctx.algorithm, filter), fn, !ctx.keysOnly && ctx.valueMapper);
|
|
} else {
|
|
var set_1 = {};
|
|
var union = function(item, cursor, advance) {
|
|
if (!filter || filter(cursor, advance, function(result) {
|
|
return cursor.stop(result);
|
|
}, function(err) {
|
|
return cursor.fail(err);
|
|
})) {
|
|
var primaryKey = cursor.primaryKey;
|
|
var key = '' + primaryKey;
|
|
if (key === '[object ArrayBuffer]') key = '' + new Uint8Array(primaryKey);
|
|
if (!hasOwn(set_1, key)) {
|
|
set_1[key] = true;
|
|
fn(item, cursor, advance);
|
|
}
|
|
}
|
|
};
|
|
return Promise.all([
|
|
ctx.or._iterate(union, coreTrans),
|
|
iterate(openCursor(ctx, coreTable, coreTrans), ctx.algorithm, union, !ctx.keysOnly && ctx.valueMapper)
|
|
]);
|
|
}
|
|
}
|
|
function iterate(cursorPromise, filter, fn, valueMapper) {
|
|
var mappedFn = valueMapper ? function(x, c, a) {
|
|
return fn(valueMapper(x), c, a);
|
|
} : fn;
|
|
var wrappedFn = wrap(mappedFn);
|
|
return cursorPromise.then(function(cursor) {
|
|
if (cursor) {
|
|
return cursor.start(function() {
|
|
var c = function() {
|
|
return cursor.continue();
|
|
};
|
|
if (!filter || filter(cursor, function(advancer) {
|
|
return c = advancer;
|
|
}, function(val) {
|
|
cursor.stop(val);
|
|
c = nop;
|
|
}, function(e) {
|
|
cursor.fail(e);
|
|
c = nop;
|
|
})) wrappedFn(cursor.value, cursor, function(advancer) {
|
|
return c = advancer;
|
|
});
|
|
c();
|
|
});
|
|
}
|
|
});
|
|
}
|
|
var Collection = function() {
|
|
function Collection() {}
|
|
Collection.prototype._read = function(fn, cb) {
|
|
var ctx = this._ctx;
|
|
return ctx.error ? ctx.table._trans(null, rejection.bind(null, ctx.error)) : ctx.table._trans('readonly', fn).then(cb);
|
|
};
|
|
Collection.prototype._write = function(fn) {
|
|
var ctx = this._ctx;
|
|
return ctx.error ? ctx.table._trans(null, rejection.bind(null, ctx.error)) : ctx.table._trans('readwrite', fn, "locked");
|
|
};
|
|
Collection.prototype._addAlgorithm = function(fn) {
|
|
var ctx = this._ctx;
|
|
ctx.algorithm = combine(ctx.algorithm, fn);
|
|
};
|
|
Collection.prototype._iterate = function(fn, coreTrans) {
|
|
return iter(this._ctx, fn, coreTrans, this._ctx.table.core);
|
|
};
|
|
Collection.prototype.clone = function(props) {
|
|
var rv = Object.create(this.constructor.prototype), ctx = Object.create(this._ctx);
|
|
if (props) extend(ctx, props);
|
|
rv._ctx = ctx;
|
|
return rv;
|
|
};
|
|
Collection.prototype.raw = function() {
|
|
this._ctx.valueMapper = null;
|
|
return this;
|
|
};
|
|
Collection.prototype.each = function(fn) {
|
|
var ctx = this._ctx;
|
|
return this._read(function(trans) {
|
|
return iter(ctx, fn, trans, ctx.table.core);
|
|
});
|
|
};
|
|
Collection.prototype.count = function(cb) {
|
|
var _this = this;
|
|
return this._read(function(trans) {
|
|
var ctx = _this._ctx;
|
|
var coreTable = ctx.table.core;
|
|
if (isPlainKeyRange(ctx, true)) {
|
|
return coreTable.count({
|
|
trans: trans,
|
|
query: {
|
|
index: getIndexOrStore(ctx, coreTable.schema),
|
|
range: ctx.range
|
|
}
|
|
}).then(function(count) {
|
|
return Math.min(count, ctx.limit);
|
|
});
|
|
} else {
|
|
var count = 0;
|
|
return iter(ctx, function() {
|
|
++count;
|
|
return false;
|
|
}, trans, coreTable).then(function() {
|
|
return count;
|
|
});
|
|
}
|
|
}).then(cb);
|
|
};
|
|
Collection.prototype.sortBy = function(keyPath, cb) {
|
|
var parts = keyPath.split('.').reverse(), lastPart = parts[0], lastIndex = parts.length - 1;
|
|
function getval(obj, i) {
|
|
if (i) return getval(obj[parts[i]], i - 1);
|
|
return obj[lastPart];
|
|
}
|
|
var order = this._ctx.dir === "next" ? 1 : -1;
|
|
function sorter(a, b) {
|
|
var aVal = getval(a, lastIndex), bVal = getval(b, lastIndex);
|
|
return cmp(aVal, bVal) * order;
|
|
}
|
|
return this.toArray(function(a) {
|
|
return a.sort(sorter);
|
|
}).then(cb);
|
|
};
|
|
Collection.prototype.toArray = function(cb) {
|
|
var _this = this;
|
|
return this._read(function(trans) {
|
|
var ctx = _this._ctx;
|
|
if (ctx.dir === 'next' && isPlainKeyRange(ctx, true) && ctx.limit > 0) {
|
|
var valueMapper_1 = ctx.valueMapper;
|
|
var index = getIndexOrStore(ctx, ctx.table.core.schema);
|
|
return ctx.table.core.query({
|
|
trans: trans,
|
|
limit: ctx.limit,
|
|
values: true,
|
|
query: {
|
|
index: index,
|
|
range: ctx.range
|
|
}
|
|
}).then(function(_a) {
|
|
var result = _a.result;
|
|
return valueMapper_1 ? result.map(valueMapper_1) : result;
|
|
});
|
|
} else {
|
|
var a_1 = [];
|
|
return iter(ctx, function(item) {
|
|
return a_1.push(item);
|
|
}, trans, ctx.table.core).then(function() {
|
|
return a_1;
|
|
});
|
|
}
|
|
}, cb);
|
|
};
|
|
Collection.prototype.offset = function(offset) {
|
|
var ctx = this._ctx;
|
|
if (offset <= 0) return this;
|
|
ctx.offset += offset;
|
|
if (isPlainKeyRange(ctx)) {
|
|
addReplayFilter(ctx, function() {
|
|
var offsetLeft = offset;
|
|
return function(cursor, advance) {
|
|
if (offsetLeft === 0) return true;
|
|
if (offsetLeft === 1) {
|
|
--offsetLeft;
|
|
return false;
|
|
}
|
|
advance(function() {
|
|
cursor.advance(offsetLeft);
|
|
offsetLeft = 0;
|
|
});
|
|
return false;
|
|
};
|
|
});
|
|
} else {
|
|
addReplayFilter(ctx, function() {
|
|
var offsetLeft = offset;
|
|
return function() {
|
|
return --offsetLeft < 0;
|
|
};
|
|
});
|
|
}
|
|
return this;
|
|
};
|
|
Collection.prototype.limit = function(numRows) {
|
|
this._ctx.limit = Math.min(this._ctx.limit, numRows);
|
|
addReplayFilter(this._ctx, function() {
|
|
var rowsLeft = numRows;
|
|
return function(cursor, advance, resolve) {
|
|
if (--rowsLeft <= 0) advance(resolve);
|
|
return rowsLeft >= 0;
|
|
};
|
|
}, true);
|
|
return this;
|
|
};
|
|
Collection.prototype.until = function(filterFunction, bIncludeStopEntry) {
|
|
addFilter(this._ctx, function(cursor, advance, resolve) {
|
|
if (filterFunction(cursor.value)) {
|
|
advance(resolve);
|
|
return bIncludeStopEntry;
|
|
} else {
|
|
return true;
|
|
}
|
|
});
|
|
return this;
|
|
};
|
|
Collection.prototype.first = function(cb) {
|
|
return this.limit(1).toArray(function(a) {
|
|
return a[0];
|
|
}).then(cb);
|
|
};
|
|
Collection.prototype.last = function(cb) {
|
|
return this.reverse().first(cb);
|
|
};
|
|
Collection.prototype.filter = function(filterFunction) {
|
|
addFilter(this._ctx, function(cursor) {
|
|
return filterFunction(cursor.value);
|
|
});
|
|
addMatchFilter(this._ctx, filterFunction);
|
|
return this;
|
|
};
|
|
Collection.prototype.and = function(filter) {
|
|
return this.filter(filter);
|
|
};
|
|
Collection.prototype.or = function(indexName) {
|
|
return new this.db.WhereClause(this._ctx.table, indexName, this);
|
|
};
|
|
Collection.prototype.reverse = function() {
|
|
this._ctx.dir = this._ctx.dir === "prev" ? "next" : "prev";
|
|
if (this._ondirectionchange) this._ondirectionchange(this._ctx.dir);
|
|
return this;
|
|
};
|
|
Collection.prototype.desc = function() {
|
|
return this.reverse();
|
|
};
|
|
Collection.prototype.eachKey = function(cb) {
|
|
var ctx = this._ctx;
|
|
ctx.keysOnly = !ctx.isMatch;
|
|
return this.each(function(val, cursor) {
|
|
cb(cursor.key, cursor);
|
|
});
|
|
};
|
|
Collection.prototype.eachUniqueKey = function(cb) {
|
|
this._ctx.unique = "unique";
|
|
return this.eachKey(cb);
|
|
};
|
|
Collection.prototype.eachPrimaryKey = function(cb) {
|
|
var ctx = this._ctx;
|
|
ctx.keysOnly = !ctx.isMatch;
|
|
return this.each(function(val, cursor) {
|
|
cb(cursor.primaryKey, cursor);
|
|
});
|
|
};
|
|
Collection.prototype.keys = function(cb) {
|
|
var ctx = this._ctx;
|
|
ctx.keysOnly = !ctx.isMatch;
|
|
var a = [];
|
|
return this.each(function(item, cursor) {
|
|
a.push(cursor.key);
|
|
}).then(function() {
|
|
return a;
|
|
}).then(cb);
|
|
};
|
|
Collection.prototype.primaryKeys = function(cb) {
|
|
var ctx = this._ctx;
|
|
if (ctx.dir === 'next' && isPlainKeyRange(ctx, true) && ctx.limit > 0) {
|
|
return this._read(function(trans) {
|
|
var index = getIndexOrStore(ctx, ctx.table.core.schema);
|
|
return ctx.table.core.query({
|
|
trans: trans,
|
|
values: false,
|
|
limit: ctx.limit,
|
|
query: {
|
|
index: index,
|
|
range: ctx.range
|
|
}
|
|
});
|
|
}).then(function(_a) {
|
|
var result = _a.result;
|
|
return result;
|
|
}).then(cb);
|
|
}
|
|
ctx.keysOnly = !ctx.isMatch;
|
|
var a = [];
|
|
return this.each(function(item, cursor) {
|
|
a.push(cursor.primaryKey);
|
|
}).then(function() {
|
|
return a;
|
|
}).then(cb);
|
|
};
|
|
Collection.prototype.uniqueKeys = function(cb) {
|
|
this._ctx.unique = "unique";
|
|
return this.keys(cb);
|
|
};
|
|
Collection.prototype.firstKey = function(cb) {
|
|
return this.limit(1).keys(function(a) {
|
|
return a[0];
|
|
}).then(cb);
|
|
};
|
|
Collection.prototype.lastKey = function(cb) {
|
|
return this.reverse().firstKey(cb);
|
|
};
|
|
Collection.prototype.distinct = function() {
|
|
var ctx = this._ctx, idx = ctx.index && ctx.table.schema.idxByName[ctx.index];
|
|
if (!idx || !idx.multi) return this;
|
|
var set = {};
|
|
addFilter(this._ctx, function(cursor) {
|
|
var strKey = cursor.primaryKey.toString();
|
|
var found = hasOwn(set, strKey);
|
|
set[strKey] = true;
|
|
return !found;
|
|
});
|
|
return this;
|
|
};
|
|
Collection.prototype.modify = function(changes) {
|
|
var _this = this;
|
|
var ctx = this._ctx;
|
|
return this._write(function(trans) {
|
|
var modifyer;
|
|
if (typeof changes === 'function') {
|
|
modifyer = changes;
|
|
} else {
|
|
modifyer = function(item) {
|
|
return applyUpdateSpec(item, changes);
|
|
};
|
|
}
|
|
var coreTable = ctx.table.core;
|
|
var _a = coreTable.schema.primaryKey, outbound = _a.outbound, extractKey = _a.extractKey;
|
|
var limit = 200;
|
|
var modifyChunkSize = _this.db._options.modifyChunkSize;
|
|
if (modifyChunkSize) {
|
|
if (typeof modifyChunkSize == 'object') {
|
|
limit = modifyChunkSize[coreTable.name] || modifyChunkSize['*'] || 200;
|
|
} else {
|
|
limit = modifyChunkSize;
|
|
}
|
|
}
|
|
var totalFailures = [];
|
|
var successCount = 0;
|
|
var failedKeys = [];
|
|
var applyMutateResult = function(expectedCount, res) {
|
|
var failures = res.failures, numFailures = res.numFailures;
|
|
successCount += expectedCount - numFailures;
|
|
for(var _i = 0, _a = keys(failures); _i < _a.length; _i++){
|
|
var pos = _a[_i];
|
|
totalFailures.push(failures[pos]);
|
|
}
|
|
};
|
|
var isUnconditionalDelete = changes === deleteCallback;
|
|
return _this.clone().primaryKeys().then(function(keys) {
|
|
var criteria = isPlainKeyRange(ctx) && ctx.limit === Infinity && (typeof changes !== 'function' || isUnconditionalDelete) && {
|
|
index: ctx.index,
|
|
range: ctx.range
|
|
};
|
|
var nextChunk = function(offset) {
|
|
var count = Math.min(limit, keys.length - offset);
|
|
var keysInChunk = keys.slice(offset, offset + count);
|
|
return (isUnconditionalDelete ? Promise.resolve([]) : coreTable.getMany({
|
|
trans: trans,
|
|
keys: keysInChunk,
|
|
cache: "immutable"
|
|
})).then(function(values) {
|
|
var addValues = [];
|
|
var putValues = [];
|
|
var putKeys = outbound ? [] : null;
|
|
var deleteKeys = isUnconditionalDelete ? keysInChunk : [];
|
|
if (!isUnconditionalDelete) for(var i = 0; i < count; ++i){
|
|
var origValue = values[i];
|
|
var ctx_1 = {
|
|
value: deepClone(origValue),
|
|
primKey: keys[offset + i]
|
|
};
|
|
if (modifyer.call(ctx_1, ctx_1.value, ctx_1) !== false) {
|
|
if (ctx_1.value == null) {
|
|
deleteKeys.push(keys[offset + i]);
|
|
} else if (!outbound && cmp(extractKey(origValue), extractKey(ctx_1.value)) !== 0) {
|
|
deleteKeys.push(keys[offset + i]);
|
|
addValues.push(ctx_1.value);
|
|
} else {
|
|
putValues.push(ctx_1.value);
|
|
if (outbound) putKeys.push(keys[offset + i]);
|
|
}
|
|
}
|
|
}
|
|
return Promise.resolve(addValues.length > 0 && coreTable.mutate({
|
|
trans: trans,
|
|
type: 'add',
|
|
values: addValues
|
|
}).then(function(res) {
|
|
for(var pos in res.failures){
|
|
deleteKeys.splice(parseInt(pos), 1);
|
|
}
|
|
applyMutateResult(addValues.length, res);
|
|
})).then(function() {
|
|
return (putValues.length > 0 || criteria && typeof changes === 'object') && coreTable.mutate({
|
|
trans: trans,
|
|
type: 'put',
|
|
keys: putKeys,
|
|
values: putValues,
|
|
criteria: criteria,
|
|
changeSpec: typeof changes !== 'function' && changes,
|
|
isAdditionalChunk: offset > 0
|
|
}).then(function(res) {
|
|
return applyMutateResult(putValues.length, res);
|
|
});
|
|
}).then(function() {
|
|
return (deleteKeys.length > 0 || criteria && isUnconditionalDelete) && coreTable.mutate({
|
|
trans: trans,
|
|
type: 'delete',
|
|
keys: deleteKeys,
|
|
criteria: criteria,
|
|
isAdditionalChunk: offset > 0
|
|
}).then(function(res) {
|
|
return builtInDeletionTrigger(ctx.table, deleteKeys, res);
|
|
}).then(function(res) {
|
|
return applyMutateResult(deleteKeys.length, res);
|
|
});
|
|
}).then(function() {
|
|
return keys.length > offset + count && nextChunk(offset + limit);
|
|
});
|
|
});
|
|
};
|
|
return nextChunk(0).then(function() {
|
|
if (totalFailures.length > 0) throw new ModifyError("Error modifying one or more objects", totalFailures, successCount, failedKeys);
|
|
return keys.length;
|
|
});
|
|
});
|
|
});
|
|
};
|
|
Collection.prototype.delete = function() {
|
|
var ctx = this._ctx, range = ctx.range;
|
|
if (isPlainKeyRange(ctx) && !ctx.table.schema.yProps && (ctx.isPrimKey || range.type === 3)) {
|
|
return this._write(function(trans) {
|
|
var primaryKey = ctx.table.core.schema.primaryKey;
|
|
var coreRange = range;
|
|
return ctx.table.core.count({
|
|
trans: trans,
|
|
query: {
|
|
index: primaryKey,
|
|
range: coreRange
|
|
}
|
|
}).then(function(count) {
|
|
return ctx.table.core.mutate({
|
|
trans: trans,
|
|
type: 'deleteRange',
|
|
range: coreRange
|
|
}).then(function(_a) {
|
|
var failures = _a.failures, numFailures = _a.numFailures;
|
|
if (numFailures) throw new ModifyError("Could not delete some values", Object.keys(failures).map(function(pos) {
|
|
return failures[pos];
|
|
}), count - numFailures);
|
|
return count - numFailures;
|
|
});
|
|
});
|
|
});
|
|
}
|
|
return this.modify(deleteCallback);
|
|
};
|
|
return Collection;
|
|
}();
|
|
var deleteCallback = function(value, ctx) {
|
|
return ctx.value = null;
|
|
};
|
|
function createCollectionConstructor(db) {
|
|
return makeClassConstructor(Collection.prototype, function Collection(whereClause, keyRangeGenerator) {
|
|
this.db = db;
|
|
var keyRange = AnyRange, error = null;
|
|
if (keyRangeGenerator) try {
|
|
keyRange = keyRangeGenerator();
|
|
} catch (ex) {
|
|
error = ex;
|
|
}
|
|
var whereCtx = whereClause._ctx;
|
|
var table = whereCtx.table;
|
|
var readingHook = table.hook.reading.fire;
|
|
this._ctx = {
|
|
table: table,
|
|
index: whereCtx.index,
|
|
isPrimKey: !whereCtx.index || table.schema.primKey.keyPath && whereCtx.index === table.schema.primKey.name,
|
|
range: keyRange,
|
|
keysOnly: false,
|
|
dir: "next",
|
|
unique: "",
|
|
algorithm: null,
|
|
filter: null,
|
|
replayFilter: null,
|
|
justLimit: true,
|
|
isMatch: null,
|
|
offset: 0,
|
|
limit: Infinity,
|
|
error: error,
|
|
or: whereCtx.or,
|
|
valueMapper: readingHook !== mirror ? readingHook : null
|
|
};
|
|
});
|
|
}
|
|
function simpleCompare(a, b) {
|
|
return a < b ? -1 : a === b ? 0 : 1;
|
|
}
|
|
function simpleCompareReverse(a, b) {
|
|
return a > b ? -1 : a === b ? 0 : 1;
|
|
}
|
|
function fail(collectionOrWhereClause, err, T) {
|
|
var collection = collectionOrWhereClause instanceof WhereClause ? new collectionOrWhereClause.Collection(collectionOrWhereClause) : collectionOrWhereClause;
|
|
collection._ctx.error = T ? new T(err) : new TypeError(err);
|
|
return collection;
|
|
}
|
|
function emptyCollection(whereClause) {
|
|
return new whereClause.Collection(whereClause, function() {
|
|
return rangeEqual("");
|
|
}).limit(0);
|
|
}
|
|
function upperFactory(dir) {
|
|
return dir === "next" ? function(s) {
|
|
return s.toUpperCase();
|
|
} : function(s) {
|
|
return s.toLowerCase();
|
|
};
|
|
}
|
|
function lowerFactory(dir) {
|
|
return dir === "next" ? function(s) {
|
|
return s.toLowerCase();
|
|
} : function(s) {
|
|
return s.toUpperCase();
|
|
};
|
|
}
|
|
function nextCasing(key, lowerKey, upperNeedle, lowerNeedle, cmp, dir) {
|
|
var length = Math.min(key.length, lowerNeedle.length);
|
|
var llp = -1;
|
|
for(var i = 0; i < length; ++i){
|
|
var lwrKeyChar = lowerKey[i];
|
|
if (lwrKeyChar !== lowerNeedle[i]) {
|
|
if (cmp(key[i], upperNeedle[i]) < 0) return key.substr(0, i) + upperNeedle[i] + upperNeedle.substr(i + 1);
|
|
if (cmp(key[i], lowerNeedle[i]) < 0) return key.substr(0, i) + lowerNeedle[i] + upperNeedle.substr(i + 1);
|
|
if (llp >= 0) return key.substr(0, llp) + lowerKey[llp] + upperNeedle.substr(llp + 1);
|
|
return null;
|
|
}
|
|
if (cmp(key[i], lwrKeyChar) < 0) llp = i;
|
|
}
|
|
if (length < lowerNeedle.length && dir === "next") return key + upperNeedle.substr(key.length);
|
|
if (length < key.length && dir === "prev") return key.substr(0, upperNeedle.length);
|
|
return llp < 0 ? null : key.substr(0, llp) + lowerNeedle[llp] + upperNeedle.substr(llp + 1);
|
|
}
|
|
function addIgnoreCaseAlgorithm(whereClause, match, needles, suffix) {
|
|
var upper, lower, compare, upperNeedles, lowerNeedles, direction, nextKeySuffix, needlesLen = needles.length;
|
|
if (!needles.every(function(s) {
|
|
return typeof s === 'string';
|
|
})) {
|
|
return fail(whereClause, STRING_EXPECTED);
|
|
}
|
|
function initDirection(dir) {
|
|
upper = upperFactory(dir);
|
|
lower = lowerFactory(dir);
|
|
compare = dir === "next" ? simpleCompare : simpleCompareReverse;
|
|
var needleBounds = needles.map(function(needle) {
|
|
return {
|
|
lower: lower(needle),
|
|
upper: upper(needle)
|
|
};
|
|
}).sort(function(a, b) {
|
|
return compare(a.lower, b.lower);
|
|
});
|
|
upperNeedles = needleBounds.map(function(nb) {
|
|
return nb.upper;
|
|
});
|
|
lowerNeedles = needleBounds.map(function(nb) {
|
|
return nb.lower;
|
|
});
|
|
direction = dir;
|
|
nextKeySuffix = dir === "next" ? "" : suffix;
|
|
}
|
|
initDirection("next");
|
|
var c = new whereClause.Collection(whereClause, function() {
|
|
return createRange(upperNeedles[0], lowerNeedles[needlesLen - 1] + suffix);
|
|
});
|
|
c._ondirectionchange = function(direction) {
|
|
initDirection(direction);
|
|
};
|
|
var firstPossibleNeedle = 0;
|
|
c._addAlgorithm(function(cursor, advance, resolve) {
|
|
var key = cursor.key;
|
|
if (typeof key !== 'string') return false;
|
|
var lowerKey = lower(key);
|
|
if (match(lowerKey, lowerNeedles, firstPossibleNeedle)) {
|
|
return true;
|
|
} else {
|
|
var lowestPossibleCasing = null;
|
|
for(var i = firstPossibleNeedle; i < needlesLen; ++i){
|
|
var casing = nextCasing(key, lowerKey, upperNeedles[i], lowerNeedles[i], compare, direction);
|
|
if (casing === null && lowestPossibleCasing === null) firstPossibleNeedle = i + 1;
|
|
else if (lowestPossibleCasing === null || compare(lowestPossibleCasing, casing) > 0) {
|
|
lowestPossibleCasing = casing;
|
|
}
|
|
}
|
|
if (lowestPossibleCasing !== null) {
|
|
advance(function() {
|
|
cursor.continue(lowestPossibleCasing + nextKeySuffix);
|
|
});
|
|
} else {
|
|
advance(resolve);
|
|
}
|
|
return false;
|
|
}
|
|
});
|
|
return c;
|
|
}
|
|
function createRange(lower, upper, lowerOpen, upperOpen) {
|
|
return {
|
|
type: 2,
|
|
lower: lower,
|
|
upper: upper,
|
|
lowerOpen: lowerOpen,
|
|
upperOpen: upperOpen
|
|
};
|
|
}
|
|
function rangeEqual(value) {
|
|
return {
|
|
type: 1,
|
|
lower: value,
|
|
upper: value
|
|
};
|
|
}
|
|
var WhereClause = function() {
|
|
function WhereClause() {}
|
|
Object.defineProperty(WhereClause.prototype, "Collection", {
|
|
get: function() {
|
|
return this._ctx.table.db.Collection;
|
|
},
|
|
enumerable: false,
|
|
configurable: true
|
|
});
|
|
WhereClause.prototype.between = function(lower, upper, includeLower, includeUpper) {
|
|
includeLower = includeLower !== false;
|
|
includeUpper = includeUpper === true;
|
|
try {
|
|
if (this._cmp(lower, upper) > 0 || this._cmp(lower, upper) === 0 && (includeLower || includeUpper) && !(includeLower && includeUpper)) return emptyCollection(this);
|
|
return new this.Collection(this, function() {
|
|
return createRange(lower, upper, !includeLower, !includeUpper);
|
|
});
|
|
} catch (e) {
|
|
return fail(this, INVALID_KEY_ARGUMENT);
|
|
}
|
|
};
|
|
WhereClause.prototype.equals = function(value) {
|
|
if (value == null) return fail(this, INVALID_KEY_ARGUMENT);
|
|
return new this.Collection(this, function() {
|
|
return rangeEqual(value);
|
|
});
|
|
};
|
|
WhereClause.prototype.above = function(value) {
|
|
if (value == null) return fail(this, INVALID_KEY_ARGUMENT);
|
|
return new this.Collection(this, function() {
|
|
return createRange(value, undefined, true);
|
|
});
|
|
};
|
|
WhereClause.prototype.aboveOrEqual = function(value) {
|
|
if (value == null) return fail(this, INVALID_KEY_ARGUMENT);
|
|
return new this.Collection(this, function() {
|
|
return createRange(value, undefined, false);
|
|
});
|
|
};
|
|
WhereClause.prototype.below = function(value) {
|
|
if (value == null) return fail(this, INVALID_KEY_ARGUMENT);
|
|
return new this.Collection(this, function() {
|
|
return createRange(undefined, value, false, true);
|
|
});
|
|
};
|
|
WhereClause.prototype.belowOrEqual = function(value) {
|
|
if (value == null) return fail(this, INVALID_KEY_ARGUMENT);
|
|
return new this.Collection(this, function() {
|
|
return createRange(undefined, value);
|
|
});
|
|
};
|
|
WhereClause.prototype.startsWith = function(str) {
|
|
if (typeof str !== 'string') return fail(this, STRING_EXPECTED);
|
|
return this.between(str, str + maxString, true, true);
|
|
};
|
|
WhereClause.prototype.startsWithIgnoreCase = function(str) {
|
|
if (str === "") return this.startsWith(str);
|
|
return addIgnoreCaseAlgorithm(this, function(x, a) {
|
|
return x.indexOf(a[0]) === 0;
|
|
}, [
|
|
str
|
|
], maxString);
|
|
};
|
|
WhereClause.prototype.equalsIgnoreCase = function(str) {
|
|
return addIgnoreCaseAlgorithm(this, function(x, a) {
|
|
return x === a[0];
|
|
}, [
|
|
str
|
|
], "");
|
|
};
|
|
WhereClause.prototype.anyOfIgnoreCase = function() {
|
|
var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);
|
|
if (set.length === 0) return emptyCollection(this);
|
|
return addIgnoreCaseAlgorithm(this, function(x, a) {
|
|
return a.indexOf(x) !== -1;
|
|
}, set, "");
|
|
};
|
|
WhereClause.prototype.startsWithAnyOfIgnoreCase = function() {
|
|
var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);
|
|
if (set.length === 0) return emptyCollection(this);
|
|
return addIgnoreCaseAlgorithm(this, function(x, a) {
|
|
return a.some(function(n) {
|
|
return x.indexOf(n) === 0;
|
|
});
|
|
}, set, maxString);
|
|
};
|
|
WhereClause.prototype.anyOf = function() {
|
|
var _this = this;
|
|
var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);
|
|
var compare = this._cmp;
|
|
try {
|
|
set.sort(compare);
|
|
} catch (e) {
|
|
return fail(this, INVALID_KEY_ARGUMENT);
|
|
}
|
|
if (set.length === 0) return emptyCollection(this);
|
|
var c = new this.Collection(this, function() {
|
|
return createRange(set[0], set[set.length - 1]);
|
|
});
|
|
c._ondirectionchange = function(direction) {
|
|
compare = direction === "next" ? _this._ascending : _this._descending;
|
|
set.sort(compare);
|
|
};
|
|
var i = 0;
|
|
c._addAlgorithm(function(cursor, advance, resolve) {
|
|
var key = cursor.key;
|
|
while(compare(key, set[i]) > 0){
|
|
++i;
|
|
if (i === set.length) {
|
|
advance(resolve);
|
|
return false;
|
|
}
|
|
}
|
|
if (compare(key, set[i]) === 0) {
|
|
return true;
|
|
} else {
|
|
advance(function() {
|
|
cursor.continue(set[i]);
|
|
});
|
|
return false;
|
|
}
|
|
});
|
|
return c;
|
|
};
|
|
WhereClause.prototype.notEqual = function(value) {
|
|
return this.inAnyRange([
|
|
[
|
|
minKey,
|
|
value
|
|
],
|
|
[
|
|
value,
|
|
this.db._maxKey
|
|
]
|
|
], {
|
|
includeLowers: false,
|
|
includeUppers: false
|
|
});
|
|
};
|
|
WhereClause.prototype.noneOf = function() {
|
|
var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);
|
|
if (set.length === 0) return new this.Collection(this);
|
|
try {
|
|
set.sort(this._ascending);
|
|
} catch (e) {
|
|
return fail(this, INVALID_KEY_ARGUMENT);
|
|
}
|
|
var ranges = set.reduce(function(res, val) {
|
|
return res ? res.concat([
|
|
[
|
|
res[res.length - 1][1],
|
|
val
|
|
]
|
|
]) : [
|
|
[
|
|
minKey,
|
|
val
|
|
]
|
|
];
|
|
}, null);
|
|
ranges.push([
|
|
set[set.length - 1],
|
|
this.db._maxKey
|
|
]);
|
|
return this.inAnyRange(ranges, {
|
|
includeLowers: false,
|
|
includeUppers: false
|
|
});
|
|
};
|
|
WhereClause.prototype.inAnyRange = function(ranges, options) {
|
|
var _this = this;
|
|
var cmp = this._cmp, ascending = this._ascending, descending = this._descending, min = this._min, max = this._max;
|
|
if (ranges.length === 0) return emptyCollection(this);
|
|
if (!ranges.every(function(range) {
|
|
return range[0] !== undefined && range[1] !== undefined && ascending(range[0], range[1]) <= 0;
|
|
})) {
|
|
return fail(this, "First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower", exceptions.InvalidArgument);
|
|
}
|
|
var includeLowers = !options || options.includeLowers !== false;
|
|
var includeUppers = options && options.includeUppers === true;
|
|
function addRange(ranges, newRange) {
|
|
var i = 0, l = ranges.length;
|
|
for(; i < l; ++i){
|
|
var range = ranges[i];
|
|
if (cmp(newRange[0], range[1]) < 0 && cmp(newRange[1], range[0]) > 0) {
|
|
range[0] = min(range[0], newRange[0]);
|
|
range[1] = max(range[1], newRange[1]);
|
|
break;
|
|
}
|
|
}
|
|
if (i === l) ranges.push(newRange);
|
|
return ranges;
|
|
}
|
|
var sortDirection = ascending;
|
|
function rangeSorter(a, b) {
|
|
return sortDirection(a[0], b[0]);
|
|
}
|
|
var set;
|
|
try {
|
|
set = ranges.reduce(addRange, []);
|
|
set.sort(rangeSorter);
|
|
} catch (ex) {
|
|
return fail(this, INVALID_KEY_ARGUMENT);
|
|
}
|
|
var rangePos = 0;
|
|
var keyIsBeyondCurrentEntry = includeUppers ? function(key) {
|
|
return ascending(key, set[rangePos][1]) > 0;
|
|
} : function(key) {
|
|
return ascending(key, set[rangePos][1]) >= 0;
|
|
};
|
|
var keyIsBeforeCurrentEntry = includeLowers ? function(key) {
|
|
return descending(key, set[rangePos][0]) > 0;
|
|
} : function(key) {
|
|
return descending(key, set[rangePos][0]) >= 0;
|
|
};
|
|
function keyWithinCurrentRange(key) {
|
|
return !keyIsBeyondCurrentEntry(key) && !keyIsBeforeCurrentEntry(key);
|
|
}
|
|
var checkKey = keyIsBeyondCurrentEntry;
|
|
var c = new this.Collection(this, function() {
|
|
return createRange(set[0][0], set[set.length - 1][1], !includeLowers, !includeUppers);
|
|
});
|
|
c._ondirectionchange = function(direction) {
|
|
if (direction === "next") {
|
|
checkKey = keyIsBeyondCurrentEntry;
|
|
sortDirection = ascending;
|
|
} else {
|
|
checkKey = keyIsBeforeCurrentEntry;
|
|
sortDirection = descending;
|
|
}
|
|
set.sort(rangeSorter);
|
|
};
|
|
c._addAlgorithm(function(cursor, advance, resolve) {
|
|
var key = cursor.key;
|
|
while(checkKey(key)){
|
|
++rangePos;
|
|
if (rangePos === set.length) {
|
|
advance(resolve);
|
|
return false;
|
|
}
|
|
}
|
|
if (keyWithinCurrentRange(key)) {
|
|
return true;
|
|
} else if (_this._cmp(key, set[rangePos][1]) === 0 || _this._cmp(key, set[rangePos][0]) === 0) {
|
|
return false;
|
|
} else {
|
|
advance(function() {
|
|
if (sortDirection === ascending) cursor.continue(set[rangePos][0]);
|
|
else cursor.continue(set[rangePos][1]);
|
|
});
|
|
return false;
|
|
}
|
|
});
|
|
return c;
|
|
};
|
|
WhereClause.prototype.startsWithAnyOf = function() {
|
|
var set = getArrayOf.apply(NO_CHAR_ARRAY, arguments);
|
|
if (!set.every(function(s) {
|
|
return typeof s === 'string';
|
|
})) {
|
|
return fail(this, "startsWithAnyOf() only works with strings");
|
|
}
|
|
if (set.length === 0) return emptyCollection(this);
|
|
return this.inAnyRange(set.map(function(str) {
|
|
return [
|
|
str,
|
|
str + maxString
|
|
];
|
|
}));
|
|
};
|
|
return WhereClause;
|
|
}();
|
|
function createWhereClauseConstructor(db) {
|
|
return makeClassConstructor(WhereClause.prototype, function WhereClause(table, index, orCollection) {
|
|
this.db = db;
|
|
this._ctx = {
|
|
table: table,
|
|
index: index === ":id" ? null : index,
|
|
or: orCollection
|
|
};
|
|
this._cmp = this._ascending = cmp;
|
|
this._descending = function(a, b) {
|
|
return cmp(b, a);
|
|
};
|
|
this._max = function(a, b) {
|
|
return cmp(a, b) > 0 ? a : b;
|
|
};
|
|
this._min = function(a, b) {
|
|
return cmp(a, b) < 0 ? a : b;
|
|
};
|
|
this._IDBKeyRange = db._deps.IDBKeyRange;
|
|
if (!this._IDBKeyRange) throw new exceptions.MissingAPI();
|
|
});
|
|
}
|
|
function eventRejectHandler(reject) {
|
|
return wrap(function(event) {
|
|
preventDefault(event);
|
|
reject(event.target.error);
|
|
return false;
|
|
});
|
|
}
|
|
function preventDefault(event) {
|
|
if (event.stopPropagation) event.stopPropagation();
|
|
if (event.preventDefault) event.preventDefault();
|
|
}
|
|
var DEXIE_STORAGE_MUTATED_EVENT_NAME = 'storagemutated';
|
|
var STORAGE_MUTATED_DOM_EVENT_NAME = 'x-storagemutated-1';
|
|
var globalEvents = Events(null, DEXIE_STORAGE_MUTATED_EVENT_NAME);
|
|
var Transaction = function() {
|
|
function Transaction() {}
|
|
Transaction.prototype._lock = function() {
|
|
assert(!PSD.global);
|
|
++this._reculock;
|
|
if (this._reculock === 1 && !PSD.global) PSD.lockOwnerFor = this;
|
|
return this;
|
|
};
|
|
Transaction.prototype._unlock = function() {
|
|
assert(!PSD.global);
|
|
if (--this._reculock === 0) {
|
|
if (!PSD.global) PSD.lockOwnerFor = null;
|
|
while(this._blockedFuncs.length > 0 && !this._locked()){
|
|
var fnAndPSD = this._blockedFuncs.shift();
|
|
try {
|
|
usePSD(fnAndPSD[1], fnAndPSD[0]);
|
|
} catch (e) {}
|
|
}
|
|
}
|
|
return this;
|
|
};
|
|
Transaction.prototype._locked = function() {
|
|
return this._reculock && PSD.lockOwnerFor !== this;
|
|
};
|
|
Transaction.prototype.create = function(idbtrans) {
|
|
var _this = this;
|
|
if (!this.mode) return this;
|
|
var idbdb = this.db.idbdb;
|
|
var dbOpenError = this.db._state.dbOpenError;
|
|
assert(!this.idbtrans);
|
|
if (!idbtrans && !idbdb) {
|
|
switch(dbOpenError && dbOpenError.name){
|
|
case "DatabaseClosedError":
|
|
throw new exceptions.DatabaseClosed(dbOpenError);
|
|
case "MissingAPIError":
|
|
throw new exceptions.MissingAPI(dbOpenError.message, dbOpenError);
|
|
default:
|
|
throw new exceptions.OpenFailed(dbOpenError);
|
|
}
|
|
}
|
|
if (!this.active) throw new exceptions.TransactionInactive();
|
|
assert(this._completion._state === null);
|
|
idbtrans = this.idbtrans = idbtrans || (this.db.core ? this.db.core.transaction(this.storeNames, this.mode, {
|
|
durability: this.chromeTransactionDurability
|
|
}) : idbdb.transaction(this.storeNames, this.mode, {
|
|
durability: this.chromeTransactionDurability
|
|
}));
|
|
idbtrans.onerror = wrap(function(ev) {
|
|
preventDefault(ev);
|
|
_this._reject(idbtrans.error);
|
|
});
|
|
idbtrans.onabort = wrap(function(ev) {
|
|
preventDefault(ev);
|
|
_this.active && _this._reject(new exceptions.Abort(idbtrans.error));
|
|
_this.active = false;
|
|
_this.on("abort").fire(ev);
|
|
});
|
|
idbtrans.oncomplete = wrap(function() {
|
|
_this.active = false;
|
|
_this._resolve();
|
|
if ('mutatedParts' in idbtrans) {
|
|
globalEvents.storagemutated.fire(idbtrans["mutatedParts"]);
|
|
}
|
|
});
|
|
return this;
|
|
};
|
|
Transaction.prototype._promise = function(mode, fn, bWriteLock) {
|
|
var _this = this;
|
|
if (mode === 'readwrite' && this.mode !== 'readwrite') return rejection(new exceptions.ReadOnly("Transaction is readonly"));
|
|
if (!this.active) return rejection(new exceptions.TransactionInactive());
|
|
if (this._locked()) {
|
|
return new DexiePromise(function(resolve, reject) {
|
|
_this._blockedFuncs.push([
|
|
function() {
|
|
_this._promise(mode, fn, bWriteLock).then(resolve, reject);
|
|
},
|
|
PSD
|
|
]);
|
|
});
|
|
} else if (bWriteLock) {
|
|
return newScope(function() {
|
|
var p = new DexiePromise(function(resolve, reject) {
|
|
_this._lock();
|
|
var rv = fn(resolve, reject, _this);
|
|
if (rv && rv.then) rv.then(resolve, reject);
|
|
});
|
|
p.finally(function() {
|
|
return _this._unlock();
|
|
});
|
|
p._lib = true;
|
|
return p;
|
|
});
|
|
} else {
|
|
var p = new DexiePromise(function(resolve, reject) {
|
|
var rv = fn(resolve, reject, _this);
|
|
if (rv && rv.then) rv.then(resolve, reject);
|
|
});
|
|
p._lib = true;
|
|
return p;
|
|
}
|
|
};
|
|
Transaction.prototype._root = function() {
|
|
return this.parent ? this.parent._root() : this;
|
|
};
|
|
Transaction.prototype.waitFor = function(promiseLike) {
|
|
var root = this._root();
|
|
var promise = DexiePromise.resolve(promiseLike);
|
|
if (root._waitingFor) {
|
|
root._waitingFor = root._waitingFor.then(function() {
|
|
return promise;
|
|
});
|
|
} else {
|
|
root._waitingFor = promise;
|
|
root._waitingQueue = [];
|
|
var store = root.idbtrans.objectStore(root.storeNames[0]);
|
|
(function spin() {
|
|
++root._spinCount;
|
|
while(root._waitingQueue.length)root._waitingQueue.shift()();
|
|
if (root._waitingFor) store.get(-Infinity).onsuccess = spin;
|
|
})();
|
|
}
|
|
var currentWaitPromise = root._waitingFor;
|
|
return new DexiePromise(function(resolve, reject) {
|
|
promise.then(function(res) {
|
|
return root._waitingQueue.push(wrap(resolve.bind(null, res)));
|
|
}, function(err) {
|
|
return root._waitingQueue.push(wrap(reject.bind(null, err)));
|
|
}).finally(function() {
|
|
if (root._waitingFor === currentWaitPromise) {
|
|
root._waitingFor = null;
|
|
}
|
|
});
|
|
});
|
|
};
|
|
Transaction.prototype.abort = function() {
|
|
if (this.active) {
|
|
this.active = false;
|
|
if (this.idbtrans) this.idbtrans.abort();
|
|
this._reject(new exceptions.Abort());
|
|
}
|
|
};
|
|
Transaction.prototype.table = function(tableName) {
|
|
var memoizedTables = this._memoizedTables || (this._memoizedTables = {});
|
|
if (hasOwn(memoizedTables, tableName)) return memoizedTables[tableName];
|
|
var tableSchema = this.schema[tableName];
|
|
if (!tableSchema) {
|
|
throw new exceptions.NotFound("Table " + tableName + " not part of transaction");
|
|
}
|
|
var transactionBoundTable = new this.db.Table(tableName, tableSchema, this);
|
|
transactionBoundTable.core = this.db.core.table(tableName);
|
|
memoizedTables[tableName] = transactionBoundTable;
|
|
return transactionBoundTable;
|
|
};
|
|
return Transaction;
|
|
}();
|
|
function createTransactionConstructor(db) {
|
|
return makeClassConstructor(Transaction.prototype, function Transaction(mode, storeNames, dbschema, chromeTransactionDurability, parent) {
|
|
var _this = this;
|
|
if (mode !== 'readonly') storeNames.forEach(function(storeName) {
|
|
var _a;
|
|
var yProps = (_a = dbschema[storeName]) === null || _a === void 0 ? void 0 : _a.yProps;
|
|
if (yProps) storeNames = storeNames.concat(yProps.map(function(p) {
|
|
return p.updatesTable;
|
|
}));
|
|
});
|
|
this.db = db;
|
|
this.mode = mode;
|
|
this.storeNames = storeNames;
|
|
this.schema = dbschema;
|
|
this.chromeTransactionDurability = chromeTransactionDurability;
|
|
this.idbtrans = null;
|
|
this.on = Events(this, "complete", "error", "abort");
|
|
this.parent = parent || null;
|
|
this.active = true;
|
|
this._reculock = 0;
|
|
this._blockedFuncs = [];
|
|
this._resolve = null;
|
|
this._reject = null;
|
|
this._waitingFor = null;
|
|
this._waitingQueue = null;
|
|
this._spinCount = 0;
|
|
this._completion = new DexiePromise(function(resolve, reject) {
|
|
_this._resolve = resolve;
|
|
_this._reject = reject;
|
|
});
|
|
this._completion.then(function() {
|
|
_this.active = false;
|
|
_this.on.complete.fire();
|
|
}, function(e) {
|
|
var wasActive = _this.active;
|
|
_this.active = false;
|
|
_this.on.error.fire(e);
|
|
_this.parent ? _this.parent._reject(e) : wasActive && _this.idbtrans && _this.idbtrans.abort();
|
|
return rejection(e);
|
|
});
|
|
});
|
|
}
|
|
function createIndexSpec(name, keyPath, unique, multi, auto, compound, isPrimKey, type) {
|
|
return {
|
|
name: name,
|
|
keyPath: keyPath,
|
|
unique: unique,
|
|
multi: multi,
|
|
auto: auto,
|
|
compound: compound,
|
|
src: (unique && !isPrimKey ? '&' : '') + (multi ? '*' : '') + (auto ? "++" : "") + nameFromKeyPath(keyPath),
|
|
type: type
|
|
};
|
|
}
|
|
function nameFromKeyPath(keyPath) {
|
|
return typeof keyPath === 'string' ? keyPath : keyPath ? '[' + [].join.call(keyPath, '+') + ']' : "";
|
|
}
|
|
function createTableSchema(name, primKey, indexes) {
|
|
return {
|
|
name: name,
|
|
primKey: primKey,
|
|
indexes: indexes,
|
|
mappedClass: null,
|
|
idxByName: arrayToObject(indexes, function(index) {
|
|
return [
|
|
index.name,
|
|
index
|
|
];
|
|
})
|
|
};
|
|
}
|
|
function safariMultiStoreFix(storeNames) {
|
|
return storeNames.length === 1 ? storeNames[0] : storeNames;
|
|
}
|
|
var getMaxKey = function(IdbKeyRange) {
|
|
try {
|
|
IdbKeyRange.only([
|
|
[]
|
|
]);
|
|
getMaxKey = function() {
|
|
return [
|
|
[]
|
|
];
|
|
};
|
|
return [
|
|
[]
|
|
];
|
|
} catch (e) {
|
|
getMaxKey = function() {
|
|
return maxString;
|
|
};
|
|
return maxString;
|
|
}
|
|
};
|
|
function getKeyExtractor(keyPath) {
|
|
if (keyPath == null) {
|
|
return function() {
|
|
return undefined;
|
|
};
|
|
} else if (typeof keyPath === 'string') {
|
|
return getSinglePathKeyExtractor(keyPath);
|
|
} else {
|
|
return function(obj) {
|
|
return getByKeyPath(obj, keyPath);
|
|
};
|
|
}
|
|
}
|
|
function getSinglePathKeyExtractor(keyPath) {
|
|
var split = keyPath.split('.');
|
|
if (split.length === 1) {
|
|
return function(obj) {
|
|
return obj[keyPath];
|
|
};
|
|
} else {
|
|
return function(obj) {
|
|
return getByKeyPath(obj, keyPath);
|
|
};
|
|
}
|
|
}
|
|
function arrayify(arrayLike) {
|
|
return [].slice.call(arrayLike);
|
|
}
|
|
var _id_counter = 0;
|
|
function getKeyPathAlias(keyPath) {
|
|
return keyPath == null ? ":id" : typeof keyPath === 'string' ? keyPath : "[".concat(keyPath.join('+'), "]");
|
|
}
|
|
function createDBCore(db, IdbKeyRange, tmpTrans) {
|
|
function extractSchema(db, trans) {
|
|
var tables = arrayify(db.objectStoreNames);
|
|
return {
|
|
schema: {
|
|
name: db.name,
|
|
tables: tables.map(function(table) {
|
|
return trans.objectStore(table);
|
|
}).map(function(store) {
|
|
var keyPath = store.keyPath, autoIncrement = store.autoIncrement;
|
|
var compound = isArray(keyPath);
|
|
var outbound = keyPath == null;
|
|
var indexByKeyPath = {};
|
|
var result = {
|
|
name: store.name,
|
|
primaryKey: {
|
|
name: null,
|
|
isPrimaryKey: true,
|
|
outbound: outbound,
|
|
compound: compound,
|
|
keyPath: keyPath,
|
|
autoIncrement: autoIncrement,
|
|
unique: true,
|
|
extractKey: getKeyExtractor(keyPath)
|
|
},
|
|
indexes: arrayify(store.indexNames).map(function(indexName) {
|
|
return store.index(indexName);
|
|
}).map(function(index) {
|
|
var name = index.name, unique = index.unique, multiEntry = index.multiEntry, keyPath = index.keyPath;
|
|
var compound = isArray(keyPath);
|
|
var result = {
|
|
name: name,
|
|
compound: compound,
|
|
keyPath: keyPath,
|
|
unique: unique,
|
|
multiEntry: multiEntry,
|
|
extractKey: getKeyExtractor(keyPath)
|
|
};
|
|
indexByKeyPath[getKeyPathAlias(keyPath)] = result;
|
|
return result;
|
|
}),
|
|
getIndexByKeyPath: function(keyPath) {
|
|
return indexByKeyPath[getKeyPathAlias(keyPath)];
|
|
}
|
|
};
|
|
indexByKeyPath[":id"] = result.primaryKey;
|
|
if (keyPath != null) {
|
|
indexByKeyPath[getKeyPathAlias(keyPath)] = result.primaryKey;
|
|
}
|
|
return result;
|
|
})
|
|
},
|
|
hasGetAll: tables.length > 0 && 'getAll' in trans.objectStore(tables[0]) && !(typeof navigator !== 'undefined' && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604)
|
|
};
|
|
}
|
|
function makeIDBKeyRange(range) {
|
|
if (range.type === 3) return null;
|
|
if (range.type === 4) throw new Error("Cannot convert never type to IDBKeyRange");
|
|
var lower = range.lower, upper = range.upper, lowerOpen = range.lowerOpen, upperOpen = range.upperOpen;
|
|
var idbRange = lower === undefined ? upper === undefined ? null : IdbKeyRange.upperBound(upper, !!upperOpen) : upper === undefined ? IdbKeyRange.lowerBound(lower, !!lowerOpen) : IdbKeyRange.bound(lower, upper, !!lowerOpen, !!upperOpen);
|
|
return idbRange;
|
|
}
|
|
function createDbCoreTable(tableSchema) {
|
|
var tableName = tableSchema.name;
|
|
function mutate(_a) {
|
|
var trans = _a.trans, type = _a.type, keys = _a.keys, values = _a.values, range = _a.range;
|
|
return new Promise(function(resolve, reject) {
|
|
resolve = wrap(resolve);
|
|
var store = trans.objectStore(tableName);
|
|
var outbound = store.keyPath == null;
|
|
var isAddOrPut = type === "put" || type === "add";
|
|
if (!isAddOrPut && type !== 'delete' && type !== 'deleteRange') throw new Error("Invalid operation type: " + type);
|
|
var length = (keys || values || {
|
|
length: 1
|
|
}).length;
|
|
if (keys && values && keys.length !== values.length) {
|
|
throw new Error("Given keys array must have same length as given values array.");
|
|
}
|
|
if (length === 0) return resolve({
|
|
numFailures: 0,
|
|
failures: {},
|
|
results: [],
|
|
lastResult: undefined
|
|
});
|
|
var req;
|
|
var reqs = [];
|
|
var failures = [];
|
|
var numFailures = 0;
|
|
var errorHandler = function(event) {
|
|
++numFailures;
|
|
preventDefault(event);
|
|
};
|
|
if (type === 'deleteRange') {
|
|
if (range.type === 4) return resolve({
|
|
numFailures: numFailures,
|
|
failures: failures,
|
|
results: [],
|
|
lastResult: undefined
|
|
});
|
|
if (range.type === 3) reqs.push(req = store.clear());
|
|
else reqs.push(req = store.delete(makeIDBKeyRange(range)));
|
|
} else {
|
|
var _a = isAddOrPut ? outbound ? [
|
|
values,
|
|
keys
|
|
] : [
|
|
values,
|
|
null
|
|
] : [
|
|
keys,
|
|
null
|
|
], args1 = _a[0], args2 = _a[1];
|
|
if (isAddOrPut) {
|
|
for(var i = 0; i < length; ++i){
|
|
reqs.push(req = args2 && args2[i] !== undefined ? store[type](args1[i], args2[i]) : store[type](args1[i]));
|
|
req.onerror = errorHandler;
|
|
}
|
|
} else {
|
|
for(var i = 0; i < length; ++i){
|
|
reqs.push(req = store[type](args1[i]));
|
|
req.onerror = errorHandler;
|
|
}
|
|
}
|
|
}
|
|
var done = function(event) {
|
|
var lastResult = event.target.result;
|
|
reqs.forEach(function(req, i) {
|
|
return req.error != null && (failures[i] = req.error);
|
|
});
|
|
resolve({
|
|
numFailures: numFailures,
|
|
failures: failures,
|
|
results: type === "delete" ? keys : reqs.map(function(req) {
|
|
return req.result;
|
|
}),
|
|
lastResult: lastResult
|
|
});
|
|
};
|
|
req.onerror = function(event) {
|
|
errorHandler(event);
|
|
done(event);
|
|
};
|
|
req.onsuccess = done;
|
|
});
|
|
}
|
|
function openCursor(_a) {
|
|
var trans = _a.trans, values = _a.values, query = _a.query, reverse = _a.reverse, unique = _a.unique;
|
|
return new Promise(function(resolve, reject) {
|
|
resolve = wrap(resolve);
|
|
var index = query.index, range = query.range;
|
|
var store = trans.objectStore(tableName);
|
|
var source = index.isPrimaryKey ? store : store.index(index.name);
|
|
var direction = reverse ? unique ? "prevunique" : "prev" : unique ? "nextunique" : "next";
|
|
var req = values || !('openKeyCursor' in source) ? source.openCursor(makeIDBKeyRange(range), direction) : source.openKeyCursor(makeIDBKeyRange(range), direction);
|
|
req.onerror = eventRejectHandler(reject);
|
|
req.onsuccess = wrap(function(ev) {
|
|
var cursor = req.result;
|
|
if (!cursor) {
|
|
resolve(null);
|
|
return;
|
|
}
|
|
cursor.___id = ++_id_counter;
|
|
cursor.done = false;
|
|
var _cursorContinue = cursor.continue.bind(cursor);
|
|
var _cursorContinuePrimaryKey = cursor.continuePrimaryKey;
|
|
if (_cursorContinuePrimaryKey) _cursorContinuePrimaryKey = _cursorContinuePrimaryKey.bind(cursor);
|
|
var _cursorAdvance = cursor.advance.bind(cursor);
|
|
var doThrowCursorIsNotStarted = function() {
|
|
throw new Error("Cursor not started");
|
|
};
|
|
var doThrowCursorIsStopped = function() {
|
|
throw new Error("Cursor not stopped");
|
|
};
|
|
cursor.trans = trans;
|
|
cursor.stop = cursor.continue = cursor.continuePrimaryKey = cursor.advance = doThrowCursorIsNotStarted;
|
|
cursor.fail = wrap(reject);
|
|
cursor.next = function() {
|
|
var _this = this;
|
|
var gotOne = 1;
|
|
return this.start(function() {
|
|
return gotOne-- ? _this.continue() : _this.stop();
|
|
}).then(function() {
|
|
return _this;
|
|
});
|
|
};
|
|
cursor.start = function(callback) {
|
|
var iterationPromise = new Promise(function(resolveIteration, rejectIteration) {
|
|
resolveIteration = wrap(resolveIteration);
|
|
req.onerror = eventRejectHandler(rejectIteration);
|
|
cursor.fail = rejectIteration;
|
|
cursor.stop = function(value) {
|
|
cursor.stop = cursor.continue = cursor.continuePrimaryKey = cursor.advance = doThrowCursorIsStopped;
|
|
resolveIteration(value);
|
|
};
|
|
});
|
|
var guardedCallback = function() {
|
|
if (req.result) {
|
|
try {
|
|
callback();
|
|
} catch (err) {
|
|
cursor.fail(err);
|
|
}
|
|
} else {
|
|
cursor.done = true;
|
|
cursor.start = function() {
|
|
throw new Error("Cursor behind last entry");
|
|
};
|
|
cursor.stop();
|
|
}
|
|
};
|
|
req.onsuccess = wrap(function(ev) {
|
|
req.onsuccess = guardedCallback;
|
|
guardedCallback();
|
|
});
|
|
cursor.continue = _cursorContinue;
|
|
cursor.continuePrimaryKey = _cursorContinuePrimaryKey;
|
|
cursor.advance = _cursorAdvance;
|
|
guardedCallback();
|
|
return iterationPromise;
|
|
};
|
|
resolve(cursor);
|
|
}, reject);
|
|
});
|
|
}
|
|
function query(hasGetAll) {
|
|
return function(request) {
|
|
return new Promise(function(resolve, reject) {
|
|
resolve = wrap(resolve);
|
|
var trans = request.trans, values = request.values, limit = request.limit, query = request.query;
|
|
var nonInfinitLimit = limit === Infinity ? undefined : limit;
|
|
var index = query.index, range = query.range;
|
|
var store = trans.objectStore(tableName);
|
|
var source = index.isPrimaryKey ? store : store.index(index.name);
|
|
var idbKeyRange = makeIDBKeyRange(range);
|
|
if (limit === 0) return resolve({
|
|
result: []
|
|
});
|
|
if (hasGetAll) {
|
|
var req = values ? source.getAll(idbKeyRange, nonInfinitLimit) : source.getAllKeys(idbKeyRange, nonInfinitLimit);
|
|
req.onsuccess = function(event) {
|
|
return resolve({
|
|
result: event.target.result
|
|
});
|
|
};
|
|
req.onerror = eventRejectHandler(reject);
|
|
} else {
|
|
var count_1 = 0;
|
|
var req_1 = values || !('openKeyCursor' in source) ? source.openCursor(idbKeyRange) : source.openKeyCursor(idbKeyRange);
|
|
var result_1 = [];
|
|
req_1.onsuccess = function(event) {
|
|
var cursor = req_1.result;
|
|
if (!cursor) return resolve({
|
|
result: result_1
|
|
});
|
|
result_1.push(values ? cursor.value : cursor.primaryKey);
|
|
if (++count_1 === limit) return resolve({
|
|
result: result_1
|
|
});
|
|
cursor.continue();
|
|
};
|
|
req_1.onerror = eventRejectHandler(reject);
|
|
}
|
|
});
|
|
};
|
|
}
|
|
return {
|
|
name: tableName,
|
|
schema: tableSchema,
|
|
mutate: mutate,
|
|
getMany: function(_a) {
|
|
var trans = _a.trans, keys = _a.keys;
|
|
return new Promise(function(resolve, reject) {
|
|
resolve = wrap(resolve);
|
|
var store = trans.objectStore(tableName);
|
|
var length = keys.length;
|
|
var result = new Array(length);
|
|
var keyCount = 0;
|
|
var callbackCount = 0;
|
|
var req;
|
|
var successHandler = function(event) {
|
|
var req = event.target;
|
|
if ((result[req._pos] = req.result) != null) ;
|
|
if (++callbackCount === keyCount) resolve(result);
|
|
};
|
|
var errorHandler = eventRejectHandler(reject);
|
|
for(var i = 0; i < length; ++i){
|
|
var key = keys[i];
|
|
if (key != null) {
|
|
req = store.get(keys[i]);
|
|
req._pos = i;
|
|
req.onsuccess = successHandler;
|
|
req.onerror = errorHandler;
|
|
++keyCount;
|
|
}
|
|
}
|
|
if (keyCount === 0) resolve(result);
|
|
});
|
|
},
|
|
get: function(_a) {
|
|
var trans = _a.trans, key = _a.key;
|
|
return new Promise(function(resolve, reject) {
|
|
resolve = wrap(resolve);
|
|
var store = trans.objectStore(tableName);
|
|
var req = store.get(key);
|
|
req.onsuccess = function(event) {
|
|
return resolve(event.target.result);
|
|
};
|
|
req.onerror = eventRejectHandler(reject);
|
|
});
|
|
},
|
|
query: query(hasGetAll),
|
|
openCursor: openCursor,
|
|
count: function(_a) {
|
|
var query = _a.query, trans = _a.trans;
|
|
var index = query.index, range = query.range;
|
|
return new Promise(function(resolve, reject) {
|
|
var store = trans.objectStore(tableName);
|
|
var source = index.isPrimaryKey ? store : store.index(index.name);
|
|
var idbKeyRange = makeIDBKeyRange(range);
|
|
var req = idbKeyRange ? source.count(idbKeyRange) : source.count();
|
|
req.onsuccess = wrap(function(ev) {
|
|
return resolve(ev.target.result);
|
|
});
|
|
req.onerror = eventRejectHandler(reject);
|
|
});
|
|
}
|
|
};
|
|
}
|
|
var _a = extractSchema(db, tmpTrans), schema = _a.schema, hasGetAll = _a.hasGetAll;
|
|
var tables = schema.tables.map(function(tableSchema) {
|
|
return createDbCoreTable(tableSchema);
|
|
});
|
|
var tableMap = {};
|
|
tables.forEach(function(table) {
|
|
return tableMap[table.name] = table;
|
|
});
|
|
return {
|
|
stack: "dbcore",
|
|
transaction: db.transaction.bind(db),
|
|
table: function(name) {
|
|
var result = tableMap[name];
|
|
if (!result) throw new Error("Table '".concat(name, "' not found"));
|
|
return tableMap[name];
|
|
},
|
|
MIN_KEY: -Infinity,
|
|
MAX_KEY: getMaxKey(IdbKeyRange),
|
|
schema: schema
|
|
};
|
|
}
|
|
function createMiddlewareStack(stackImpl, middlewares) {
|
|
return middlewares.reduce(function(down, _a) {
|
|
var create = _a.create;
|
|
return __assign(__assign({}, down), create(down));
|
|
}, stackImpl);
|
|
}
|
|
function createMiddlewareStacks(middlewares, idbdb, _a, tmpTrans) {
|
|
var IDBKeyRange = _a.IDBKeyRange;
|
|
_a.indexedDB;
|
|
var dbcore = createMiddlewareStack(createDBCore(idbdb, IDBKeyRange, tmpTrans), middlewares.dbcore);
|
|
return {
|
|
dbcore: dbcore
|
|
};
|
|
}
|
|
function generateMiddlewareStacks(db, tmpTrans) {
|
|
var idbdb = tmpTrans.db;
|
|
var stacks = createMiddlewareStacks(db._middlewares, idbdb, db._deps, tmpTrans);
|
|
db.core = stacks.dbcore;
|
|
db.tables.forEach(function(table) {
|
|
var tableName = table.name;
|
|
if (db.core.schema.tables.some(function(tbl) {
|
|
return tbl.name === tableName;
|
|
})) {
|
|
table.core = db.core.table(tableName);
|
|
if (db[tableName] instanceof db.Table) {
|
|
db[tableName].core = table.core;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
function setApiOnPlace(db, objs, tableNames, dbschema) {
|
|
tableNames.forEach(function(tableName) {
|
|
var schema = dbschema[tableName];
|
|
objs.forEach(function(obj) {
|
|
var propDesc = getPropertyDescriptor(obj, tableName);
|
|
if (!propDesc || "value" in propDesc && propDesc.value === undefined) {
|
|
if (obj === db.Transaction.prototype || obj instanceof db.Transaction) {
|
|
setProp(obj, tableName, {
|
|
get: function() {
|
|
return this.table(tableName);
|
|
},
|
|
set: function(value) {
|
|
defineProperty(this, tableName, {
|
|
value: value,
|
|
writable: true,
|
|
configurable: true,
|
|
enumerable: true
|
|
});
|
|
}
|
|
});
|
|
} else {
|
|
obj[tableName] = new db.Table(tableName, schema);
|
|
}
|
|
}
|
|
});
|
|
});
|
|
}
|
|
function removeTablesApi(db, objs) {
|
|
objs.forEach(function(obj) {
|
|
for(var key in obj){
|
|
if (obj[key] instanceof db.Table) delete obj[key];
|
|
}
|
|
});
|
|
}
|
|
function lowerVersionFirst(a, b) {
|
|
return a._cfg.version - b._cfg.version;
|
|
}
|
|
function runUpgraders(db, oldVersion, idbUpgradeTrans, reject) {
|
|
var globalSchema = db._dbSchema;
|
|
if (idbUpgradeTrans.objectStoreNames.contains('$meta') && !globalSchema.$meta) {
|
|
globalSchema.$meta = createTableSchema("$meta", parseIndexSyntax("")[0], []);
|
|
db._storeNames.push('$meta');
|
|
}
|
|
var trans = db._createTransaction('readwrite', db._storeNames, globalSchema);
|
|
trans.create(idbUpgradeTrans);
|
|
trans._completion.catch(reject);
|
|
var rejectTransaction = trans._reject.bind(trans);
|
|
var transless = PSD.transless || PSD;
|
|
newScope(function() {
|
|
PSD.trans = trans;
|
|
PSD.transless = transless;
|
|
if (oldVersion === 0) {
|
|
keys(globalSchema).forEach(function(tableName) {
|
|
createTable(idbUpgradeTrans, tableName, globalSchema[tableName].primKey, globalSchema[tableName].indexes);
|
|
});
|
|
generateMiddlewareStacks(db, idbUpgradeTrans);
|
|
DexiePromise.follow(function() {
|
|
return db.on.populate.fire(trans);
|
|
}).catch(rejectTransaction);
|
|
} else {
|
|
generateMiddlewareStacks(db, idbUpgradeTrans);
|
|
return getExistingVersion(db, trans, oldVersion).then(function(oldVersion) {
|
|
return updateTablesAndIndexes(db, oldVersion, trans, idbUpgradeTrans);
|
|
}).catch(rejectTransaction);
|
|
}
|
|
});
|
|
}
|
|
function patchCurrentVersion(db, idbUpgradeTrans) {
|
|
createMissingTables(db._dbSchema, idbUpgradeTrans);
|
|
if (idbUpgradeTrans.db.version % 10 === 0 && !idbUpgradeTrans.objectStoreNames.contains('$meta')) {
|
|
idbUpgradeTrans.db.createObjectStore('$meta').add(Math.ceil(idbUpgradeTrans.db.version / 10 - 1), 'version');
|
|
}
|
|
var globalSchema = buildGlobalSchema(db, db.idbdb, idbUpgradeTrans);
|
|
adjustToExistingIndexNames(db, db._dbSchema, idbUpgradeTrans);
|
|
var diff = getSchemaDiff(globalSchema, db._dbSchema);
|
|
var _loop_1 = function(tableChange) {
|
|
if (tableChange.change.length || tableChange.recreate) {
|
|
console.warn("Unable to patch indexes of table ".concat(tableChange.name, " because it has changes on the type of index or primary key."));
|
|
return {
|
|
value: void 0
|
|
};
|
|
}
|
|
var store = idbUpgradeTrans.objectStore(tableChange.name);
|
|
tableChange.add.forEach(function(idx) {
|
|
if (debug) console.debug("Dexie upgrade patch: Creating missing index ".concat(tableChange.name, ".").concat(idx.src));
|
|
addIndex(store, idx);
|
|
});
|
|
};
|
|
for(var _i = 0, _a = diff.change; _i < _a.length; _i++){
|
|
var tableChange = _a[_i];
|
|
var state_1 = _loop_1(tableChange);
|
|
if (typeof state_1 === "object") return state_1.value;
|
|
}
|
|
}
|
|
function getExistingVersion(db, trans, oldVersion) {
|
|
if (trans.storeNames.includes('$meta')) {
|
|
return trans.table('$meta').get('version').then(function(metaVersion) {
|
|
return metaVersion != null ? metaVersion : oldVersion;
|
|
});
|
|
} else {
|
|
return DexiePromise.resolve(oldVersion);
|
|
}
|
|
}
|
|
function updateTablesAndIndexes(db, oldVersion, trans, idbUpgradeTrans) {
|
|
var queue = [];
|
|
var versions = db._versions;
|
|
var globalSchema = db._dbSchema = buildGlobalSchema(db, db.idbdb, idbUpgradeTrans);
|
|
var versToRun = versions.filter(function(v) {
|
|
return v._cfg.version >= oldVersion;
|
|
});
|
|
if (versToRun.length === 0) {
|
|
return DexiePromise.resolve();
|
|
}
|
|
versToRun.forEach(function(version) {
|
|
queue.push(function() {
|
|
var oldSchema = globalSchema;
|
|
var newSchema = version._cfg.dbschema;
|
|
adjustToExistingIndexNames(db, oldSchema, idbUpgradeTrans);
|
|
adjustToExistingIndexNames(db, newSchema, idbUpgradeTrans);
|
|
globalSchema = db._dbSchema = newSchema;
|
|
var diff = getSchemaDiff(oldSchema, newSchema);
|
|
diff.add.forEach(function(tuple) {
|
|
createTable(idbUpgradeTrans, tuple[0], tuple[1].primKey, tuple[1].indexes);
|
|
});
|
|
diff.change.forEach(function(change) {
|
|
if (change.recreate) {
|
|
throw new exceptions.Upgrade("Not yet support for changing primary key");
|
|
} else {
|
|
var store_1 = idbUpgradeTrans.objectStore(change.name);
|
|
change.add.forEach(function(idx) {
|
|
return addIndex(store_1, idx);
|
|
});
|
|
change.change.forEach(function(idx) {
|
|
store_1.deleteIndex(idx.name);
|
|
addIndex(store_1, idx);
|
|
});
|
|
change.del.forEach(function(idxName) {
|
|
return store_1.deleteIndex(idxName);
|
|
});
|
|
}
|
|
});
|
|
var contentUpgrade = version._cfg.contentUpgrade;
|
|
if (contentUpgrade && version._cfg.version > oldVersion) {
|
|
generateMiddlewareStacks(db, idbUpgradeTrans);
|
|
trans._memoizedTables = {};
|
|
var upgradeSchema_1 = shallowClone(newSchema);
|
|
diff.del.forEach(function(table) {
|
|
upgradeSchema_1[table] = oldSchema[table];
|
|
});
|
|
removeTablesApi(db, [
|
|
db.Transaction.prototype
|
|
]);
|
|
setApiOnPlace(db, [
|
|
db.Transaction.prototype
|
|
], keys(upgradeSchema_1), upgradeSchema_1);
|
|
trans.schema = upgradeSchema_1;
|
|
var contentUpgradeIsAsync_1 = isAsyncFunction(contentUpgrade);
|
|
if (contentUpgradeIsAsync_1) {
|
|
incrementExpectedAwaits();
|
|
}
|
|
var returnValue_1;
|
|
var promiseFollowed = DexiePromise.follow(function() {
|
|
returnValue_1 = contentUpgrade(trans);
|
|
if (returnValue_1) {
|
|
if (contentUpgradeIsAsync_1) {
|
|
var decrementor = decrementExpectedAwaits.bind(null, null);
|
|
returnValue_1.then(decrementor, decrementor);
|
|
}
|
|
}
|
|
});
|
|
return returnValue_1 && typeof returnValue_1.then === 'function' ? DexiePromise.resolve(returnValue_1) : promiseFollowed.then(function() {
|
|
return returnValue_1;
|
|
});
|
|
}
|
|
});
|
|
queue.push(function(idbtrans) {
|
|
var newSchema = version._cfg.dbschema;
|
|
deleteRemovedTables(newSchema, idbtrans);
|
|
removeTablesApi(db, [
|
|
db.Transaction.prototype
|
|
]);
|
|
setApiOnPlace(db, [
|
|
db.Transaction.prototype
|
|
], db._storeNames, db._dbSchema);
|
|
trans.schema = db._dbSchema;
|
|
});
|
|
queue.push(function(idbtrans) {
|
|
if (db.idbdb.objectStoreNames.contains('$meta')) {
|
|
if (Math.ceil(db.idbdb.version / 10) === version._cfg.version) {
|
|
db.idbdb.deleteObjectStore('$meta');
|
|
delete db._dbSchema.$meta;
|
|
db._storeNames = db._storeNames.filter(function(name) {
|
|
return name !== '$meta';
|
|
});
|
|
} else {
|
|
idbtrans.objectStore('$meta').put(version._cfg.version, 'version');
|
|
}
|
|
}
|
|
});
|
|
});
|
|
function runQueue() {
|
|
return queue.length ? DexiePromise.resolve(queue.shift()(trans.idbtrans)).then(runQueue) : DexiePromise.resolve();
|
|
}
|
|
return runQueue().then(function() {
|
|
createMissingTables(globalSchema, idbUpgradeTrans);
|
|
});
|
|
}
|
|
function getSchemaDiff(oldSchema, newSchema) {
|
|
var diff = {
|
|
del: [],
|
|
add: [],
|
|
change: []
|
|
};
|
|
var table;
|
|
for(table in oldSchema){
|
|
if (!newSchema[table]) diff.del.push(table);
|
|
}
|
|
for(table in newSchema){
|
|
var oldDef = oldSchema[table], newDef = newSchema[table];
|
|
if (!oldDef) {
|
|
diff.add.push([
|
|
table,
|
|
newDef
|
|
]);
|
|
} else {
|
|
var change = {
|
|
name: table,
|
|
def: newDef,
|
|
recreate: false,
|
|
del: [],
|
|
add: [],
|
|
change: []
|
|
};
|
|
if ('' + (oldDef.primKey.keyPath || '') !== '' + (newDef.primKey.keyPath || '') || oldDef.primKey.auto !== newDef.primKey.auto) {
|
|
change.recreate = true;
|
|
diff.change.push(change);
|
|
} else {
|
|
var oldIndexes = oldDef.idxByName;
|
|
var newIndexes = newDef.idxByName;
|
|
var idxName = void 0;
|
|
for(idxName in oldIndexes){
|
|
if (!newIndexes[idxName]) change.del.push(idxName);
|
|
}
|
|
for(idxName in newIndexes){
|
|
var oldIdx = oldIndexes[idxName], newIdx = newIndexes[idxName];
|
|
if (!oldIdx) change.add.push(newIdx);
|
|
else if (oldIdx.src !== newIdx.src) change.change.push(newIdx);
|
|
}
|
|
if (change.del.length > 0 || change.add.length > 0 || change.change.length > 0) {
|
|
diff.change.push(change);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return diff;
|
|
}
|
|
function createTable(idbtrans, tableName, primKey, indexes) {
|
|
var store = idbtrans.db.createObjectStore(tableName, primKey.keyPath ? {
|
|
keyPath: primKey.keyPath,
|
|
autoIncrement: primKey.auto
|
|
} : {
|
|
autoIncrement: primKey.auto
|
|
});
|
|
indexes.forEach(function(idx) {
|
|
return addIndex(store, idx);
|
|
});
|
|
return store;
|
|
}
|
|
function createMissingTables(newSchema, idbtrans) {
|
|
keys(newSchema).forEach(function(tableName) {
|
|
if (!idbtrans.db.objectStoreNames.contains(tableName)) {
|
|
if (debug) console.debug('Dexie: Creating missing table', tableName);
|
|
createTable(idbtrans, tableName, newSchema[tableName].primKey, newSchema[tableName].indexes);
|
|
}
|
|
});
|
|
}
|
|
function deleteRemovedTables(newSchema, idbtrans) {
|
|
[].slice.call(idbtrans.db.objectStoreNames).forEach(function(storeName) {
|
|
return newSchema[storeName] == null && idbtrans.db.deleteObjectStore(storeName);
|
|
});
|
|
}
|
|
function addIndex(store, idx) {
|
|
store.createIndex(idx.name, idx.keyPath, {
|
|
unique: idx.unique,
|
|
multiEntry: idx.multi
|
|
});
|
|
}
|
|
function buildGlobalSchema(db, idbdb, tmpTrans) {
|
|
var globalSchema = {};
|
|
var dbStoreNames = slice(idbdb.objectStoreNames, 0);
|
|
dbStoreNames.forEach(function(storeName) {
|
|
var store = tmpTrans.objectStore(storeName);
|
|
var keyPath = store.keyPath;
|
|
var primKey = createIndexSpec(nameFromKeyPath(keyPath), keyPath || "", true, false, !!store.autoIncrement, keyPath && typeof keyPath !== "string", true);
|
|
var indexes = [];
|
|
for(var j = 0; j < store.indexNames.length; ++j){
|
|
var idbindex = store.index(store.indexNames[j]);
|
|
keyPath = idbindex.keyPath;
|
|
var index = createIndexSpec(idbindex.name, keyPath, !!idbindex.unique, !!idbindex.multiEntry, false, keyPath && typeof keyPath !== "string", false);
|
|
indexes.push(index);
|
|
}
|
|
globalSchema[storeName] = createTableSchema(storeName, primKey, indexes);
|
|
});
|
|
return globalSchema;
|
|
}
|
|
function readGlobalSchema(db, idbdb, tmpTrans) {
|
|
db.verno = idbdb.version / 10;
|
|
var globalSchema = db._dbSchema = buildGlobalSchema(db, idbdb, tmpTrans);
|
|
db._storeNames = slice(idbdb.objectStoreNames, 0);
|
|
setApiOnPlace(db, [
|
|
db._allTables
|
|
], keys(globalSchema), globalSchema);
|
|
}
|
|
function verifyInstalledSchema(db, tmpTrans) {
|
|
var installedSchema = buildGlobalSchema(db, db.idbdb, tmpTrans);
|
|
var diff = getSchemaDiff(installedSchema, db._dbSchema);
|
|
return !(diff.add.length || diff.change.some(function(ch) {
|
|
return ch.add.length || ch.change.length;
|
|
}));
|
|
}
|
|
function adjustToExistingIndexNames(db, schema, idbtrans) {
|
|
var storeNames = idbtrans.db.objectStoreNames;
|
|
for(var i = 0; i < storeNames.length; ++i){
|
|
var storeName = storeNames[i];
|
|
var store = idbtrans.objectStore(storeName);
|
|
db._hasGetAll = 'getAll' in store;
|
|
for(var j = 0; j < store.indexNames.length; ++j){
|
|
var indexName = store.indexNames[j];
|
|
var keyPath = store.index(indexName).keyPath;
|
|
var dexieName = typeof keyPath === 'string' ? keyPath : "[" + slice(keyPath).join('+') + "]";
|
|
if (schema[storeName]) {
|
|
var indexSpec = schema[storeName].idxByName[dexieName];
|
|
if (indexSpec) {
|
|
indexSpec.name = indexName;
|
|
delete schema[storeName].idxByName[dexieName];
|
|
schema[storeName].idxByName[indexName] = indexSpec;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (typeof navigator !== 'undefined' && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && _global.WorkerGlobalScope && _global instanceof _global.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) {
|
|
db._hasGetAll = false;
|
|
}
|
|
}
|
|
function parseIndexSyntax(primKeyAndIndexes) {
|
|
return primKeyAndIndexes.split(',').map(function(index, indexNum) {
|
|
var _a;
|
|
var typeSplit = index.split(':');
|
|
var type = (_a = typeSplit[1]) === null || _a === void 0 ? void 0 : _a.trim();
|
|
index = typeSplit[0].trim();
|
|
var name = index.replace(/([&*]|\+\+)/g, "");
|
|
var keyPath = /^\[/.test(name) ? name.match(/^\[(.*)\]$/)[1].split('+') : name;
|
|
return createIndexSpec(name, keyPath || null, /\&/.test(index), /\*/.test(index), /\+\+/.test(index), isArray(keyPath), indexNum === 0, type);
|
|
});
|
|
}
|
|
var Version = function() {
|
|
function Version() {}
|
|
Version.prototype._createTableSchema = function(name, primKey, indexes) {
|
|
return createTableSchema(name, primKey, indexes);
|
|
};
|
|
Version.prototype._parseIndexSyntax = function(primKeyAndIndexes) {
|
|
return parseIndexSyntax(primKeyAndIndexes);
|
|
};
|
|
Version.prototype._parseStoresSpec = function(stores, outSchema) {
|
|
var _this = this;
|
|
keys(stores).forEach(function(tableName) {
|
|
if (stores[tableName] !== null) {
|
|
var indexes = _this._parseIndexSyntax(stores[tableName]);
|
|
var primKey = indexes.shift();
|
|
if (!primKey) {
|
|
throw new exceptions.Schema('Invalid schema for table ' + tableName + ': ' + stores[tableName]);
|
|
}
|
|
primKey.unique = true;
|
|
if (primKey.multi) throw new exceptions.Schema('Primary key cannot be multiEntry*');
|
|
indexes.forEach(function(idx) {
|
|
if (idx.auto) throw new exceptions.Schema('Only primary key can be marked as autoIncrement (++)');
|
|
if (!idx.keyPath) throw new exceptions.Schema('Index must have a name and cannot be an empty string');
|
|
});
|
|
var tblSchema = _this._createTableSchema(tableName, primKey, indexes);
|
|
outSchema[tableName] = tblSchema;
|
|
}
|
|
});
|
|
};
|
|
Version.prototype.stores = function(stores) {
|
|
var db = this.db;
|
|
this._cfg.storesSource = this._cfg.storesSource ? extend(this._cfg.storesSource, stores) : stores;
|
|
var versions = db._versions;
|
|
var storesSpec = {};
|
|
var dbschema = {};
|
|
versions.forEach(function(version) {
|
|
extend(storesSpec, version._cfg.storesSource);
|
|
dbschema = version._cfg.dbschema = {};
|
|
version._parseStoresSpec(storesSpec, dbschema);
|
|
});
|
|
db._dbSchema = dbschema;
|
|
removeTablesApi(db, [
|
|
db._allTables,
|
|
db,
|
|
db.Transaction.prototype
|
|
]);
|
|
setApiOnPlace(db, [
|
|
db._allTables,
|
|
db,
|
|
db.Transaction.prototype,
|
|
this._cfg.tables
|
|
], keys(dbschema), dbschema);
|
|
db._storeNames = keys(dbschema);
|
|
return this;
|
|
};
|
|
Version.prototype.upgrade = function(upgradeFunction) {
|
|
this._cfg.contentUpgrade = promisableChain(this._cfg.contentUpgrade || nop, upgradeFunction);
|
|
return this;
|
|
};
|
|
return Version;
|
|
}();
|
|
function createVersionConstructor(db) {
|
|
return makeClassConstructor(Version.prototype, function Version(versionNumber) {
|
|
this.db = db;
|
|
this._cfg = {
|
|
version: versionNumber,
|
|
storesSource: null,
|
|
dbschema: {},
|
|
tables: {},
|
|
contentUpgrade: null
|
|
};
|
|
});
|
|
}
|
|
function getDbNamesTable(indexedDB1, IDBKeyRange) {
|
|
var dbNamesDB = indexedDB1["_dbNamesDB"];
|
|
if (!dbNamesDB) {
|
|
dbNamesDB = indexedDB1["_dbNamesDB"] = new Dexie$1(DBNAMES_DB, {
|
|
addons: [],
|
|
indexedDB: indexedDB1,
|
|
IDBKeyRange: IDBKeyRange
|
|
});
|
|
dbNamesDB.version(1).stores({
|
|
dbnames: "name"
|
|
});
|
|
}
|
|
return dbNamesDB.table("dbnames");
|
|
}
|
|
function hasDatabasesNative(indexedDB1) {
|
|
return indexedDB1 && typeof indexedDB1.databases === "function";
|
|
}
|
|
function getDatabaseNames(_a) {
|
|
var indexedDB1 = _a.indexedDB, IDBKeyRange = _a.IDBKeyRange;
|
|
return hasDatabasesNative(indexedDB1) ? Promise.resolve(indexedDB1.databases()).then(function(infos) {
|
|
return infos.map(function(info) {
|
|
return info.name;
|
|
}).filter(function(name) {
|
|
return name !== DBNAMES_DB;
|
|
});
|
|
}) : getDbNamesTable(indexedDB1, IDBKeyRange).toCollection().primaryKeys();
|
|
}
|
|
function _onDatabaseCreated(_a, name) {
|
|
var indexedDB1 = _a.indexedDB, IDBKeyRange = _a.IDBKeyRange;
|
|
!hasDatabasesNative(indexedDB1) && name !== DBNAMES_DB && getDbNamesTable(indexedDB1, IDBKeyRange).put({
|
|
name: name
|
|
}).catch(nop);
|
|
}
|
|
function _onDatabaseDeleted(_a, name) {
|
|
var indexedDB1 = _a.indexedDB, IDBKeyRange = _a.IDBKeyRange;
|
|
!hasDatabasesNative(indexedDB1) && name !== DBNAMES_DB && getDbNamesTable(indexedDB1, IDBKeyRange).delete(name).catch(nop);
|
|
}
|
|
function vip(fn) {
|
|
return newScope(function() {
|
|
PSD.letThrough = true;
|
|
return fn();
|
|
});
|
|
}
|
|
function idbReady() {
|
|
var isSafari = !navigator.userAgentData && /Safari\//.test(navigator.userAgent) && !/Chrom(e|ium)\//.test(navigator.userAgent);
|
|
if (!isSafari || !indexedDB.databases) return Promise.resolve();
|
|
var intervalId;
|
|
return new Promise(function(resolve) {
|
|
var tryIdb = function() {
|
|
return indexedDB.databases().finally(resolve);
|
|
};
|
|
intervalId = setInterval(tryIdb, 100);
|
|
tryIdb();
|
|
}).finally(function() {
|
|
return clearInterval(intervalId);
|
|
});
|
|
}
|
|
var _a;
|
|
function isEmptyRange(node) {
|
|
return !("from" in node);
|
|
}
|
|
var RangeSet = function(fromOrTree, to) {
|
|
if (this) {
|
|
extend(this, arguments.length ? {
|
|
d: 1,
|
|
from: fromOrTree,
|
|
to: arguments.length > 1 ? to : fromOrTree
|
|
} : {
|
|
d: 0
|
|
});
|
|
} else {
|
|
var rv = new RangeSet();
|
|
if (fromOrTree && "d" in fromOrTree) {
|
|
extend(rv, fromOrTree);
|
|
}
|
|
return rv;
|
|
}
|
|
};
|
|
props(RangeSet.prototype, (_a = {
|
|
add: function(rangeSet) {
|
|
mergeRanges(this, rangeSet);
|
|
return this;
|
|
},
|
|
addKey: function(key) {
|
|
addRange(this, key, key);
|
|
return this;
|
|
},
|
|
addKeys: function(keys) {
|
|
var _this = this;
|
|
keys.forEach(function(key) {
|
|
return addRange(_this, key, key);
|
|
});
|
|
return this;
|
|
},
|
|
hasKey: function(key) {
|
|
var node = getRangeSetIterator(this).next(key).value;
|
|
return node && cmp(node.from, key) <= 0 && cmp(node.to, key) >= 0;
|
|
}
|
|
}, _a[iteratorSymbol] = function() {
|
|
return getRangeSetIterator(this);
|
|
}, _a));
|
|
function addRange(target, from, to) {
|
|
var diff = cmp(from, to);
|
|
if (isNaN(diff)) return;
|
|
if (diff > 0) throw RangeError();
|
|
if (isEmptyRange(target)) return extend(target, {
|
|
from: from,
|
|
to: to,
|
|
d: 1
|
|
});
|
|
var left = target.l;
|
|
var right = target.r;
|
|
if (cmp(to, target.from) < 0) {
|
|
left ? addRange(left, from, to) : target.l = {
|
|
from: from,
|
|
to: to,
|
|
d: 1,
|
|
l: null,
|
|
r: null
|
|
};
|
|
return rebalance(target);
|
|
}
|
|
if (cmp(from, target.to) > 0) {
|
|
right ? addRange(right, from, to) : target.r = {
|
|
from: from,
|
|
to: to,
|
|
d: 1,
|
|
l: null,
|
|
r: null
|
|
};
|
|
return rebalance(target);
|
|
}
|
|
if (cmp(from, target.from) < 0) {
|
|
target.from = from;
|
|
target.l = null;
|
|
target.d = right ? right.d + 1 : 1;
|
|
}
|
|
if (cmp(to, target.to) > 0) {
|
|
target.to = to;
|
|
target.r = null;
|
|
target.d = target.l ? target.l.d + 1 : 1;
|
|
}
|
|
var rightWasCutOff = !target.r;
|
|
if (left && !target.l) {
|
|
mergeRanges(target, left);
|
|
}
|
|
if (right && rightWasCutOff) {
|
|
mergeRanges(target, right);
|
|
}
|
|
}
|
|
function mergeRanges(target, newSet) {
|
|
function _addRangeSet(target, _a) {
|
|
var from = _a.from, to = _a.to, l = _a.l, r = _a.r;
|
|
addRange(target, from, to);
|
|
if (l) _addRangeSet(target, l);
|
|
if (r) _addRangeSet(target, r);
|
|
}
|
|
if (!isEmptyRange(newSet)) _addRangeSet(target, newSet);
|
|
}
|
|
function rangesOverlap(rangeSet1, rangeSet2) {
|
|
var i1 = getRangeSetIterator(rangeSet2);
|
|
var nextResult1 = i1.next();
|
|
if (nextResult1.done) return false;
|
|
var a = nextResult1.value;
|
|
var i2 = getRangeSetIterator(rangeSet1);
|
|
var nextResult2 = i2.next(a.from);
|
|
var b = nextResult2.value;
|
|
while(!nextResult1.done && !nextResult2.done){
|
|
if (cmp(b.from, a.to) <= 0 && cmp(b.to, a.from) >= 0) return true;
|
|
cmp(a.from, b.from) < 0 ? a = (nextResult1 = i1.next(b.from)).value : b = (nextResult2 = i2.next(a.from)).value;
|
|
}
|
|
return false;
|
|
}
|
|
function getRangeSetIterator(node) {
|
|
var state = isEmptyRange(node) ? null : {
|
|
s: 0,
|
|
n: node
|
|
};
|
|
return {
|
|
next: function(key) {
|
|
var keyProvided = arguments.length > 0;
|
|
while(state){
|
|
switch(state.s){
|
|
case 0:
|
|
state.s = 1;
|
|
if (keyProvided) {
|
|
while(state.n.l && cmp(key, state.n.from) < 0)state = {
|
|
up: state,
|
|
n: state.n.l,
|
|
s: 1
|
|
};
|
|
} else {
|
|
while(state.n.l)state = {
|
|
up: state,
|
|
n: state.n.l,
|
|
s: 1
|
|
};
|
|
}
|
|
case 1:
|
|
state.s = 2;
|
|
if (!keyProvided || cmp(key, state.n.to) <= 0) return {
|
|
value: state.n,
|
|
done: false
|
|
};
|
|
case 2:
|
|
if (state.n.r) {
|
|
state.s = 3;
|
|
state = {
|
|
up: state,
|
|
n: state.n.r,
|
|
s: 0
|
|
};
|
|
continue;
|
|
}
|
|
case 3:
|
|
state = state.up;
|
|
}
|
|
}
|
|
return {
|
|
done: true
|
|
};
|
|
}
|
|
};
|
|
}
|
|
function rebalance(target) {
|
|
var _a, _b;
|
|
var diff = (((_a = target.r) === null || _a === void 0 ? void 0 : _a.d) || 0) - (((_b = target.l) === null || _b === void 0 ? void 0 : _b.d) || 0);
|
|
var r = diff > 1 ? "r" : diff < -1 ? "l" : "";
|
|
if (r) {
|
|
var l = r === "r" ? "l" : "r";
|
|
var rootClone = __assign({}, target);
|
|
var oldRootRight = target[r];
|
|
target.from = oldRootRight.from;
|
|
target.to = oldRootRight.to;
|
|
target[r] = oldRootRight[r];
|
|
rootClone[r] = oldRootRight[l];
|
|
target[l] = rootClone;
|
|
rootClone.d = computeDepth(rootClone);
|
|
}
|
|
target.d = computeDepth(target);
|
|
}
|
|
function computeDepth(_a) {
|
|
var r = _a.r, l = _a.l;
|
|
return (r ? l ? Math.max(r.d, l.d) : r.d : l ? l.d : 0) + 1;
|
|
}
|
|
function extendObservabilitySet(target, newSet) {
|
|
keys(newSet).forEach(function(part) {
|
|
if (target[part]) mergeRanges(target[part], newSet[part]);
|
|
else target[part] = cloneSimpleObjectTree(newSet[part]);
|
|
});
|
|
return target;
|
|
}
|
|
function obsSetsOverlap(os1, os2) {
|
|
return os1.all || os2.all || Object.keys(os1).some(function(key) {
|
|
return os2[key] && rangesOverlap(os2[key], os1[key]);
|
|
});
|
|
}
|
|
var cache = {};
|
|
var unsignaledParts = {};
|
|
var isTaskEnqueued = false;
|
|
function signalSubscribersLazily(part, optimistic) {
|
|
extendObservabilitySet(unsignaledParts, part);
|
|
if (!isTaskEnqueued) {
|
|
isTaskEnqueued = true;
|
|
setTimeout(function() {
|
|
isTaskEnqueued = false;
|
|
var parts = unsignaledParts;
|
|
unsignaledParts = {};
|
|
signalSubscribersNow(parts, false);
|
|
}, 0);
|
|
}
|
|
}
|
|
function signalSubscribersNow(updatedParts, deleteAffectedCacheEntries) {
|
|
if (deleteAffectedCacheEntries === void 0) {
|
|
deleteAffectedCacheEntries = false;
|
|
}
|
|
var queriesToSignal = new Set();
|
|
if (updatedParts.all) {
|
|
for(var _i = 0, _a = Object.values(cache); _i < _a.length; _i++){
|
|
var tblCache = _a[_i];
|
|
collectTableSubscribers(tblCache, updatedParts, queriesToSignal, deleteAffectedCacheEntries);
|
|
}
|
|
} else {
|
|
for(var key in updatedParts){
|
|
var parts = /^idb\:\/\/(.*)\/(.*)\//.exec(key);
|
|
if (parts) {
|
|
var dbName = parts[1], tableName = parts[2];
|
|
var tblCache = cache["idb://".concat(dbName, "/").concat(tableName)];
|
|
if (tblCache) collectTableSubscribers(tblCache, updatedParts, queriesToSignal, deleteAffectedCacheEntries);
|
|
}
|
|
}
|
|
}
|
|
queriesToSignal.forEach(function(requery) {
|
|
return requery();
|
|
});
|
|
}
|
|
function collectTableSubscribers(tblCache, updatedParts, outQueriesToSignal, deleteAffectedCacheEntries) {
|
|
var updatedEntryLists = [];
|
|
for(var _i = 0, _a = Object.entries(tblCache.queries.query); _i < _a.length; _i++){
|
|
var _b = _a[_i], indexName = _b[0], entries = _b[1];
|
|
var filteredEntries = [];
|
|
for(var _c = 0, entries_1 = entries; _c < entries_1.length; _c++){
|
|
var entry = entries_1[_c];
|
|
if (obsSetsOverlap(updatedParts, entry.obsSet)) {
|
|
entry.subscribers.forEach(function(requery) {
|
|
return outQueriesToSignal.add(requery);
|
|
});
|
|
} else if (deleteAffectedCacheEntries) {
|
|
filteredEntries.push(entry);
|
|
}
|
|
}
|
|
if (deleteAffectedCacheEntries) updatedEntryLists.push([
|
|
indexName,
|
|
filteredEntries
|
|
]);
|
|
}
|
|
if (deleteAffectedCacheEntries) {
|
|
for(var _d = 0, updatedEntryLists_1 = updatedEntryLists; _d < updatedEntryLists_1.length; _d++){
|
|
var _e = updatedEntryLists_1[_d], indexName = _e[0], filteredEntries = _e[1];
|
|
tblCache.queries.query[indexName] = filteredEntries;
|
|
}
|
|
}
|
|
}
|
|
function dexieOpen(db) {
|
|
var state = db._state;
|
|
var indexedDB1 = db._deps.indexedDB;
|
|
if (state.isBeingOpened || db.idbdb) return state.dbReadyPromise.then(function() {
|
|
return state.dbOpenError ? rejection(state.dbOpenError) : db;
|
|
});
|
|
state.isBeingOpened = true;
|
|
state.dbOpenError = null;
|
|
state.openComplete = false;
|
|
var openCanceller = state.openCanceller;
|
|
var nativeVerToOpen = Math.round(db.verno * 10);
|
|
var schemaPatchMode = false;
|
|
function throwIfCancelled() {
|
|
if (state.openCanceller !== openCanceller) throw new exceptions.DatabaseClosed('db.open() was cancelled');
|
|
}
|
|
var resolveDbReady = state.dbReadyResolve, upgradeTransaction = null, wasCreated = false;
|
|
var tryOpenDB = function() {
|
|
return new DexiePromise(function(resolve, reject) {
|
|
throwIfCancelled();
|
|
if (!indexedDB1) throw new exceptions.MissingAPI();
|
|
var dbName = db.name;
|
|
var req = state.autoSchema || !nativeVerToOpen ? indexedDB1.open(dbName) : indexedDB1.open(dbName, nativeVerToOpen);
|
|
if (!req) throw new exceptions.MissingAPI();
|
|
req.onerror = eventRejectHandler(reject);
|
|
req.onblocked = wrap(db._fireOnBlocked);
|
|
req.onupgradeneeded = wrap(function(e) {
|
|
upgradeTransaction = req.transaction;
|
|
if (state.autoSchema && !db._options.allowEmptyDB) {
|
|
req.onerror = preventDefault;
|
|
upgradeTransaction.abort();
|
|
req.result.close();
|
|
var delreq = indexedDB1.deleteDatabase(dbName);
|
|
delreq.onsuccess = delreq.onerror = wrap(function() {
|
|
reject(new exceptions.NoSuchDatabase("Database ".concat(dbName, " doesnt exist")));
|
|
});
|
|
} else {
|
|
upgradeTransaction.onerror = eventRejectHandler(reject);
|
|
var oldVer = e.oldVersion > Math.pow(2, 62) ? 0 : e.oldVersion;
|
|
wasCreated = oldVer < 1;
|
|
db.idbdb = req.result;
|
|
if (schemaPatchMode) {
|
|
patchCurrentVersion(db, upgradeTransaction);
|
|
}
|
|
runUpgraders(db, oldVer / 10, upgradeTransaction, reject);
|
|
}
|
|
}, reject);
|
|
req.onsuccess = wrap(function() {
|
|
upgradeTransaction = null;
|
|
var idbdb = db.idbdb = req.result;
|
|
var objectStoreNames = slice(idbdb.objectStoreNames);
|
|
if (objectStoreNames.length > 0) try {
|
|
var tmpTrans = idbdb.transaction(safariMultiStoreFix(objectStoreNames), 'readonly');
|
|
if (state.autoSchema) readGlobalSchema(db, idbdb, tmpTrans);
|
|
else {
|
|
adjustToExistingIndexNames(db, db._dbSchema, tmpTrans);
|
|
if (!verifyInstalledSchema(db, tmpTrans) && !schemaPatchMode) {
|
|
console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this.");
|
|
idbdb.close();
|
|
nativeVerToOpen = idbdb.version + 1;
|
|
schemaPatchMode = true;
|
|
return resolve(tryOpenDB());
|
|
}
|
|
}
|
|
generateMiddlewareStacks(db, tmpTrans);
|
|
} catch (e) {}
|
|
connections.push(db);
|
|
idbdb.onversionchange = wrap(function(ev) {
|
|
state.vcFired = true;
|
|
db.on("versionchange").fire(ev);
|
|
});
|
|
idbdb.onclose = wrap(function() {
|
|
db.close({
|
|
disableAutoOpen: false
|
|
});
|
|
});
|
|
if (wasCreated) _onDatabaseCreated(db._deps, dbName);
|
|
resolve();
|
|
}, reject);
|
|
}).catch(function(err) {
|
|
switch(err === null || err === void 0 ? void 0 : err.name){
|
|
case "UnknownError":
|
|
if (state.PR1398_maxLoop > 0) {
|
|
state.PR1398_maxLoop--;
|
|
console.warn('Dexie: Workaround for Chrome UnknownError on open()');
|
|
return tryOpenDB();
|
|
}
|
|
break;
|
|
case "VersionError":
|
|
if (nativeVerToOpen > 0) {
|
|
nativeVerToOpen = 0;
|
|
return tryOpenDB();
|
|
}
|
|
break;
|
|
}
|
|
return DexiePromise.reject(err);
|
|
});
|
|
};
|
|
return DexiePromise.race([
|
|
openCanceller,
|
|
(typeof navigator === 'undefined' ? DexiePromise.resolve() : idbReady()).then(tryOpenDB)
|
|
]).then(function() {
|
|
throwIfCancelled();
|
|
state.onReadyBeingFired = [];
|
|
return DexiePromise.resolve(vip(function() {
|
|
return db.on.ready.fire(db.vip);
|
|
})).then(function fireRemainders() {
|
|
if (state.onReadyBeingFired.length > 0) {
|
|
var remainders_1 = state.onReadyBeingFired.reduce(promisableChain, nop);
|
|
state.onReadyBeingFired = [];
|
|
return DexiePromise.resolve(vip(function() {
|
|
return remainders_1(db.vip);
|
|
})).then(fireRemainders);
|
|
}
|
|
});
|
|
}).finally(function() {
|
|
if (state.openCanceller === openCanceller) {
|
|
state.onReadyBeingFired = null;
|
|
state.isBeingOpened = false;
|
|
}
|
|
}).catch(function(err) {
|
|
state.dbOpenError = err;
|
|
try {
|
|
upgradeTransaction && upgradeTransaction.abort();
|
|
} catch (_a) {}
|
|
if (openCanceller === state.openCanceller) {
|
|
db._close();
|
|
}
|
|
return rejection(err);
|
|
}).finally(function() {
|
|
state.openComplete = true;
|
|
resolveDbReady();
|
|
}).then(function() {
|
|
if (wasCreated) {
|
|
var everything_1 = {};
|
|
db.tables.forEach(function(table) {
|
|
table.schema.indexes.forEach(function(idx) {
|
|
if (idx.name) everything_1["idb://".concat(db.name, "/").concat(table.name, "/").concat(idx.name)] = new RangeSet(-Infinity, [
|
|
[
|
|
[]
|
|
]
|
|
]);
|
|
});
|
|
everything_1["idb://".concat(db.name, "/").concat(table.name, "/")] = everything_1["idb://".concat(db.name, "/").concat(table.name, "/:dels")] = new RangeSet(-Infinity, [
|
|
[
|
|
[]
|
|
]
|
|
]);
|
|
});
|
|
globalEvents(DEXIE_STORAGE_MUTATED_EVENT_NAME).fire(everything_1);
|
|
signalSubscribersNow(everything_1, true);
|
|
}
|
|
return db;
|
|
});
|
|
}
|
|
function awaitIterator(iterator) {
|
|
var callNext = function(result) {
|
|
return iterator.next(result);
|
|
}, doThrow = function(error) {
|
|
return iterator.throw(error);
|
|
}, onSuccess = step(callNext), onError = step(doThrow);
|
|
function step(getNext) {
|
|
return function(val) {
|
|
var next = getNext(val), value = next.value;
|
|
return next.done ? value : !value || typeof value.then !== 'function' ? isArray(value) ? Promise.all(value).then(onSuccess, onError) : onSuccess(value) : value.then(onSuccess, onError);
|
|
};
|
|
}
|
|
return step(callNext)();
|
|
}
|
|
function extractTransactionArgs(mode, _tableArgs_, scopeFunc) {
|
|
var i = arguments.length;
|
|
if (i < 2) throw new exceptions.InvalidArgument("Too few arguments");
|
|
var args = new Array(i - 1);
|
|
while(--i)args[i - 1] = arguments[i];
|
|
scopeFunc = args.pop();
|
|
var tables = flatten(args);
|
|
return [
|
|
mode,
|
|
tables,
|
|
scopeFunc
|
|
];
|
|
}
|
|
function enterTransactionScope(db, mode, storeNames, parentTransaction, scopeFunc) {
|
|
return DexiePromise.resolve().then(function() {
|
|
var transless = PSD.transless || PSD;
|
|
var trans = db._createTransaction(mode, storeNames, db._dbSchema, parentTransaction);
|
|
trans.explicit = true;
|
|
var zoneProps = {
|
|
trans: trans,
|
|
transless: transless
|
|
};
|
|
if (parentTransaction) {
|
|
trans.idbtrans = parentTransaction.idbtrans;
|
|
} else {
|
|
try {
|
|
trans.create();
|
|
trans.idbtrans._explicit = true;
|
|
db._state.PR1398_maxLoop = 3;
|
|
} catch (ex) {
|
|
if (ex.name === errnames.InvalidState && db.isOpen() && --db._state.PR1398_maxLoop > 0) {
|
|
console.warn('Dexie: Need to reopen db');
|
|
db.close({
|
|
disableAutoOpen: false
|
|
});
|
|
return db.open().then(function() {
|
|
return enterTransactionScope(db, mode, storeNames, null, scopeFunc);
|
|
});
|
|
}
|
|
return rejection(ex);
|
|
}
|
|
}
|
|
var scopeFuncIsAsync = isAsyncFunction(scopeFunc);
|
|
if (scopeFuncIsAsync) {
|
|
incrementExpectedAwaits();
|
|
}
|
|
var returnValue;
|
|
var promiseFollowed = DexiePromise.follow(function() {
|
|
returnValue = scopeFunc.call(trans, trans);
|
|
if (returnValue) {
|
|
if (scopeFuncIsAsync) {
|
|
var decrementor = decrementExpectedAwaits.bind(null, null);
|
|
returnValue.then(decrementor, decrementor);
|
|
} else if (typeof returnValue.next === 'function' && typeof returnValue.throw === 'function') {
|
|
returnValue = awaitIterator(returnValue);
|
|
}
|
|
}
|
|
}, zoneProps);
|
|
return (returnValue && typeof returnValue.then === 'function' ? DexiePromise.resolve(returnValue).then(function(x) {
|
|
return trans.active ? x : rejection(new exceptions.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"));
|
|
}) : promiseFollowed.then(function() {
|
|
return returnValue;
|
|
})).then(function(x) {
|
|
if (parentTransaction) trans._resolve();
|
|
return trans._completion.then(function() {
|
|
return x;
|
|
});
|
|
}).catch(function(e) {
|
|
trans._reject(e);
|
|
return rejection(e);
|
|
});
|
|
});
|
|
}
|
|
function pad(a, value, count) {
|
|
var result = isArray(a) ? a.slice() : [
|
|
a
|
|
];
|
|
for(var i = 0; i < count; ++i)result.push(value);
|
|
return result;
|
|
}
|
|
function createVirtualIndexMiddleware(down) {
|
|
return __assign(__assign({}, down), {
|
|
table: function(tableName) {
|
|
var table = down.table(tableName);
|
|
var schema = table.schema;
|
|
var indexLookup = {};
|
|
var allVirtualIndexes = [];
|
|
function addVirtualIndexes(keyPath, keyTail, lowLevelIndex) {
|
|
var keyPathAlias = getKeyPathAlias(keyPath);
|
|
var indexList = indexLookup[keyPathAlias] = indexLookup[keyPathAlias] || [];
|
|
var keyLength = keyPath == null ? 0 : typeof keyPath === 'string' ? 1 : keyPath.length;
|
|
var isVirtual = keyTail > 0;
|
|
var virtualIndex = __assign(__assign({}, lowLevelIndex), {
|
|
name: isVirtual ? "".concat(keyPathAlias, "(virtual-from:").concat(lowLevelIndex.name, ")") : lowLevelIndex.name,
|
|
lowLevelIndex: lowLevelIndex,
|
|
isVirtual: isVirtual,
|
|
keyTail: keyTail,
|
|
keyLength: keyLength,
|
|
extractKey: getKeyExtractor(keyPath),
|
|
unique: !isVirtual && lowLevelIndex.unique
|
|
});
|
|
indexList.push(virtualIndex);
|
|
if (!virtualIndex.isPrimaryKey) {
|
|
allVirtualIndexes.push(virtualIndex);
|
|
}
|
|
if (keyLength > 1) {
|
|
var virtualKeyPath = keyLength === 2 ? keyPath[0] : keyPath.slice(0, keyLength - 1);
|
|
addVirtualIndexes(virtualKeyPath, keyTail + 1, lowLevelIndex);
|
|
}
|
|
indexList.sort(function(a, b) {
|
|
return a.keyTail - b.keyTail;
|
|
});
|
|
return virtualIndex;
|
|
}
|
|
var primaryKey = addVirtualIndexes(schema.primaryKey.keyPath, 0, schema.primaryKey);
|
|
indexLookup[":id"] = [
|
|
primaryKey
|
|
];
|
|
for(var _i = 0, _a = schema.indexes; _i < _a.length; _i++){
|
|
var index = _a[_i];
|
|
addVirtualIndexes(index.keyPath, 0, index);
|
|
}
|
|
function findBestIndex(keyPath) {
|
|
var result = indexLookup[getKeyPathAlias(keyPath)];
|
|
return result && result[0];
|
|
}
|
|
function translateRange(range, keyTail) {
|
|
return {
|
|
type: range.type === 1 ? 2 : range.type,
|
|
lower: pad(range.lower, range.lowerOpen ? down.MAX_KEY : down.MIN_KEY, keyTail),
|
|
lowerOpen: true,
|
|
upper: pad(range.upper, range.upperOpen ? down.MIN_KEY : down.MAX_KEY, keyTail),
|
|
upperOpen: true
|
|
};
|
|
}
|
|
function translateRequest(req) {
|
|
var index = req.query.index;
|
|
return index.isVirtual ? __assign(__assign({}, req), {
|
|
query: {
|
|
index: index.lowLevelIndex,
|
|
range: translateRange(req.query.range, index.keyTail)
|
|
}
|
|
}) : req;
|
|
}
|
|
var result = __assign(__assign({}, table), {
|
|
schema: __assign(__assign({}, schema), {
|
|
primaryKey: primaryKey,
|
|
indexes: allVirtualIndexes,
|
|
getIndexByKeyPath: findBestIndex
|
|
}),
|
|
count: function(req) {
|
|
return table.count(translateRequest(req));
|
|
},
|
|
query: function(req) {
|
|
return table.query(translateRequest(req));
|
|
},
|
|
openCursor: function(req) {
|
|
var _a = req.query.index, keyTail = _a.keyTail, isVirtual = _a.isVirtual, keyLength = _a.keyLength;
|
|
if (!isVirtual) return table.openCursor(req);
|
|
function createVirtualCursor(cursor) {
|
|
function _continue(key) {
|
|
key != null ? cursor.continue(pad(key, req.reverse ? down.MAX_KEY : down.MIN_KEY, keyTail)) : req.unique ? cursor.continue(cursor.key.slice(0, keyLength).concat(req.reverse ? down.MIN_KEY : down.MAX_KEY, keyTail)) : cursor.continue();
|
|
}
|
|
var virtualCursor = Object.create(cursor, {
|
|
continue: {
|
|
value: _continue
|
|
},
|
|
continuePrimaryKey: {
|
|
value: function(key, primaryKey) {
|
|
cursor.continuePrimaryKey(pad(key, down.MAX_KEY, keyTail), primaryKey);
|
|
}
|
|
},
|
|
primaryKey: {
|
|
get: function() {
|
|
return cursor.primaryKey;
|
|
}
|
|
},
|
|
key: {
|
|
get: function() {
|
|
var key = cursor.key;
|
|
return keyLength === 1 ? key[0] : key.slice(0, keyLength);
|
|
}
|
|
},
|
|
value: {
|
|
get: function() {
|
|
return cursor.value;
|
|
}
|
|
}
|
|
});
|
|
return virtualCursor;
|
|
}
|
|
return table.openCursor(translateRequest(req)).then(function(cursor) {
|
|
return cursor && createVirtualCursor(cursor);
|
|
});
|
|
}
|
|
});
|
|
return result;
|
|
}
|
|
});
|
|
}
|
|
var virtualIndexMiddleware = {
|
|
stack: "dbcore",
|
|
name: "VirtualIndexMiddleware",
|
|
level: 1,
|
|
create: createVirtualIndexMiddleware
|
|
};
|
|
function getObjectDiff(a, b, rv, prfx) {
|
|
rv = rv || {};
|
|
prfx = prfx || '';
|
|
keys(a).forEach(function(prop) {
|
|
if (!hasOwn(b, prop)) {
|
|
rv[prfx + prop] = undefined;
|
|
} else {
|
|
var ap = a[prop], bp = b[prop];
|
|
if (typeof ap === 'object' && typeof bp === 'object' && ap && bp) {
|
|
var apTypeName = toStringTag(ap);
|
|
var bpTypeName = toStringTag(bp);
|
|
if (apTypeName !== bpTypeName) {
|
|
rv[prfx + prop] = b[prop];
|
|
} else if (apTypeName === 'Object') {
|
|
getObjectDiff(ap, bp, rv, prfx + prop + '.');
|
|
} else if (ap !== bp) {
|
|
rv[prfx + prop] = b[prop];
|
|
}
|
|
} else if (ap !== bp) rv[prfx + prop] = b[prop];
|
|
}
|
|
});
|
|
keys(b).forEach(function(prop) {
|
|
if (!hasOwn(a, prop)) {
|
|
rv[prfx + prop] = b[prop];
|
|
}
|
|
});
|
|
return rv;
|
|
}
|
|
function getEffectiveKeys(primaryKey, req) {
|
|
if (req.type === 'delete') return req.keys;
|
|
return req.keys || req.values.map(primaryKey.extractKey);
|
|
}
|
|
var hooksMiddleware = {
|
|
stack: "dbcore",
|
|
name: "HooksMiddleware",
|
|
level: 2,
|
|
create: function(downCore) {
|
|
return __assign(__assign({}, downCore), {
|
|
table: function(tableName) {
|
|
var downTable = downCore.table(tableName);
|
|
var primaryKey = downTable.schema.primaryKey;
|
|
var tableMiddleware = __assign(__assign({}, downTable), {
|
|
mutate: function(req) {
|
|
var dxTrans = PSD.trans;
|
|
var _a = dxTrans.table(tableName).hook, deleting = _a.deleting, creating = _a.creating, updating = _a.updating;
|
|
switch(req.type){
|
|
case 'add':
|
|
if (creating.fire === nop) break;
|
|
return dxTrans._promise('readwrite', function() {
|
|
return addPutOrDelete(req);
|
|
}, true);
|
|
case 'put':
|
|
if (creating.fire === nop && updating.fire === nop) break;
|
|
return dxTrans._promise('readwrite', function() {
|
|
return addPutOrDelete(req);
|
|
}, true);
|
|
case 'delete':
|
|
if (deleting.fire === nop) break;
|
|
return dxTrans._promise('readwrite', function() {
|
|
return addPutOrDelete(req);
|
|
}, true);
|
|
case 'deleteRange':
|
|
if (deleting.fire === nop) break;
|
|
return dxTrans._promise('readwrite', function() {
|
|
return deleteRange(req);
|
|
}, true);
|
|
}
|
|
return downTable.mutate(req);
|
|
//TURBOPACK unreachable
|
|
;
|
|
function addPutOrDelete(req) {
|
|
var dxTrans = PSD.trans;
|
|
var keys = req.keys || getEffectiveKeys(primaryKey, req);
|
|
if (!keys) throw new Error("Keys missing");
|
|
req = req.type === 'add' || req.type === 'put' ? __assign(__assign({}, req), {
|
|
keys: keys
|
|
}) : __assign({}, req);
|
|
if (req.type !== 'delete') req.values = __spreadArray([], req.values, true);
|
|
if (req.keys) req.keys = __spreadArray([], req.keys, true);
|
|
return getExistingValues(downTable, req, keys).then(function(existingValues) {
|
|
var contexts = keys.map(function(key, i) {
|
|
var existingValue = existingValues[i];
|
|
var ctx = {
|
|
onerror: null,
|
|
onsuccess: null
|
|
};
|
|
if (req.type === 'delete') {
|
|
deleting.fire.call(ctx, key, existingValue, dxTrans);
|
|
} else if (req.type === 'add' || existingValue === undefined) {
|
|
var generatedPrimaryKey = creating.fire.call(ctx, key, req.values[i], dxTrans);
|
|
if (key == null && generatedPrimaryKey != null) {
|
|
key = generatedPrimaryKey;
|
|
req.keys[i] = key;
|
|
if (!primaryKey.outbound) {
|
|
setByKeyPath(req.values[i], primaryKey.keyPath, key);
|
|
}
|
|
}
|
|
} else {
|
|
var objectDiff = getObjectDiff(existingValue, req.values[i]);
|
|
var additionalChanges_1 = updating.fire.call(ctx, objectDiff, key, existingValue, dxTrans);
|
|
if (additionalChanges_1) {
|
|
var requestedValue_1 = req.values[i];
|
|
Object.keys(additionalChanges_1).forEach(function(keyPath) {
|
|
if (hasOwn(requestedValue_1, keyPath)) {
|
|
requestedValue_1[keyPath] = additionalChanges_1[keyPath];
|
|
} else {
|
|
setByKeyPath(requestedValue_1, keyPath, additionalChanges_1[keyPath]);
|
|
}
|
|
});
|
|
}
|
|
}
|
|
return ctx;
|
|
});
|
|
return downTable.mutate(req).then(function(_a) {
|
|
var failures = _a.failures, results = _a.results, numFailures = _a.numFailures, lastResult = _a.lastResult;
|
|
for(var i = 0; i < keys.length; ++i){
|
|
var primKey = results ? results[i] : keys[i];
|
|
var ctx = contexts[i];
|
|
if (primKey == null) {
|
|
ctx.onerror && ctx.onerror(failures[i]);
|
|
} else {
|
|
ctx.onsuccess && ctx.onsuccess(req.type === 'put' && existingValues[i] ? req.values[i] : primKey);
|
|
}
|
|
}
|
|
return {
|
|
failures: failures,
|
|
results: results,
|
|
numFailures: numFailures,
|
|
lastResult: lastResult
|
|
};
|
|
}).catch(function(error) {
|
|
contexts.forEach(function(ctx) {
|
|
return ctx.onerror && ctx.onerror(error);
|
|
});
|
|
return Promise.reject(error);
|
|
});
|
|
});
|
|
}
|
|
function deleteRange(req) {
|
|
return deleteNextChunk(req.trans, req.range, 10000);
|
|
}
|
|
function deleteNextChunk(trans, range, limit) {
|
|
return downTable.query({
|
|
trans: trans,
|
|
values: false,
|
|
query: {
|
|
index: primaryKey,
|
|
range: range
|
|
},
|
|
limit: limit
|
|
}).then(function(_a) {
|
|
var result = _a.result;
|
|
return addPutOrDelete({
|
|
type: 'delete',
|
|
keys: result,
|
|
trans: trans
|
|
}).then(function(res) {
|
|
if (res.numFailures > 0) return Promise.reject(res.failures[0]);
|
|
if (result.length < limit) {
|
|
return {
|
|
failures: [],
|
|
numFailures: 0,
|
|
lastResult: undefined
|
|
};
|
|
} else {
|
|
return deleteNextChunk(trans, __assign(__assign({}, range), {
|
|
lower: result[result.length - 1],
|
|
lowerOpen: true
|
|
}), limit);
|
|
}
|
|
});
|
|
});
|
|
}
|
|
}
|
|
});
|
|
return tableMiddleware;
|
|
}
|
|
});
|
|
}
|
|
};
|
|
function getExistingValues(table, req, effectiveKeys) {
|
|
return req.type === "add" ? Promise.resolve([]) : table.getMany({
|
|
trans: req.trans,
|
|
keys: effectiveKeys,
|
|
cache: "immutable"
|
|
});
|
|
}
|
|
function getFromTransactionCache(keys, cache, clone) {
|
|
try {
|
|
if (!cache) return null;
|
|
if (cache.keys.length < keys.length) return null;
|
|
var result = [];
|
|
for(var i = 0, j = 0; i < cache.keys.length && j < keys.length; ++i){
|
|
if (cmp(cache.keys[i], keys[j]) !== 0) continue;
|
|
result.push(clone ? deepClone(cache.values[i]) : cache.values[i]);
|
|
++j;
|
|
}
|
|
return result.length === keys.length ? result : null;
|
|
} catch (_a) {
|
|
return null;
|
|
}
|
|
}
|
|
var cacheExistingValuesMiddleware = {
|
|
stack: "dbcore",
|
|
level: -1,
|
|
create: function(core) {
|
|
return {
|
|
table: function(tableName) {
|
|
var table = core.table(tableName);
|
|
return __assign(__assign({}, table), {
|
|
getMany: function(req) {
|
|
if (!req.cache) {
|
|
return table.getMany(req);
|
|
}
|
|
var cachedResult = getFromTransactionCache(req.keys, req.trans["_cache"], req.cache === "clone");
|
|
if (cachedResult) {
|
|
return DexiePromise.resolve(cachedResult);
|
|
}
|
|
return table.getMany(req).then(function(res) {
|
|
req.trans["_cache"] = {
|
|
keys: req.keys,
|
|
values: req.cache === "clone" ? deepClone(res) : res
|
|
};
|
|
return res;
|
|
});
|
|
},
|
|
mutate: function(req) {
|
|
if (req.type !== "add") req.trans["_cache"] = null;
|
|
return table.mutate(req);
|
|
}
|
|
});
|
|
}
|
|
};
|
|
}
|
|
};
|
|
function isCachableContext(ctx, table) {
|
|
return ctx.trans.mode === 'readonly' && !!ctx.subscr && !ctx.trans.explicit && ctx.trans.db._options.cache !== 'disabled' && !table.schema.primaryKey.outbound;
|
|
}
|
|
function isCachableRequest(type, req) {
|
|
switch(type){
|
|
case 'query':
|
|
return req.values && !req.unique;
|
|
case 'get':
|
|
return false;
|
|
case 'getMany':
|
|
return false;
|
|
case 'count':
|
|
return false;
|
|
case 'openCursor':
|
|
return false;
|
|
}
|
|
}
|
|
var observabilityMiddleware = {
|
|
stack: "dbcore",
|
|
level: 0,
|
|
name: "Observability",
|
|
create: function(core) {
|
|
var dbName = core.schema.name;
|
|
var FULL_RANGE = new RangeSet(core.MIN_KEY, core.MAX_KEY);
|
|
return __assign(__assign({}, core), {
|
|
transaction: function(stores, mode, options) {
|
|
if (PSD.subscr && mode !== 'readonly') {
|
|
throw new exceptions.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(PSD.querier));
|
|
}
|
|
return core.transaction(stores, mode, options);
|
|
},
|
|
table: function(tableName) {
|
|
var table = core.table(tableName);
|
|
var schema = table.schema;
|
|
var primaryKey = schema.primaryKey, indexes = schema.indexes;
|
|
var extractKey = primaryKey.extractKey, outbound = primaryKey.outbound;
|
|
var indexesWithAutoIncPK = primaryKey.autoIncrement && indexes.filter(function(index) {
|
|
return index.compound && index.keyPath.includes(primaryKey.keyPath);
|
|
});
|
|
var tableClone = __assign(__assign({}, table), {
|
|
mutate: function(req) {
|
|
var _a, _b;
|
|
var trans = req.trans;
|
|
var mutatedParts = req.mutatedParts || (req.mutatedParts = {});
|
|
var getRangeSet = function(indexName) {
|
|
var part = "idb://".concat(dbName, "/").concat(tableName, "/").concat(indexName);
|
|
return mutatedParts[part] || (mutatedParts[part] = new RangeSet());
|
|
};
|
|
var pkRangeSet = getRangeSet("");
|
|
var delsRangeSet = getRangeSet(":dels");
|
|
var type = req.type;
|
|
var _c = req.type === "deleteRange" ? [
|
|
req.range
|
|
] : req.type === "delete" ? [
|
|
req.keys
|
|
] : req.values.length < 50 ? [
|
|
getEffectiveKeys(primaryKey, req).filter(function(id) {
|
|
return id;
|
|
}),
|
|
req.values
|
|
] : [], keys = _c[0], newObjs = _c[1];
|
|
var oldCache = req.trans["_cache"];
|
|
if (isArray(keys)) {
|
|
pkRangeSet.addKeys(keys);
|
|
var oldObjs = type === 'delete' || keys.length === newObjs.length ? getFromTransactionCache(keys, oldCache) : null;
|
|
if (!oldObjs) {
|
|
delsRangeSet.addKeys(keys);
|
|
}
|
|
if (oldObjs || newObjs) {
|
|
trackAffectedIndexes(getRangeSet, schema, oldObjs, newObjs);
|
|
}
|
|
} else if (keys) {
|
|
var range = {
|
|
from: (_a = keys.lower) !== null && _a !== void 0 ? _a : core.MIN_KEY,
|
|
to: (_b = keys.upper) !== null && _b !== void 0 ? _b : core.MAX_KEY
|
|
};
|
|
delsRangeSet.add(range);
|
|
pkRangeSet.add(range);
|
|
} else {
|
|
pkRangeSet.add(FULL_RANGE);
|
|
delsRangeSet.add(FULL_RANGE);
|
|
schema.indexes.forEach(function(idx) {
|
|
return getRangeSet(idx.name).add(FULL_RANGE);
|
|
});
|
|
}
|
|
return table.mutate(req).then(function(res) {
|
|
if (keys && (req.type === 'add' || req.type === 'put')) {
|
|
pkRangeSet.addKeys(res.results);
|
|
if (indexesWithAutoIncPK) {
|
|
indexesWithAutoIncPK.forEach(function(idx) {
|
|
var idxVals = req.values.map(function(v) {
|
|
return idx.extractKey(v);
|
|
});
|
|
var pkPos = idx.keyPath.findIndex(function(prop) {
|
|
return prop === primaryKey.keyPath;
|
|
});
|
|
for(var i = 0, len = res.results.length; i < len; ++i){
|
|
idxVals[i][pkPos] = res.results[i];
|
|
}
|
|
getRangeSet(idx.name).addKeys(idxVals);
|
|
});
|
|
}
|
|
}
|
|
trans.mutatedParts = extendObservabilitySet(trans.mutatedParts || {}, mutatedParts);
|
|
return res;
|
|
});
|
|
}
|
|
});
|
|
var getRange = function(_a) {
|
|
var _b, _c;
|
|
var _d = _a.query, index = _d.index, range = _d.range;
|
|
return [
|
|
index,
|
|
new RangeSet((_b = range.lower) !== null && _b !== void 0 ? _b : core.MIN_KEY, (_c = range.upper) !== null && _c !== void 0 ? _c : core.MAX_KEY)
|
|
];
|
|
};
|
|
var readSubscribers = {
|
|
get: function(req) {
|
|
return [
|
|
primaryKey,
|
|
new RangeSet(req.key)
|
|
];
|
|
},
|
|
getMany: function(req) {
|
|
return [
|
|
primaryKey,
|
|
new RangeSet().addKeys(req.keys)
|
|
];
|
|
},
|
|
count: getRange,
|
|
query: getRange,
|
|
openCursor: getRange
|
|
};
|
|
keys(readSubscribers).forEach(function(method) {
|
|
tableClone[method] = function(req) {
|
|
var subscr = PSD.subscr;
|
|
var isLiveQuery = !!subscr;
|
|
var cachable = isCachableContext(PSD, table) && isCachableRequest(method, req);
|
|
var obsSet = cachable ? req.obsSet = {} : subscr;
|
|
if (isLiveQuery) {
|
|
var getRangeSet = function(indexName) {
|
|
var part = "idb://".concat(dbName, "/").concat(tableName, "/").concat(indexName);
|
|
return obsSet[part] || (obsSet[part] = new RangeSet());
|
|
};
|
|
var pkRangeSet_1 = getRangeSet("");
|
|
var delsRangeSet_1 = getRangeSet(":dels");
|
|
var _a = readSubscribers[method](req), queriedIndex = _a[0], queriedRanges = _a[1];
|
|
if (method === 'query' && queriedIndex.isPrimaryKey && !req.values) {
|
|
delsRangeSet_1.add(queriedRanges);
|
|
} else {
|
|
getRangeSet(queriedIndex.name || "").add(queriedRanges);
|
|
}
|
|
if (!queriedIndex.isPrimaryKey) {
|
|
if (method === "count") {
|
|
delsRangeSet_1.add(FULL_RANGE);
|
|
} else {
|
|
var keysPromise_1 = method === "query" && outbound && req.values && table.query(__assign(__assign({}, req), {
|
|
values: false
|
|
}));
|
|
return table[method].apply(this, arguments).then(function(res) {
|
|
if (method === "query") {
|
|
if (outbound && req.values) {
|
|
return keysPromise_1.then(function(_a) {
|
|
var resultingKeys = _a.result;
|
|
pkRangeSet_1.addKeys(resultingKeys);
|
|
return res;
|
|
});
|
|
}
|
|
var pKeys = req.values ? res.result.map(extractKey) : res.result;
|
|
if (req.values) {
|
|
pkRangeSet_1.addKeys(pKeys);
|
|
} else {
|
|
delsRangeSet_1.addKeys(pKeys);
|
|
}
|
|
} else if (method === "openCursor") {
|
|
var cursor_1 = res;
|
|
var wantValues_1 = req.values;
|
|
return cursor_1 && Object.create(cursor_1, {
|
|
key: {
|
|
get: function() {
|
|
delsRangeSet_1.addKey(cursor_1.primaryKey);
|
|
return cursor_1.key;
|
|
}
|
|
},
|
|
primaryKey: {
|
|
get: function() {
|
|
var pkey = cursor_1.primaryKey;
|
|
delsRangeSet_1.addKey(pkey);
|
|
return pkey;
|
|
}
|
|
},
|
|
value: {
|
|
get: function() {
|
|
wantValues_1 && pkRangeSet_1.addKey(cursor_1.primaryKey);
|
|
return cursor_1.value;
|
|
}
|
|
}
|
|
});
|
|
}
|
|
return res;
|
|
});
|
|
}
|
|
}
|
|
}
|
|
return table[method].apply(this, arguments);
|
|
};
|
|
});
|
|
return tableClone;
|
|
}
|
|
});
|
|
}
|
|
};
|
|
function trackAffectedIndexes(getRangeSet, schema, oldObjs, newObjs) {
|
|
function addAffectedIndex(ix) {
|
|
var rangeSet = getRangeSet(ix.name || "");
|
|
function extractKey(obj) {
|
|
return obj != null ? ix.extractKey(obj) : null;
|
|
}
|
|
var addKeyOrKeys = function(key) {
|
|
return ix.multiEntry && isArray(key) ? key.forEach(function(key) {
|
|
return rangeSet.addKey(key);
|
|
}) : rangeSet.addKey(key);
|
|
};
|
|
(oldObjs || newObjs).forEach(function(_, i) {
|
|
var oldKey = oldObjs && extractKey(oldObjs[i]);
|
|
var newKey = newObjs && extractKey(newObjs[i]);
|
|
if (cmp(oldKey, newKey) !== 0) {
|
|
if (oldKey != null) addKeyOrKeys(oldKey);
|
|
if (newKey != null) addKeyOrKeys(newKey);
|
|
}
|
|
});
|
|
}
|
|
schema.indexes.forEach(addAffectedIndex);
|
|
}
|
|
function adjustOptimisticFromFailures(tblCache, req, res) {
|
|
if (res.numFailures === 0) return req;
|
|
if (req.type === 'deleteRange') {
|
|
return null;
|
|
}
|
|
var numBulkOps = req.keys ? req.keys.length : 'values' in req && req.values ? req.values.length : 1;
|
|
if (res.numFailures === numBulkOps) {
|
|
return null;
|
|
}
|
|
var clone = __assign({}, req);
|
|
if (isArray(clone.keys)) {
|
|
clone.keys = clone.keys.filter(function(_, i) {
|
|
return !(i in res.failures);
|
|
});
|
|
}
|
|
if ('values' in clone && isArray(clone.values)) {
|
|
clone.values = clone.values.filter(function(_, i) {
|
|
return !(i in res.failures);
|
|
});
|
|
}
|
|
return clone;
|
|
}
|
|
function isAboveLower(key, range) {
|
|
return range.lower === undefined ? true : range.lowerOpen ? cmp(key, range.lower) > 0 : cmp(key, range.lower) >= 0;
|
|
}
|
|
function isBelowUpper(key, range) {
|
|
return range.upper === undefined ? true : range.upperOpen ? cmp(key, range.upper) < 0 : cmp(key, range.upper) <= 0;
|
|
}
|
|
function isWithinRange(key, range) {
|
|
return isAboveLower(key, range) && isBelowUpper(key, range);
|
|
}
|
|
function applyOptimisticOps(result, req, ops, table, cacheEntry, immutable) {
|
|
if (!ops || ops.length === 0) return result;
|
|
var index = req.query.index;
|
|
var multiEntry = index.multiEntry;
|
|
var queryRange = req.query.range;
|
|
var primaryKey = table.schema.primaryKey;
|
|
var extractPrimKey = primaryKey.extractKey;
|
|
var extractIndex = index.extractKey;
|
|
var extractLowLevelIndex = (index.lowLevelIndex || index).extractKey;
|
|
var finalResult = ops.reduce(function(result, op) {
|
|
var modifedResult = result;
|
|
var includedValues = [];
|
|
if (op.type === 'add' || op.type === 'put') {
|
|
var includedPKs = new RangeSet();
|
|
for(var i = op.values.length - 1; i >= 0; --i){
|
|
var value = op.values[i];
|
|
var pk = extractPrimKey(value);
|
|
if (includedPKs.hasKey(pk)) continue;
|
|
var key = extractIndex(value);
|
|
if (multiEntry && isArray(key) ? key.some(function(k) {
|
|
return isWithinRange(k, queryRange);
|
|
}) : isWithinRange(key, queryRange)) {
|
|
includedPKs.addKey(pk);
|
|
includedValues.push(value);
|
|
}
|
|
}
|
|
}
|
|
switch(op.type){
|
|
case 'add':
|
|
{
|
|
var existingKeys_1 = new RangeSet().addKeys(req.values ? result.map(function(v) {
|
|
return extractPrimKey(v);
|
|
}) : result);
|
|
modifedResult = result.concat(req.values ? includedValues.filter(function(v) {
|
|
var key = extractPrimKey(v);
|
|
if (existingKeys_1.hasKey(key)) return false;
|
|
existingKeys_1.addKey(key);
|
|
return true;
|
|
}) : includedValues.map(function(v) {
|
|
return extractPrimKey(v);
|
|
}).filter(function(k) {
|
|
if (existingKeys_1.hasKey(k)) return false;
|
|
existingKeys_1.addKey(k);
|
|
return true;
|
|
}));
|
|
break;
|
|
}
|
|
case 'put':
|
|
{
|
|
var keySet_1 = new RangeSet().addKeys(op.values.map(function(v) {
|
|
return extractPrimKey(v);
|
|
}));
|
|
modifedResult = result.filter(function(item) {
|
|
return !keySet_1.hasKey(req.values ? extractPrimKey(item) : item);
|
|
}).concat(req.values ? includedValues : includedValues.map(function(v) {
|
|
return extractPrimKey(v);
|
|
}));
|
|
break;
|
|
}
|
|
case 'delete':
|
|
var keysToDelete_1 = new RangeSet().addKeys(op.keys);
|
|
modifedResult = result.filter(function(item) {
|
|
return !keysToDelete_1.hasKey(req.values ? extractPrimKey(item) : item);
|
|
});
|
|
break;
|
|
case 'deleteRange':
|
|
var range_1 = op.range;
|
|
modifedResult = result.filter(function(item) {
|
|
return !isWithinRange(extractPrimKey(item), range_1);
|
|
});
|
|
break;
|
|
}
|
|
return modifedResult;
|
|
}, result);
|
|
if (finalResult === result) return result;
|
|
finalResult.sort(function(a, b) {
|
|
return cmp(extractLowLevelIndex(a), extractLowLevelIndex(b)) || cmp(extractPrimKey(a), extractPrimKey(b));
|
|
});
|
|
if (req.limit && req.limit < Infinity) {
|
|
if (finalResult.length > req.limit) {
|
|
finalResult.length = req.limit;
|
|
} else if (result.length === req.limit && finalResult.length < req.limit) {
|
|
cacheEntry.dirty = true;
|
|
}
|
|
}
|
|
return immutable ? Object.freeze(finalResult) : finalResult;
|
|
}
|
|
function areRangesEqual(r1, r2) {
|
|
return cmp(r1.lower, r2.lower) === 0 && cmp(r1.upper, r2.upper) === 0 && !!r1.lowerOpen === !!r2.lowerOpen && !!r1.upperOpen === !!r2.upperOpen;
|
|
}
|
|
function compareLowers(lower1, lower2, lowerOpen1, lowerOpen2) {
|
|
if (lower1 === undefined) return lower2 !== undefined ? -1 : 0;
|
|
if (lower2 === undefined) return 1;
|
|
var c = cmp(lower1, lower2);
|
|
if (c === 0) {
|
|
if (lowerOpen1 && lowerOpen2) return 0;
|
|
if (lowerOpen1) return 1;
|
|
if (lowerOpen2) return -1;
|
|
}
|
|
return c;
|
|
}
|
|
function compareUppers(upper1, upper2, upperOpen1, upperOpen2) {
|
|
if (upper1 === undefined) return upper2 !== undefined ? 1 : 0;
|
|
if (upper2 === undefined) return -1;
|
|
var c = cmp(upper1, upper2);
|
|
if (c === 0) {
|
|
if (upperOpen1 && upperOpen2) return 0;
|
|
if (upperOpen1) return -1;
|
|
if (upperOpen2) return 1;
|
|
}
|
|
return c;
|
|
}
|
|
function isSuperRange(r1, r2) {
|
|
return compareLowers(r1.lower, r2.lower, r1.lowerOpen, r2.lowerOpen) <= 0 && compareUppers(r1.upper, r2.upper, r1.upperOpen, r2.upperOpen) >= 0;
|
|
}
|
|
function findCompatibleQuery(dbName, tableName, type, req) {
|
|
var tblCache = cache["idb://".concat(dbName, "/").concat(tableName)];
|
|
if (!tblCache) return [];
|
|
var queries = tblCache.queries[type];
|
|
if (!queries) return [
|
|
null,
|
|
false,
|
|
tblCache,
|
|
null
|
|
];
|
|
var indexName = req.query ? req.query.index.name : null;
|
|
var entries = queries[indexName || ''];
|
|
if (!entries) return [
|
|
null,
|
|
false,
|
|
tblCache,
|
|
null
|
|
];
|
|
switch(type){
|
|
case 'query':
|
|
var equalEntry = entries.find(function(entry) {
|
|
return entry.req.limit === req.limit && entry.req.values === req.values && areRangesEqual(entry.req.query.range, req.query.range);
|
|
});
|
|
if (equalEntry) return [
|
|
equalEntry,
|
|
true,
|
|
tblCache,
|
|
entries
|
|
];
|
|
var superEntry = entries.find(function(entry) {
|
|
var limit = 'limit' in entry.req ? entry.req.limit : Infinity;
|
|
return limit >= req.limit && (req.values ? entry.req.values : true) && isSuperRange(entry.req.query.range, req.query.range);
|
|
});
|
|
return [
|
|
superEntry,
|
|
false,
|
|
tblCache,
|
|
entries
|
|
];
|
|
case 'count':
|
|
var countQuery = entries.find(function(entry) {
|
|
return areRangesEqual(entry.req.query.range, req.query.range);
|
|
});
|
|
return [
|
|
countQuery,
|
|
!!countQuery,
|
|
tblCache,
|
|
entries
|
|
];
|
|
}
|
|
}
|
|
function subscribeToCacheEntry(cacheEntry, container, requery, signal) {
|
|
cacheEntry.subscribers.add(requery);
|
|
signal.addEventListener("abort", function() {
|
|
cacheEntry.subscribers.delete(requery);
|
|
if (cacheEntry.subscribers.size === 0) {
|
|
enqueForDeletion(cacheEntry, container);
|
|
}
|
|
});
|
|
}
|
|
function enqueForDeletion(cacheEntry, container) {
|
|
setTimeout(function() {
|
|
if (cacheEntry.subscribers.size === 0) {
|
|
delArrayItem(container, cacheEntry);
|
|
}
|
|
}, 3000);
|
|
}
|
|
var cacheMiddleware = {
|
|
stack: 'dbcore',
|
|
level: 0,
|
|
name: 'Cache',
|
|
create: function(core) {
|
|
var dbName = core.schema.name;
|
|
var coreMW = __assign(__assign({}, core), {
|
|
transaction: function(stores, mode, options) {
|
|
var idbtrans = core.transaction(stores, mode, options);
|
|
if (mode === 'readwrite') {
|
|
var ac_1 = new AbortController();
|
|
var signal = ac_1.signal;
|
|
var endTransaction = function(wasCommitted) {
|
|
return function() {
|
|
ac_1.abort();
|
|
if (mode === 'readwrite') {
|
|
var affectedSubscribers_1 = new Set();
|
|
for(var _i = 0, stores_1 = stores; _i < stores_1.length; _i++){
|
|
var storeName = stores_1[_i];
|
|
var tblCache = cache["idb://".concat(dbName, "/").concat(storeName)];
|
|
if (tblCache) {
|
|
var table = core.table(storeName);
|
|
var ops = tblCache.optimisticOps.filter(function(op) {
|
|
return op.trans === idbtrans;
|
|
});
|
|
if (idbtrans._explicit && wasCommitted && idbtrans.mutatedParts) {
|
|
for(var _a = 0, _b = Object.values(tblCache.queries.query); _a < _b.length; _a++){
|
|
var entries = _b[_a];
|
|
for(var _c = 0, _d = entries.slice(); _c < _d.length; _c++){
|
|
var entry = _d[_c];
|
|
if (obsSetsOverlap(entry.obsSet, idbtrans.mutatedParts)) {
|
|
delArrayItem(entries, entry);
|
|
entry.subscribers.forEach(function(requery) {
|
|
return affectedSubscribers_1.add(requery);
|
|
});
|
|
}
|
|
}
|
|
}
|
|
} else if (ops.length > 0) {
|
|
tblCache.optimisticOps = tblCache.optimisticOps.filter(function(op) {
|
|
return op.trans !== idbtrans;
|
|
});
|
|
for(var _e = 0, _f = Object.values(tblCache.queries.query); _e < _f.length; _e++){
|
|
var entries = _f[_e];
|
|
for(var _g = 0, _h = entries.slice(); _g < _h.length; _g++){
|
|
var entry = _h[_g];
|
|
if (entry.res != null && idbtrans.mutatedParts) {
|
|
if (wasCommitted && !entry.dirty) {
|
|
var freezeResults = Object.isFrozen(entry.res);
|
|
var modRes = applyOptimisticOps(entry.res, entry.req, ops, table, entry, freezeResults);
|
|
if (entry.dirty) {
|
|
delArrayItem(entries, entry);
|
|
entry.subscribers.forEach(function(requery) {
|
|
return affectedSubscribers_1.add(requery);
|
|
});
|
|
} else if (modRes !== entry.res) {
|
|
entry.res = modRes;
|
|
entry.promise = DexiePromise.resolve({
|
|
result: modRes
|
|
});
|
|
}
|
|
} else {
|
|
if (entry.dirty) {
|
|
delArrayItem(entries, entry);
|
|
}
|
|
entry.subscribers.forEach(function(requery) {
|
|
return affectedSubscribers_1.add(requery);
|
|
});
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
affectedSubscribers_1.forEach(function(requery) {
|
|
return requery();
|
|
});
|
|
}
|
|
};
|
|
};
|
|
idbtrans.addEventListener('abort', endTransaction(false), {
|
|
signal: signal
|
|
});
|
|
idbtrans.addEventListener('error', endTransaction(false), {
|
|
signal: signal
|
|
});
|
|
idbtrans.addEventListener('complete', endTransaction(true), {
|
|
signal: signal
|
|
});
|
|
}
|
|
return idbtrans;
|
|
},
|
|
table: function(tableName) {
|
|
var downTable = core.table(tableName);
|
|
var primKey = downTable.schema.primaryKey;
|
|
var tableMW = __assign(__assign({}, downTable), {
|
|
mutate: function(req) {
|
|
var trans = PSD.trans;
|
|
if (primKey.outbound || trans.db._options.cache === 'disabled' || trans.explicit || trans.idbtrans.mode !== 'readwrite') {
|
|
return downTable.mutate(req);
|
|
}
|
|
var tblCache = cache["idb://".concat(dbName, "/").concat(tableName)];
|
|
if (!tblCache) return downTable.mutate(req);
|
|
var promise = downTable.mutate(req);
|
|
if ((req.type === 'add' || req.type === 'put') && (req.values.length >= 50 || getEffectiveKeys(primKey, req).some(function(key) {
|
|
return key == null;
|
|
}))) {
|
|
promise.then(function(res) {
|
|
var reqWithResolvedKeys = __assign(__assign({}, req), {
|
|
values: req.values.map(function(value, i) {
|
|
var _a;
|
|
if (res.failures[i]) return value;
|
|
var valueWithKey = ((_a = primKey.keyPath) === null || _a === void 0 ? void 0 : _a.includes('.')) ? deepClone(value) : __assign({}, value);
|
|
setByKeyPath(valueWithKey, primKey.keyPath, res.results[i]);
|
|
return valueWithKey;
|
|
})
|
|
});
|
|
var adjustedReq = adjustOptimisticFromFailures(tblCache, reqWithResolvedKeys, res);
|
|
tblCache.optimisticOps.push(adjustedReq);
|
|
queueMicrotask(function() {
|
|
return req.mutatedParts && signalSubscribersLazily(req.mutatedParts);
|
|
});
|
|
});
|
|
} else {
|
|
tblCache.optimisticOps.push(req);
|
|
req.mutatedParts && signalSubscribersLazily(req.mutatedParts);
|
|
promise.then(function(res) {
|
|
if (res.numFailures > 0) {
|
|
delArrayItem(tblCache.optimisticOps, req);
|
|
var adjustedReq = adjustOptimisticFromFailures(tblCache, req, res);
|
|
if (adjustedReq) {
|
|
tblCache.optimisticOps.push(adjustedReq);
|
|
}
|
|
req.mutatedParts && signalSubscribersLazily(req.mutatedParts);
|
|
}
|
|
});
|
|
promise.catch(function() {
|
|
delArrayItem(tblCache.optimisticOps, req);
|
|
req.mutatedParts && signalSubscribersLazily(req.mutatedParts);
|
|
});
|
|
}
|
|
return promise;
|
|
},
|
|
query: function(req) {
|
|
var _a;
|
|
if (!isCachableContext(PSD, downTable) || !isCachableRequest("query", req)) return downTable.query(req);
|
|
var freezeResults = ((_a = PSD.trans) === null || _a === void 0 ? void 0 : _a.db._options.cache) === 'immutable';
|
|
var _b = PSD, requery = _b.requery, signal = _b.signal;
|
|
var _c = findCompatibleQuery(dbName, tableName, 'query', req), cacheEntry = _c[0], exactMatch = _c[1], tblCache = _c[2], container = _c[3];
|
|
if (cacheEntry && exactMatch) {
|
|
cacheEntry.obsSet = req.obsSet;
|
|
} else {
|
|
var promise = downTable.query(req).then(function(res) {
|
|
var result = res.result;
|
|
if (cacheEntry) cacheEntry.res = result;
|
|
if (freezeResults) {
|
|
for(var i = 0, l = result.length; i < l; ++i){
|
|
Object.freeze(result[i]);
|
|
}
|
|
Object.freeze(result);
|
|
} else {
|
|
res.result = deepClone(result);
|
|
}
|
|
return res;
|
|
}).catch(function(error) {
|
|
if (container && cacheEntry) delArrayItem(container, cacheEntry);
|
|
return Promise.reject(error);
|
|
});
|
|
cacheEntry = {
|
|
obsSet: req.obsSet,
|
|
promise: promise,
|
|
subscribers: new Set(),
|
|
type: 'query',
|
|
req: req,
|
|
dirty: false
|
|
};
|
|
if (container) {
|
|
container.push(cacheEntry);
|
|
} else {
|
|
container = [
|
|
cacheEntry
|
|
];
|
|
if (!tblCache) {
|
|
tblCache = cache["idb://".concat(dbName, "/").concat(tableName)] = {
|
|
queries: {
|
|
query: {},
|
|
count: {}
|
|
},
|
|
objs: new Map(),
|
|
optimisticOps: [],
|
|
unsignaledParts: {}
|
|
};
|
|
}
|
|
tblCache.queries.query[req.query.index.name || ''] = container;
|
|
}
|
|
}
|
|
subscribeToCacheEntry(cacheEntry, container, requery, signal);
|
|
return cacheEntry.promise.then(function(res) {
|
|
return {
|
|
result: applyOptimisticOps(res.result, req, tblCache === null || tblCache === void 0 ? void 0 : tblCache.optimisticOps, downTable, cacheEntry, freezeResults)
|
|
};
|
|
});
|
|
}
|
|
});
|
|
return tableMW;
|
|
}
|
|
});
|
|
return coreMW;
|
|
}
|
|
};
|
|
function vipify(target, vipDb) {
|
|
return new Proxy(target, {
|
|
get: function(target, prop, receiver) {
|
|
if (prop === 'db') return vipDb;
|
|
return Reflect.get(target, prop, receiver);
|
|
}
|
|
});
|
|
}
|
|
var Dexie$1 = function() {
|
|
function Dexie(name, options) {
|
|
var _this = this;
|
|
this._middlewares = {};
|
|
this.verno = 0;
|
|
var deps = Dexie.dependencies;
|
|
this._options = options = __assign({
|
|
addons: Dexie.addons,
|
|
autoOpen: true,
|
|
indexedDB: deps.indexedDB,
|
|
IDBKeyRange: deps.IDBKeyRange,
|
|
cache: 'cloned'
|
|
}, options);
|
|
this._deps = {
|
|
indexedDB: options.indexedDB,
|
|
IDBKeyRange: options.IDBKeyRange
|
|
};
|
|
var addons = options.addons;
|
|
this._dbSchema = {};
|
|
this._versions = [];
|
|
this._storeNames = [];
|
|
this._allTables = {};
|
|
this.idbdb = null;
|
|
this._novip = this;
|
|
var state = {
|
|
dbOpenError: null,
|
|
isBeingOpened: false,
|
|
onReadyBeingFired: null,
|
|
openComplete: false,
|
|
dbReadyResolve: nop,
|
|
dbReadyPromise: null,
|
|
cancelOpen: nop,
|
|
openCanceller: null,
|
|
autoSchema: true,
|
|
PR1398_maxLoop: 3,
|
|
autoOpen: options.autoOpen
|
|
};
|
|
state.dbReadyPromise = new DexiePromise(function(resolve) {
|
|
state.dbReadyResolve = resolve;
|
|
});
|
|
state.openCanceller = new DexiePromise(function(_, reject) {
|
|
state.cancelOpen = reject;
|
|
});
|
|
this._state = state;
|
|
this.name = name;
|
|
this.on = Events(this, "populate", "blocked", "versionchange", "close", {
|
|
ready: [
|
|
promisableChain,
|
|
nop
|
|
]
|
|
});
|
|
this.once = function(event, callback) {
|
|
var fn = function() {
|
|
var args = [];
|
|
for(var _i = 0; _i < arguments.length; _i++){
|
|
args[_i] = arguments[_i];
|
|
}
|
|
_this.on(event).unsubscribe(fn);
|
|
callback.apply(_this, args);
|
|
};
|
|
return _this.on(event, fn);
|
|
};
|
|
this.on.ready.subscribe = override(this.on.ready.subscribe, function(subscribe) {
|
|
return function(subscriber, bSticky) {
|
|
Dexie.vip(function() {
|
|
var state = _this._state;
|
|
if (state.openComplete) {
|
|
if (!state.dbOpenError) DexiePromise.resolve().then(subscriber);
|
|
if (bSticky) subscribe(subscriber);
|
|
} else if (state.onReadyBeingFired) {
|
|
state.onReadyBeingFired.push(subscriber);
|
|
if (bSticky) subscribe(subscriber);
|
|
} else {
|
|
subscribe(subscriber);
|
|
var db_1 = _this;
|
|
if (!bSticky) subscribe(function unsubscribe() {
|
|
db_1.on.ready.unsubscribe(subscriber);
|
|
db_1.on.ready.unsubscribe(unsubscribe);
|
|
});
|
|
}
|
|
});
|
|
};
|
|
});
|
|
this.Collection = createCollectionConstructor(this);
|
|
this.Table = createTableConstructor(this);
|
|
this.Transaction = createTransactionConstructor(this);
|
|
this.Version = createVersionConstructor(this);
|
|
this.WhereClause = createWhereClauseConstructor(this);
|
|
this.on("versionchange", function(ev) {
|
|
if (ev.newVersion > 0) console.warn("Another connection wants to upgrade database '".concat(_this.name, "'. Closing db now to resume the upgrade."));
|
|
else console.warn("Another connection wants to delete database '".concat(_this.name, "'. Closing db now to resume the delete request."));
|
|
_this.close({
|
|
disableAutoOpen: false
|
|
});
|
|
});
|
|
this.on("blocked", function(ev) {
|
|
if (!ev.newVersion || ev.newVersion < ev.oldVersion) console.warn("Dexie.delete('".concat(_this.name, "') was blocked"));
|
|
else console.warn("Upgrade '".concat(_this.name, "' blocked by other connection holding version ").concat(ev.oldVersion / 10));
|
|
});
|
|
this._maxKey = getMaxKey(options.IDBKeyRange);
|
|
this._createTransaction = function(mode, storeNames, dbschema, parentTransaction) {
|
|
return new _this.Transaction(mode, storeNames, dbschema, _this._options.chromeTransactionDurability, parentTransaction);
|
|
};
|
|
this._fireOnBlocked = function(ev) {
|
|
_this.on("blocked").fire(ev);
|
|
connections.filter(function(c) {
|
|
return c.name === _this.name && c !== _this && !c._state.vcFired;
|
|
}).map(function(c) {
|
|
return c.on("versionchange").fire(ev);
|
|
});
|
|
};
|
|
this.use(cacheExistingValuesMiddleware);
|
|
this.use(cacheMiddleware);
|
|
this.use(observabilityMiddleware);
|
|
this.use(virtualIndexMiddleware);
|
|
this.use(hooksMiddleware);
|
|
var vipDB = new Proxy(this, {
|
|
get: function(_, prop, receiver) {
|
|
if (prop === '_vip') return true;
|
|
if (prop === 'table') return function(tableName) {
|
|
return vipify(_this.table(tableName), vipDB);
|
|
};
|
|
var rv = Reflect.get(_, prop, receiver);
|
|
if (rv instanceof Table) return vipify(rv, vipDB);
|
|
if (prop === 'tables') return rv.map(function(t) {
|
|
return vipify(t, vipDB);
|
|
});
|
|
if (prop === '_createTransaction') return function() {
|
|
var tx = rv.apply(this, arguments);
|
|
return vipify(tx, vipDB);
|
|
};
|
|
return rv;
|
|
}
|
|
});
|
|
this.vip = vipDB;
|
|
addons.forEach(function(addon) {
|
|
return addon(_this);
|
|
});
|
|
}
|
|
Dexie.prototype.version = function(versionNumber) {
|
|
if (isNaN(versionNumber) || versionNumber < 0.1) throw new exceptions.Type("Given version is not a positive number");
|
|
versionNumber = Math.round(versionNumber * 10) / 10;
|
|
if (this.idbdb || this._state.isBeingOpened) throw new exceptions.Schema("Cannot add version when database is open");
|
|
this.verno = Math.max(this.verno, versionNumber);
|
|
var versions = this._versions;
|
|
var versionInstance = versions.filter(function(v) {
|
|
return v._cfg.version === versionNumber;
|
|
})[0];
|
|
if (versionInstance) return versionInstance;
|
|
versionInstance = new this.Version(versionNumber);
|
|
versions.push(versionInstance);
|
|
versions.sort(lowerVersionFirst);
|
|
versionInstance.stores({});
|
|
this._state.autoSchema = false;
|
|
return versionInstance;
|
|
};
|
|
Dexie.prototype._whenReady = function(fn) {
|
|
var _this = this;
|
|
return this.idbdb && (this._state.openComplete || PSD.letThrough || this._vip) ? fn() : new DexiePromise(function(resolve, reject) {
|
|
if (_this._state.openComplete) {
|
|
return reject(new exceptions.DatabaseClosed(_this._state.dbOpenError));
|
|
}
|
|
if (!_this._state.isBeingOpened) {
|
|
if (!_this._state.autoOpen) {
|
|
reject(new exceptions.DatabaseClosed());
|
|
return;
|
|
}
|
|
_this.open().catch(nop);
|
|
}
|
|
_this._state.dbReadyPromise.then(resolve, reject);
|
|
}).then(fn);
|
|
};
|
|
Dexie.prototype.use = function(_a) {
|
|
var stack = _a.stack, create = _a.create, level = _a.level, name = _a.name;
|
|
if (name) this.unuse({
|
|
stack: stack,
|
|
name: name
|
|
});
|
|
var middlewares = this._middlewares[stack] || (this._middlewares[stack] = []);
|
|
middlewares.push({
|
|
stack: stack,
|
|
create: create,
|
|
level: level == null ? 10 : level,
|
|
name: name
|
|
});
|
|
middlewares.sort(function(a, b) {
|
|
return a.level - b.level;
|
|
});
|
|
return this;
|
|
};
|
|
Dexie.prototype.unuse = function(_a) {
|
|
var stack = _a.stack, name = _a.name, create = _a.create;
|
|
if (stack && this._middlewares[stack]) {
|
|
this._middlewares[stack] = this._middlewares[stack].filter(function(mw) {
|
|
return create ? mw.create !== create : name ? mw.name !== name : false;
|
|
});
|
|
}
|
|
return this;
|
|
};
|
|
Dexie.prototype.open = function() {
|
|
var _this = this;
|
|
return usePSD(globalPSD, function() {
|
|
return dexieOpen(_this);
|
|
});
|
|
};
|
|
Dexie.prototype._close = function() {
|
|
this.on.close.fire(new CustomEvent('close'));
|
|
var state = this._state;
|
|
var idx = connections.indexOf(this);
|
|
if (idx >= 0) connections.splice(idx, 1);
|
|
if (this.idbdb) {
|
|
try {
|
|
this.idbdb.close();
|
|
} catch (e) {}
|
|
this.idbdb = null;
|
|
}
|
|
if (!state.isBeingOpened) {
|
|
state.dbReadyPromise = new DexiePromise(function(resolve) {
|
|
state.dbReadyResolve = resolve;
|
|
});
|
|
state.openCanceller = new DexiePromise(function(_, reject) {
|
|
state.cancelOpen = reject;
|
|
});
|
|
}
|
|
};
|
|
Dexie.prototype.close = function(_a) {
|
|
var _b = _a === void 0 ? {
|
|
disableAutoOpen: true
|
|
} : _a, disableAutoOpen = _b.disableAutoOpen;
|
|
var state = this._state;
|
|
if (disableAutoOpen) {
|
|
if (state.isBeingOpened) {
|
|
state.cancelOpen(new exceptions.DatabaseClosed());
|
|
}
|
|
this._close();
|
|
state.autoOpen = false;
|
|
state.dbOpenError = new exceptions.DatabaseClosed();
|
|
} else {
|
|
this._close();
|
|
state.autoOpen = this._options.autoOpen || state.isBeingOpened;
|
|
state.openComplete = false;
|
|
state.dbOpenError = null;
|
|
}
|
|
};
|
|
Dexie.prototype.delete = function(closeOptions) {
|
|
var _this = this;
|
|
if (closeOptions === void 0) {
|
|
closeOptions = {
|
|
disableAutoOpen: true
|
|
};
|
|
}
|
|
var hasInvalidArguments = arguments.length > 0 && typeof arguments[0] !== 'object';
|
|
var state = this._state;
|
|
return new DexiePromise(function(resolve, reject) {
|
|
var doDelete = function() {
|
|
_this.close(closeOptions);
|
|
var req = _this._deps.indexedDB.deleteDatabase(_this.name);
|
|
req.onsuccess = wrap(function() {
|
|
_onDatabaseDeleted(_this._deps, _this.name);
|
|
resolve();
|
|
});
|
|
req.onerror = eventRejectHandler(reject);
|
|
req.onblocked = _this._fireOnBlocked;
|
|
};
|
|
if (hasInvalidArguments) throw new exceptions.InvalidArgument("Invalid closeOptions argument to db.delete()");
|
|
if (state.isBeingOpened) {
|
|
state.dbReadyPromise.then(doDelete);
|
|
} else {
|
|
doDelete();
|
|
}
|
|
});
|
|
};
|
|
Dexie.prototype.backendDB = function() {
|
|
return this.idbdb;
|
|
};
|
|
Dexie.prototype.isOpen = function() {
|
|
return this.idbdb !== null;
|
|
};
|
|
Dexie.prototype.hasBeenClosed = function() {
|
|
var dbOpenError = this._state.dbOpenError;
|
|
return dbOpenError && dbOpenError.name === 'DatabaseClosed';
|
|
};
|
|
Dexie.prototype.hasFailed = function() {
|
|
return this._state.dbOpenError !== null;
|
|
};
|
|
Dexie.prototype.dynamicallyOpened = function() {
|
|
return this._state.autoSchema;
|
|
};
|
|
Object.defineProperty(Dexie.prototype, "tables", {
|
|
get: function() {
|
|
var _this = this;
|
|
return keys(this._allTables).map(function(name) {
|
|
return _this._allTables[name];
|
|
});
|
|
},
|
|
enumerable: false,
|
|
configurable: true
|
|
});
|
|
Dexie.prototype.transaction = function() {
|
|
var args = extractTransactionArgs.apply(this, arguments);
|
|
return this._transaction.apply(this, args);
|
|
};
|
|
Dexie.prototype._transaction = function(mode, tables, scopeFunc) {
|
|
var _this = this;
|
|
var parentTransaction = PSD.trans;
|
|
if (!parentTransaction || parentTransaction.db !== this || mode.indexOf('!') !== -1) parentTransaction = null;
|
|
var onlyIfCompatible = mode.indexOf('?') !== -1;
|
|
mode = mode.replace('!', '').replace('?', '');
|
|
var idbMode, storeNames;
|
|
try {
|
|
storeNames = tables.map(function(table) {
|
|
var storeName = table instanceof _this.Table ? table.name : table;
|
|
if (typeof storeName !== 'string') throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");
|
|
return storeName;
|
|
});
|
|
if (mode == "r" || mode === READONLY) idbMode = READONLY;
|
|
else if (mode == "rw" || mode == READWRITE) idbMode = READWRITE;
|
|
else throw new exceptions.InvalidArgument("Invalid transaction mode: " + mode);
|
|
if (parentTransaction) {
|
|
if (parentTransaction.mode === READONLY && idbMode === READWRITE) {
|
|
if (onlyIfCompatible) {
|
|
parentTransaction = null;
|
|
} else throw new exceptions.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");
|
|
}
|
|
if (parentTransaction) {
|
|
storeNames.forEach(function(storeName) {
|
|
if (parentTransaction && parentTransaction.storeNames.indexOf(storeName) === -1) {
|
|
if (onlyIfCompatible) {
|
|
parentTransaction = null;
|
|
} else throw new exceptions.SubTransaction("Table " + storeName + " not included in parent transaction.");
|
|
}
|
|
});
|
|
}
|
|
if (onlyIfCompatible && parentTransaction && !parentTransaction.active) {
|
|
parentTransaction = null;
|
|
}
|
|
}
|
|
} catch (e) {
|
|
return parentTransaction ? parentTransaction._promise(null, function(_, reject) {
|
|
reject(e);
|
|
}) : rejection(e);
|
|
}
|
|
var enterTransaction = enterTransactionScope.bind(null, this, idbMode, storeNames, parentTransaction, scopeFunc);
|
|
return parentTransaction ? parentTransaction._promise(idbMode, enterTransaction, "lock") : PSD.trans ? usePSD(PSD.transless, function() {
|
|
return _this._whenReady(enterTransaction);
|
|
}) : this._whenReady(enterTransaction);
|
|
};
|
|
Dexie.prototype.table = function(tableName) {
|
|
if (!hasOwn(this._allTables, tableName)) {
|
|
throw new exceptions.InvalidTable("Table ".concat(tableName, " does not exist"));
|
|
}
|
|
return this._allTables[tableName];
|
|
};
|
|
return Dexie;
|
|
}();
|
|
var symbolObservable = typeof Symbol !== "undefined" && "observable" in Symbol ? Symbol.observable : "@@observable";
|
|
var Observable = function() {
|
|
function Observable(subscribe) {
|
|
this._subscribe = subscribe;
|
|
}
|
|
Observable.prototype.subscribe = function(x, error, complete) {
|
|
return this._subscribe(!x || typeof x === "function" ? {
|
|
next: x,
|
|
error: error,
|
|
complete: complete
|
|
} : x);
|
|
};
|
|
Observable.prototype[symbolObservable] = function() {
|
|
return this;
|
|
};
|
|
return Observable;
|
|
}();
|
|
var domDeps;
|
|
try {
|
|
domDeps = {
|
|
indexedDB: _global.indexedDB || _global.mozIndexedDB || _global.webkitIndexedDB || _global.msIndexedDB,
|
|
IDBKeyRange: _global.IDBKeyRange || _global.webkitIDBKeyRange
|
|
};
|
|
} catch (e) {
|
|
domDeps = {
|
|
indexedDB: null,
|
|
IDBKeyRange: null
|
|
};
|
|
}
|
|
function liveQuery(querier) {
|
|
var hasValue = false;
|
|
var currentValue;
|
|
var observable = new Observable(function(observer) {
|
|
var scopeFuncIsAsync = isAsyncFunction(querier);
|
|
function execute(ctx) {
|
|
var wasRootExec = beginMicroTickScope();
|
|
try {
|
|
if (scopeFuncIsAsync) {
|
|
incrementExpectedAwaits();
|
|
}
|
|
var rv = newScope(querier, ctx);
|
|
if (scopeFuncIsAsync) {
|
|
rv = rv.finally(decrementExpectedAwaits);
|
|
}
|
|
return rv;
|
|
} finally{
|
|
wasRootExec && endMicroTickScope();
|
|
}
|
|
}
|
|
var closed = false;
|
|
var abortController;
|
|
var accumMuts = {};
|
|
var currentObs = {};
|
|
var subscription = {
|
|
get closed () {
|
|
return closed;
|
|
},
|
|
unsubscribe: function() {
|
|
if (closed) return;
|
|
closed = true;
|
|
if (abortController) abortController.abort();
|
|
if (startedListening) globalEvents.storagemutated.unsubscribe(mutationListener);
|
|
}
|
|
};
|
|
observer.start && observer.start(subscription);
|
|
var startedListening = false;
|
|
var doQuery = function() {
|
|
return execInGlobalContext(_doQuery);
|
|
};
|
|
function shouldNotify() {
|
|
return obsSetsOverlap(currentObs, accumMuts);
|
|
}
|
|
var mutationListener = function(parts) {
|
|
extendObservabilitySet(accumMuts, parts);
|
|
if (shouldNotify()) {
|
|
doQuery();
|
|
}
|
|
};
|
|
var _doQuery = function() {
|
|
if (closed || !domDeps.indexedDB) {
|
|
return;
|
|
}
|
|
accumMuts = {};
|
|
var subscr = {};
|
|
if (abortController) abortController.abort();
|
|
abortController = new AbortController();
|
|
var ctx = {
|
|
subscr: subscr,
|
|
signal: abortController.signal,
|
|
requery: doQuery,
|
|
querier: querier,
|
|
trans: null
|
|
};
|
|
var ret = execute(ctx);
|
|
Promise.resolve(ret).then(function(result) {
|
|
hasValue = true;
|
|
currentValue = result;
|
|
if (closed || ctx.signal.aborted) {
|
|
return;
|
|
}
|
|
accumMuts = {};
|
|
currentObs = subscr;
|
|
if (!objectIsEmpty(currentObs) && !startedListening) {
|
|
globalEvents(DEXIE_STORAGE_MUTATED_EVENT_NAME, mutationListener);
|
|
startedListening = true;
|
|
}
|
|
execInGlobalContext(function() {
|
|
return !closed && observer.next && observer.next(result);
|
|
});
|
|
}, function(err) {
|
|
hasValue = false;
|
|
if (![
|
|
'DatabaseClosedError',
|
|
'AbortError'
|
|
].includes(err === null || err === void 0 ? void 0 : err.name)) {
|
|
if (!closed) execInGlobalContext(function() {
|
|
if (closed) return;
|
|
observer.error && observer.error(err);
|
|
});
|
|
}
|
|
});
|
|
};
|
|
setTimeout(doQuery, 0);
|
|
return subscription;
|
|
});
|
|
observable.hasValue = function() {
|
|
return hasValue;
|
|
};
|
|
observable.getValue = function() {
|
|
return currentValue;
|
|
};
|
|
return observable;
|
|
}
|
|
var Dexie = Dexie$1;
|
|
props(Dexie, __assign(__assign({}, fullNameExceptions), {
|
|
delete: function(databaseName) {
|
|
var db = new Dexie(databaseName, {
|
|
addons: []
|
|
});
|
|
return db.delete();
|
|
},
|
|
exists: function(name) {
|
|
return new Dexie(name, {
|
|
addons: []
|
|
}).open().then(function(db) {
|
|
db.close();
|
|
return true;
|
|
}).catch('NoSuchDatabaseError', function() {
|
|
return false;
|
|
});
|
|
},
|
|
getDatabaseNames: function(cb) {
|
|
try {
|
|
return getDatabaseNames(Dexie.dependencies).then(cb);
|
|
} catch (_a) {
|
|
return rejection(new exceptions.MissingAPI());
|
|
}
|
|
},
|
|
defineClass: function() {
|
|
function Class(content) {
|
|
extend(this, content);
|
|
}
|
|
return Class;
|
|
},
|
|
ignoreTransaction: function(scopeFunc) {
|
|
return PSD.trans ? usePSD(PSD.transless, scopeFunc) : scopeFunc();
|
|
},
|
|
vip: vip,
|
|
async: function(generatorFn) {
|
|
return function() {
|
|
try {
|
|
var rv = awaitIterator(generatorFn.apply(this, arguments));
|
|
if (!rv || typeof rv.then !== 'function') return DexiePromise.resolve(rv);
|
|
return rv;
|
|
} catch (e) {
|
|
return rejection(e);
|
|
}
|
|
};
|
|
},
|
|
spawn: function(generatorFn, args, thiz) {
|
|
try {
|
|
var rv = awaitIterator(generatorFn.apply(thiz, args || []));
|
|
if (!rv || typeof rv.then !== 'function') return DexiePromise.resolve(rv);
|
|
return rv;
|
|
} catch (e) {
|
|
return rejection(e);
|
|
}
|
|
},
|
|
currentTransaction: {
|
|
get: function() {
|
|
return PSD.trans || null;
|
|
}
|
|
},
|
|
waitFor: function(promiseOrFunction, optionalTimeout) {
|
|
var promise = DexiePromise.resolve(typeof promiseOrFunction === 'function' ? Dexie.ignoreTransaction(promiseOrFunction) : promiseOrFunction).timeout(optionalTimeout || 60000);
|
|
return PSD.trans ? PSD.trans.waitFor(promise) : promise;
|
|
},
|
|
Promise: DexiePromise,
|
|
debug: {
|
|
get: function() {
|
|
return debug;
|
|
},
|
|
set: function(value) {
|
|
setDebug(value);
|
|
}
|
|
},
|
|
derive: derive,
|
|
extend: extend,
|
|
props: props,
|
|
override: override,
|
|
Events: Events,
|
|
on: globalEvents,
|
|
liveQuery: liveQuery,
|
|
extendObservabilitySet: extendObservabilitySet,
|
|
getByKeyPath: getByKeyPath,
|
|
setByKeyPath: setByKeyPath,
|
|
delByKeyPath: delByKeyPath,
|
|
shallowClone: shallowClone,
|
|
deepClone: deepClone,
|
|
getObjectDiff: getObjectDiff,
|
|
cmp: cmp,
|
|
asap: asap$1,
|
|
minKey: minKey,
|
|
addons: [],
|
|
connections: connections,
|
|
errnames: errnames,
|
|
dependencies: domDeps,
|
|
cache: cache,
|
|
semVer: DEXIE_VERSION,
|
|
version: DEXIE_VERSION.split('.').map(function(n) {
|
|
return parseInt(n);
|
|
}).reduce(function(p, c, i) {
|
|
return p + c / Math.pow(10, i * 2);
|
|
})
|
|
}));
|
|
Dexie.maxKey = getMaxKey(Dexie.dependencies.IDBKeyRange);
|
|
if (typeof dispatchEvent !== 'undefined' && typeof addEventListener !== 'undefined') {
|
|
globalEvents(DEXIE_STORAGE_MUTATED_EVENT_NAME, function(updatedParts) {
|
|
if (!propagatingLocally) {
|
|
var event_1;
|
|
event_1 = new CustomEvent(STORAGE_MUTATED_DOM_EVENT_NAME, {
|
|
detail: updatedParts
|
|
});
|
|
propagatingLocally = true;
|
|
dispatchEvent(event_1);
|
|
propagatingLocally = false;
|
|
}
|
|
});
|
|
addEventListener(STORAGE_MUTATED_DOM_EVENT_NAME, function(_a) {
|
|
var detail = _a.detail;
|
|
if (!propagatingLocally) {
|
|
propagateLocally(detail);
|
|
}
|
|
});
|
|
}
|
|
function propagateLocally(updateParts) {
|
|
var wasMe = propagatingLocally;
|
|
try {
|
|
propagatingLocally = true;
|
|
globalEvents.storagemutated.fire(updateParts);
|
|
signalSubscribersNow(updateParts, true);
|
|
} finally{
|
|
propagatingLocally = wasMe;
|
|
}
|
|
}
|
|
var propagatingLocally = false;
|
|
var bc;
|
|
var createBC = function() {};
|
|
if (typeof BroadcastChannel !== 'undefined') {
|
|
createBC = function() {
|
|
bc = new BroadcastChannel(STORAGE_MUTATED_DOM_EVENT_NAME);
|
|
bc.onmessage = function(ev) {
|
|
return ev.data && propagateLocally(ev.data);
|
|
};
|
|
};
|
|
createBC();
|
|
if (typeof bc.unref === 'function') {
|
|
bc.unref();
|
|
}
|
|
globalEvents(DEXIE_STORAGE_MUTATED_EVENT_NAME, function(changedParts) {
|
|
if (!propagatingLocally) {
|
|
bc.postMessage(changedParts);
|
|
}
|
|
});
|
|
}
|
|
if (typeof addEventListener !== 'undefined') {
|
|
addEventListener('pagehide', function(event) {
|
|
if (!Dexie$1.disableBfCache && event.persisted) {
|
|
if (debug) console.debug('Dexie: handling persisted pagehide');
|
|
bc === null || bc === void 0 ? void 0 : bc.close();
|
|
for(var _i = 0, connections_1 = connections; _i < connections_1.length; _i++){
|
|
var db = connections_1[_i];
|
|
db.close({
|
|
disableAutoOpen: false
|
|
});
|
|
}
|
|
}
|
|
});
|
|
addEventListener('pageshow', function(event) {
|
|
if (!Dexie$1.disableBfCache && event.persisted) {
|
|
if (debug) console.debug('Dexie: handling persisted pageshow');
|
|
createBC();
|
|
propagateLocally({
|
|
all: new RangeSet(-Infinity, [
|
|
[]
|
|
])
|
|
});
|
|
}
|
|
});
|
|
}
|
|
function add(value) {
|
|
return new PropModification({
|
|
add: value
|
|
});
|
|
}
|
|
function remove(value) {
|
|
return new PropModification({
|
|
remove: value
|
|
});
|
|
}
|
|
function replacePrefix(a, b) {
|
|
return new PropModification({
|
|
replacePrefix: [
|
|
a,
|
|
b
|
|
]
|
|
});
|
|
}
|
|
DexiePromise.rejectionMapper = mapError;
|
|
setDebug(debug);
|
|
var namedExports = /*#__PURE__*/ Object.freeze({
|
|
__proto__: null,
|
|
Dexie: Dexie$1,
|
|
liveQuery: liveQuery,
|
|
Entity: Entity,
|
|
cmp: cmp,
|
|
PropModification: PropModification,
|
|
replacePrefix: replacePrefix,
|
|
add: add,
|
|
remove: remove,
|
|
'default': Dexie$1,
|
|
RangeSet: RangeSet,
|
|
mergeRanges: mergeRanges,
|
|
rangesOverlap: rangesOverlap
|
|
});
|
|
__assign(Dexie$1, namedExports, {
|
|
default: Dexie$1
|
|
});
|
|
return Dexie$1;
|
|
}); //# sourceMappingURL=dexie.js.map
|
|
}),
|
|
"[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/dexie@4.2.1/node_modules/dexie/import-wrapper.mjs [app-client] (ecmascript)", ((__turbopack_context__) => {
|
|
"use strict";
|
|
|
|
// Making the module version consumable via require - to prohibit
|
|
// multiple occurrancies of the same module in the same app
|
|
// (dual package hazard, https://nodejs.org/api/packages.html#dual-package-hazard)
|
|
__turbopack_context__.s([
|
|
"Dexie",
|
|
()=>Dexie,
|
|
"DexieYProvider",
|
|
()=>DexieYProvider,
|
|
"Entity",
|
|
()=>Entity,
|
|
"PropModification",
|
|
()=>PropModification,
|
|
"RangeSet",
|
|
()=>RangeSet,
|
|
"add",
|
|
()=>add,
|
|
"cmp",
|
|
()=>cmp,
|
|
"default",
|
|
()=>__TURBOPACK__default__export__,
|
|
"liveQuery",
|
|
()=>liveQuery,
|
|
"mergeRanges",
|
|
()=>mergeRanges,
|
|
"rangesOverlap",
|
|
()=>rangesOverlap,
|
|
"remove",
|
|
()=>remove,
|
|
"replacePrefix",
|
|
()=>replacePrefix
|
|
]);
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$dexie$40$4$2e$2$2e$1$2f$node_modules$2f$dexie$2f$dist$2f$dexie$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/dexie@4.2.1/node_modules/dexie/dist/dexie.js [app-client] (ecmascript)");
|
|
;
|
|
const DexieSymbol = Symbol.for("Dexie");
|
|
const Dexie = globalThis[DexieSymbol] || (globalThis[DexieSymbol] = __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$dexie$40$4$2e$2$2e$1$2f$node_modules$2f$dexie$2f$dist$2f$dexie$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"]);
|
|
if (__TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$dexie$40$4$2e$2$2e$1$2f$node_modules$2f$dexie$2f$dist$2f$dexie$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].semVer !== Dexie.semVer) {
|
|
throw new Error(`Two different versions of Dexie loaded in the same app: ${__TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$dexie$40$4$2e$2$2e$1$2f$node_modules$2f$dexie$2f$dist$2f$dexie$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].semVer} and ${Dexie.semVer}`);
|
|
}
|
|
const { liveQuery, mergeRanges, rangesOverlap, RangeSet, cmp, Entity, PropModification, replacePrefix, add, remove, DexieYProvider } = Dexie;
|
|
;
|
|
const __TURBOPACK__default__export__ = Dexie;
|
|
}),
|
|
"[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/dexie-react-hooks@4.2.0_@types+react@19.2.6_dexie@4.2.1_react@19.2.0/node_modules/dexie-react-hooks/dist/dexie-react-hooks.mjs [app-client] (ecmascript)", ((__turbopack_context__) => {
|
|
"use strict";
|
|
|
|
__turbopack_context__.s([
|
|
"useDocument",
|
|
()=>useDocument,
|
|
"useLiveQuery",
|
|
()=>useLiveQuery,
|
|
"useObservable",
|
|
()=>useObservable,
|
|
"usePermissions",
|
|
()=>usePermissions
|
|
]);
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$dexie$40$4$2e$2$2e$1$2f$node_modules$2f$dexie$2f$import$2d$wrapper$2e$mjs__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/dexie@4.2.1/node_modules/dexie/import-wrapper.mjs [app-client] (ecmascript)");
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/next@16.0.3_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/next/dist/compiled/react/index.js [app-client] (ecmascript)");
|
|
;
|
|
;
|
|
function useObservable(observableFactory, arg2, arg3) {
|
|
// Resolve vars from overloading variants of this function:
|
|
var deps;
|
|
var defaultResult;
|
|
if (typeof observableFactory === 'function') {
|
|
deps = arg2 || [];
|
|
defaultResult = arg3;
|
|
} else {
|
|
deps = [];
|
|
defaultResult = arg2;
|
|
}
|
|
// Create a ref that keeps the state we need
|
|
var monitor = __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useRef({
|
|
hasResult: false,
|
|
result: defaultResult,
|
|
error: null
|
|
});
|
|
// We control when component should rerender. Make triggerUpdate
|
|
// as examplified on React's docs at:
|
|
// https://reactjs.org/docs/hooks-faq.html#is-there-something-like-forceupdate
|
|
var _a = __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useReducer({
|
|
"useObservable.useReducer[_a]": function(x) {
|
|
return x + 1;
|
|
}
|
|
}["useObservable.useReducer[_a]"], 0);
|
|
_a[0];
|
|
var triggerUpdate = _a[1];
|
|
// Memoize the observable based on deps
|
|
var observable = __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useMemo({
|
|
"useObservable.useMemo[observable]": function() {
|
|
// Make it remember previous subscription's default value when
|
|
// resubscribing.
|
|
var observable = typeof observableFactory === 'function' ? observableFactory() : observableFactory;
|
|
if (!observable || typeof observable.subscribe !== 'function') {
|
|
if (observableFactory === observable) {
|
|
throw new TypeError("Given argument to useObservable() was neither a valid observable nor a function.");
|
|
} else {
|
|
throw new TypeError("Observable factory given to useObservable() did not return a valid observable.");
|
|
}
|
|
}
|
|
if (!monitor.current.hasResult && typeof window !== 'undefined' // Don't do this in SSR
|
|
) {
|
|
// Optimize for BehaviorSubject and other observables implementing getValue():
|
|
if (typeof observable.hasValue !== 'function' || observable.hasValue()) {
|
|
if (typeof observable.getValue === 'function') {
|
|
monitor.current.result = observable.getValue();
|
|
monitor.current.hasResult = true;
|
|
} else {
|
|
// Find out if the observable has a current value: try get it by subscribing and
|
|
// unsubscribing synchronously
|
|
var subscription = observable.subscribe({
|
|
"useObservable.useMemo[observable].subscription": function(val) {
|
|
monitor.current.result = val;
|
|
monitor.current.hasResult = true;
|
|
}
|
|
}["useObservable.useMemo[observable].subscription"]);
|
|
// Unsubscribe directly. We only needed any synchronous value if it was possible.
|
|
if (typeof subscription === 'function') {
|
|
subscription();
|
|
} else {
|
|
subscription.unsubscribe();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return observable;
|
|
}
|
|
}["useObservable.useMemo[observable]"], deps);
|
|
// Integrate with react devtools:
|
|
__TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useDebugValue(monitor.current.result);
|
|
// Subscribe to the observable
|
|
__TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useEffect({
|
|
"useObservable.useEffect": function() {
|
|
var subscription = observable.subscribe({
|
|
"useObservable.useEffect.subscription": function(val) {
|
|
var current = monitor.current;
|
|
if (current.error !== null || current.result !== val) {
|
|
current.error = null;
|
|
current.result = val;
|
|
current.hasResult = true;
|
|
triggerUpdate();
|
|
}
|
|
}
|
|
}["useObservable.useEffect.subscription"], {
|
|
"useObservable.useEffect.subscription": function(err) {
|
|
var current = monitor.current;
|
|
if (current.error !== err) {
|
|
current.error = err;
|
|
triggerUpdate();
|
|
}
|
|
}
|
|
}["useObservable.useEffect.subscription"]);
|
|
return typeof subscription === 'function' ? subscription // Support observables that return unsubscribe directly
|
|
: subscription.unsubscribe.bind(subscription);
|
|
}
|
|
}["useObservable.useEffect"], deps);
|
|
// Throw if observable has emitted error so that
|
|
// an ErrorBoundrary can catch it
|
|
if (monitor.current.error) throw monitor.current.error;
|
|
// Return the current result
|
|
return monitor.current.result;
|
|
}
|
|
function useLiveQuery(querier, deps, defaultResult) {
|
|
return useObservable({
|
|
"useLiveQuery.useObservable": function() {
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$dexie$40$4$2e$2$2e$1$2f$node_modules$2f$dexie$2f$import$2d$wrapper$2e$mjs__$5b$app$2d$client$5d$__$28$ecmascript$29$__["Dexie"].liveQuery(querier);
|
|
}
|
|
}["useLiveQuery.useObservable"], deps || [], defaultResult);
|
|
}
|
|
function usePermissions(firstArg, table, obj) {
|
|
if (!firstArg) throw new TypeError("Invalid arguments to usePermissions(): undefined or null");
|
|
var db;
|
|
if (arguments.length >= 3) {
|
|
if (!('transaction' in firstArg)) {
|
|
// Using ducktyping instead of instanceof in case there are multiple Dexie modules in app.
|
|
// First arg is ensures first arg is a Dexie instance
|
|
throw new TypeError("Invalid arguments to usePermission(db, table, obj): 1st arg must be a Dexie instance");
|
|
}
|
|
if (typeof table !== 'string') throw new TypeError("Invalid arguments to usePermission(db, table, obj): 2nd arg must be string");
|
|
if (!obj || typeof obj !== 'object') throw new TypeError("Invalid arguments to usePermission(db, table, obj): 3rd arg must be an object");
|
|
db = firstArg;
|
|
} else {
|
|
if (firstArg instanceof __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$dexie$40$4$2e$2$2e$1$2f$node_modules$2f$dexie$2f$import$2d$wrapper$2e$mjs__$5b$app$2d$client$5d$__$28$ecmascript$29$__["Dexie"]) throw new TypeError("Invalid arguments to usePermission(db, table, obj): Missing table and obj arguments.");
|
|
if (typeof firstArg.table === 'function' && typeof firstArg.db === 'object') {
|
|
db = firstArg.db;
|
|
obj = firstArg;
|
|
table = firstArg.table();
|
|
} else {
|
|
throw new TypeError("Invalid arguments to usePermissions(). " + "Expected usePermissions(entity: DexieCloudEntity) or " + "usePermissions(db: Dexie, table: string, obj: DexieCloudObject)");
|
|
}
|
|
}
|
|
if (!('cloud' in db)) throw new Error("usePermissions() is only for Dexie Cloud but there's no dexie-cloud-addon active in given db.");
|
|
if (!('permissions' in db.cloud)) throw new Error("usePermissions() requires a newer version of dexie-cloud-addon. Please upgrade it.");
|
|
return useObservable({
|
|
"usePermissions.useObservable": // @ts-ignore
|
|
function() {
|
|
return db.cloud.permissions(obj, table);
|
|
}
|
|
}["usePermissions.useObservable"], [
|
|
obj.realmId,
|
|
obj.owner,
|
|
table
|
|
]);
|
|
}
|
|
var gracePeriod = 100; // 100 ms = grace period to optimize for unload/reload scenarios
|
|
var fr = typeof FinalizationRegistry !== 'undefined' && new FinalizationRegistry(function(doc) {
|
|
// If coming here, react effect never ran. This is a fallback cleanup mechanism.
|
|
var DexieYProvider = __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$dexie$40$4$2e$2$2e$1$2f$node_modules$2f$dexie$2f$import$2d$wrapper$2e$mjs__$5b$app$2d$client$5d$__$28$ecmascript$29$__["Dexie"]['DexieYProvider'];
|
|
if (DexieYProvider) DexieYProvider.release(doc);
|
|
});
|
|
function useDocument(doc) {
|
|
var _a, _b;
|
|
if (!fr) throw new TypeError('FinalizationRegistry not supported.');
|
|
var providerRef = __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useRef(null);
|
|
var DexieYProvider = __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$dexie$40$4$2e$2$2e$1$2f$node_modules$2f$dexie$2f$import$2d$wrapper$2e$mjs__$5b$app$2d$client$5d$__$28$ecmascript$29$__["Dexie"]['DexieYProvider'];
|
|
if (!DexieYProvider) {
|
|
throw new Error('DexieYProvider is not available. Make sure `y-dexie` is installed and imported.');
|
|
}
|
|
var unregisterToken = undefined;
|
|
if (doc) {
|
|
if (doc !== ((_a = providerRef.current) === null || _a === void 0 ? void 0 : _a.doc)) {
|
|
providerRef.current = DexieYProvider.load(doc, {
|
|
gracePeriod: gracePeriod
|
|
});
|
|
unregisterToken = Object.create(null);
|
|
fr.register(providerRef, doc, unregisterToken);
|
|
}
|
|
} else if ((_b = providerRef.current) === null || _b === void 0 ? void 0 : _b.doc) {
|
|
providerRef.current = null;
|
|
}
|
|
__TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"].useEffect({
|
|
"useDocument.useEffect": function() {
|
|
if (doc) {
|
|
// Doc is set or changed. Unregister provider from FinalizationRegistry
|
|
// and instead take over from here to release the doc when component is unmounted
|
|
// or when doc is changed. What we're doing here is to avoid relying on FinalizationRegistry
|
|
// in all the normal cases and instead rely on React's lifecycle to release the doc.
|
|
// But there can be situations when react never calls this effect and therefore, we
|
|
// need to rely on FinalizationRegistry to release the doc as a fallback.
|
|
// We cannot wait with loading the document until the effect happens, because the doc
|
|
// could have been destroyed in the meantime.
|
|
if (unregisterToken) fr.unregister(unregisterToken);
|
|
var provider = DexieYProvider.for(doc);
|
|
if (provider) {
|
|
return ({
|
|
"useDocument.useEffect": function() {
|
|
DexieYProvider.release(doc);
|
|
}
|
|
})["useDocument.useEffect"];
|
|
} else {
|
|
// Maybe the doc was destroyed in the meantime.
|
|
// Can not happen if React and FinalizationRegistry works as we expect them to.
|
|
// Except if a user had called DexieYProvider.release() on the doc
|
|
throw new Error("FATAL. DexieYProvider.release() has been called somewhere in application code, making us lose the document.");
|
|
}
|
|
}
|
|
}
|
|
}["useDocument.useEffect"], [
|
|
doc,
|
|
unregisterToken
|
|
]);
|
|
return providerRef.current;
|
|
}
|
|
;
|
|
//# sourceMappingURL=dexie-react-hooks.mjs.map
|
|
}),
|
|
"[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/@radix-ui+react-compose-refs@1.1.1_@types+react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-compose-refs/dist/index.mjs [app-client] (ecmascript)", ((__turbopack_context__) => {
|
|
"use strict";
|
|
|
|
// packages/react/compose-refs/src/composeRefs.tsx
|
|
__turbopack_context__.s([
|
|
"composeRefs",
|
|
()=>composeRefs,
|
|
"useComposedRefs",
|
|
()=>useComposedRefs
|
|
]);
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/next@16.0.3_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/next/dist/compiled/react/index.js [app-client] (ecmascript)");
|
|
;
|
|
function setRef(ref, value) {
|
|
if (typeof ref === "function") {
|
|
return ref(value);
|
|
} else if (ref !== null && ref !== void 0) {
|
|
ref.current = value;
|
|
}
|
|
}
|
|
function composeRefs(...refs) {
|
|
return (node)=>{
|
|
let hasCleanup = false;
|
|
const cleanups = refs.map((ref)=>{
|
|
const cleanup = setRef(ref, node);
|
|
if (!hasCleanup && typeof cleanup == "function") {
|
|
hasCleanup = true;
|
|
}
|
|
return cleanup;
|
|
});
|
|
if (hasCleanup) {
|
|
return ()=>{
|
|
for(let i = 0; i < cleanups.length; i++){
|
|
const cleanup = cleanups[i];
|
|
if (typeof cleanup == "function") {
|
|
cleanup();
|
|
} else {
|
|
setRef(refs[i], null);
|
|
}
|
|
}
|
|
};
|
|
}
|
|
};
|
|
}
|
|
function useComposedRefs(...refs) {
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["useCallback"](composeRefs(...refs), refs);
|
|
}
|
|
;
|
|
//# sourceMappingURL=index.mjs.map
|
|
}),
|
|
"[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/@radix-ui+react-slot@1.1.1_@types+react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-slot/dist/index.mjs [app-client] (ecmascript)", ((__turbopack_context__) => {
|
|
"use strict";
|
|
|
|
// packages/react/slot/src/Slot.tsx
|
|
__turbopack_context__.s([
|
|
"Root",
|
|
()=>Root,
|
|
"Slot",
|
|
()=>Slot,
|
|
"Slottable",
|
|
()=>Slottable
|
|
]);
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/next@16.0.3_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/next/dist/compiled/react/index.js [app-client] (ecmascript)");
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f40$radix$2d$ui$2b$react$2d$compose$2d$refs$40$1$2e$1$2e$1_$40$types$2b$react$40$19$2e$2$2e$6_react$40$19$2e$2$2e$0$2f$node_modules$2f40$radix$2d$ui$2f$react$2d$compose$2d$refs$2f$dist$2f$index$2e$mjs__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/@radix-ui+react-compose-refs@1.1.1_@types+react@19.2.6_react@19.2.0/node_modules/@radix-ui/react-compose-refs/dist/index.mjs [app-client] (ecmascript)");
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$jsx$2d$runtime$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/next@16.0.3_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/next/dist/compiled/react/jsx-runtime.js [app-client] (ecmascript)");
|
|
;
|
|
;
|
|
;
|
|
var Slot = __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["forwardRef"]((props, forwardedRef)=>{
|
|
const { children, ...slotProps } = props;
|
|
const childrenArray = __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["Children"].toArray(children);
|
|
const slottable = childrenArray.find(isSlottable);
|
|
if (slottable) {
|
|
const newElement = slottable.props.children;
|
|
const newChildren = childrenArray.map((child)=>{
|
|
if (child === slottable) {
|
|
if (__TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["Children"].count(newElement) > 1) return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["Children"].only(null);
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["isValidElement"](newElement) ? newElement.props.children : null;
|
|
} else {
|
|
return child;
|
|
}
|
|
});
|
|
return /* @__PURE__ */ (0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$jsx$2d$runtime$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["jsx"])(SlotClone, {
|
|
...slotProps,
|
|
ref: forwardedRef,
|
|
children: __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["isValidElement"](newElement) ? __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["cloneElement"](newElement, void 0, newChildren) : null
|
|
});
|
|
}
|
|
return /* @__PURE__ */ (0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$jsx$2d$runtime$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["jsx"])(SlotClone, {
|
|
...slotProps,
|
|
ref: forwardedRef,
|
|
children
|
|
});
|
|
});
|
|
Slot.displayName = "Slot";
|
|
var SlotClone = __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["forwardRef"]((props, forwardedRef)=>{
|
|
const { children, ...slotProps } = props;
|
|
if (__TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["isValidElement"](children)) {
|
|
const childrenRef = getElementRef(children);
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["cloneElement"](children, {
|
|
...mergeProps(slotProps, children.props),
|
|
// @ts-ignore
|
|
ref: forwardedRef ? (0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f40$radix$2d$ui$2b$react$2d$compose$2d$refs$40$1$2e$1$2e$1_$40$types$2b$react$40$19$2e$2$2e$6_react$40$19$2e$2$2e$0$2f$node_modules$2f40$radix$2d$ui$2f$react$2d$compose$2d$refs$2f$dist$2f$index$2e$mjs__$5b$app$2d$client$5d$__$28$ecmascript$29$__["composeRefs"])(forwardedRef, childrenRef) : childrenRef
|
|
});
|
|
}
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["Children"].count(children) > 1 ? __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["Children"].only(null) : null;
|
|
});
|
|
SlotClone.displayName = "SlotClone";
|
|
var Slottable = ({ children })=>{
|
|
return /* @__PURE__ */ (0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$jsx$2d$runtime$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["jsx"])(__TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$jsx$2d$runtime$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["Fragment"], {
|
|
children
|
|
});
|
|
};
|
|
function isSlottable(child) {
|
|
return __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["isValidElement"](child) && child.type === Slottable;
|
|
}
|
|
function mergeProps(slotProps, childProps) {
|
|
const overrideProps = {
|
|
...childProps
|
|
};
|
|
for(const propName in childProps){
|
|
const slotPropValue = slotProps[propName];
|
|
const childPropValue = childProps[propName];
|
|
const isHandler = /^on[A-Z]/.test(propName);
|
|
if (isHandler) {
|
|
if (slotPropValue && childPropValue) {
|
|
overrideProps[propName] = (...args)=>{
|
|
childPropValue(...args);
|
|
slotPropValue(...args);
|
|
};
|
|
} else if (slotPropValue) {
|
|
overrideProps[propName] = slotPropValue;
|
|
}
|
|
} else if (propName === "style") {
|
|
overrideProps[propName] = {
|
|
...slotPropValue,
|
|
...childPropValue
|
|
};
|
|
} else if (propName === "className") {
|
|
overrideProps[propName] = [
|
|
slotPropValue,
|
|
childPropValue
|
|
].filter(Boolean).join(" ");
|
|
}
|
|
}
|
|
return {
|
|
...slotProps,
|
|
...overrideProps
|
|
};
|
|
}
|
|
function getElementRef(element) {
|
|
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
if (mayWarn) {
|
|
return element.ref;
|
|
}
|
|
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
if (mayWarn) {
|
|
return element.props.ref;
|
|
}
|
|
return element.props.ref || element.ref;
|
|
}
|
|
var Root = Slot;
|
|
;
|
|
//# sourceMappingURL=index.mjs.map
|
|
}),
|
|
"[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs [app-client] (ecmascript)", ((__turbopack_context__) => {
|
|
"use strict";
|
|
|
|
__turbopack_context__.s([
|
|
"clsx",
|
|
()=>clsx,
|
|
"default",
|
|
()=>__TURBOPACK__default__export__
|
|
]);
|
|
function r(e) {
|
|
var t, f, n = "";
|
|
if ("string" == typeof e || "number" == typeof e) n += e;
|
|
else if ("object" == typeof e) if (Array.isArray(e)) {
|
|
var o = e.length;
|
|
for(t = 0; t < o; t++)e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
} else for(f in e)e[f] && (n && (n += " "), n += f);
|
|
return n;
|
|
}
|
|
function clsx() {
|
|
for(var e, t, f = 0, n = "", o = arguments.length; f < o; f++)(e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
return n;
|
|
}
|
|
const __TURBOPACK__default__export__ = clsx;
|
|
}),
|
|
"[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/class-variance-authority@0.7.1/node_modules/class-variance-authority/dist/index.mjs [app-client] (ecmascript)", ((__turbopack_context__) => {
|
|
"use strict";
|
|
|
|
/**
|
|
* Copyright 2022 Joe Bell. All rights reserved.
|
|
*
|
|
* This file is licensed to you under the Apache License, Version 2.0
|
|
* (the "License"); you may not use this file except in compliance with the
|
|
* License. You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
* WARRANTIES OR REPRESENTATIONS OF ANY KIND, either express or implied. See the
|
|
* License for the specific language governing permissions and limitations under
|
|
* the License.
|
|
*/ __turbopack_context__.s([
|
|
"cva",
|
|
()=>cva,
|
|
"cx",
|
|
()=>cx
|
|
]);
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$clsx$40$2$2e$1$2e$1$2f$node_modules$2f$clsx$2f$dist$2f$clsx$2e$mjs__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs [app-client] (ecmascript)");
|
|
;
|
|
const falsyToString = (value)=>typeof value === "boolean" ? `${value}` : value === 0 ? "0" : value;
|
|
const cx = __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$clsx$40$2$2e$1$2e$1$2f$node_modules$2f$clsx$2f$dist$2f$clsx$2e$mjs__$5b$app$2d$client$5d$__$28$ecmascript$29$__["clsx"];
|
|
const cva = (base, config)=>(props)=>{
|
|
var _config_compoundVariants;
|
|
if ((config === null || config === void 0 ? void 0 : config.variants) == null) return cx(base, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
const { variants, defaultVariants } = config;
|
|
const getVariantClassNames = Object.keys(variants).map((variant)=>{
|
|
const variantProp = props === null || props === void 0 ? void 0 : props[variant];
|
|
const defaultVariantProp = defaultVariants === null || defaultVariants === void 0 ? void 0 : defaultVariants[variant];
|
|
if (variantProp === null) return null;
|
|
const variantKey = falsyToString(variantProp) || falsyToString(defaultVariantProp);
|
|
return variants[variant][variantKey];
|
|
});
|
|
const propsWithoutUndefined = props && Object.entries(props).reduce((acc, param)=>{
|
|
let [key, value] = param;
|
|
if (value === undefined) {
|
|
return acc;
|
|
}
|
|
acc[key] = value;
|
|
return acc;
|
|
}, {});
|
|
const getCompoundVariantClassNames = config === null || config === void 0 ? void 0 : (_config_compoundVariants = config.compoundVariants) === null || _config_compoundVariants === void 0 ? void 0 : _config_compoundVariants.reduce((acc, param)=>{
|
|
let { class: cvClass, className: cvClassName, ...compoundVariantOptions } = param;
|
|
return Object.entries(compoundVariantOptions).every((param)=>{
|
|
let [key, value] = param;
|
|
return Array.isArray(value) ? value.includes({
|
|
...defaultVariants,
|
|
...propsWithoutUndefined
|
|
}[key]) : ({
|
|
...defaultVariants,
|
|
...propsWithoutUndefined
|
|
})[key] === value;
|
|
}) ? [
|
|
...acc,
|
|
cvClass,
|
|
cvClassName
|
|
] : acc;
|
|
}, []);
|
|
return cx(base, getVariantClassNames, getCompoundVariantClassNames, props === null || props === void 0 ? void 0 : props.class, props === null || props === void 0 ? void 0 : props.className);
|
|
};
|
|
}),
|
|
"[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/tailwind-merge@2.6.0/node_modules/tailwind-merge/dist/bundle-mjs.mjs [app-client] (ecmascript)", ((__turbopack_context__) => {
|
|
"use strict";
|
|
|
|
__turbopack_context__.s([
|
|
"createTailwindMerge",
|
|
()=>createTailwindMerge,
|
|
"extendTailwindMerge",
|
|
()=>extendTailwindMerge,
|
|
"fromTheme",
|
|
()=>fromTheme,
|
|
"getDefaultConfig",
|
|
()=>getDefaultConfig,
|
|
"mergeConfigs",
|
|
()=>mergeConfigs,
|
|
"twJoin",
|
|
()=>twJoin,
|
|
"twMerge",
|
|
()=>twMerge,
|
|
"validators",
|
|
()=>validators
|
|
]);
|
|
const CLASS_PART_SEPARATOR = '-';
|
|
const createClassGroupUtils = (config)=>{
|
|
const classMap = createClassMap(config);
|
|
const { conflictingClassGroups, conflictingClassGroupModifiers } = config;
|
|
const getClassGroupId = (className)=>{
|
|
const classParts = className.split(CLASS_PART_SEPARATOR);
|
|
// Classes like `-inset-1` produce an empty string as first classPart. We assume that classes for negative values are used correctly and remove it from classParts.
|
|
if (classParts[0] === '' && classParts.length !== 1) {
|
|
classParts.shift();
|
|
}
|
|
return getGroupRecursive(classParts, classMap) || getGroupIdForArbitraryProperty(className);
|
|
};
|
|
const getConflictingClassGroupIds = (classGroupId, hasPostfixModifier)=>{
|
|
const conflicts = conflictingClassGroups[classGroupId] || [];
|
|
if (hasPostfixModifier && conflictingClassGroupModifiers[classGroupId]) {
|
|
return [
|
|
...conflicts,
|
|
...conflictingClassGroupModifiers[classGroupId]
|
|
];
|
|
}
|
|
return conflicts;
|
|
};
|
|
return {
|
|
getClassGroupId,
|
|
getConflictingClassGroupIds
|
|
};
|
|
};
|
|
const getGroupRecursive = (classParts, classPartObject)=>{
|
|
if (classParts.length === 0) {
|
|
return classPartObject.classGroupId;
|
|
}
|
|
const currentClassPart = classParts[0];
|
|
const nextClassPartObject = classPartObject.nextPart.get(currentClassPart);
|
|
const classGroupFromNextClassPart = nextClassPartObject ? getGroupRecursive(classParts.slice(1), nextClassPartObject) : undefined;
|
|
if (classGroupFromNextClassPart) {
|
|
return classGroupFromNextClassPart;
|
|
}
|
|
if (classPartObject.validators.length === 0) {
|
|
return undefined;
|
|
}
|
|
const classRest = classParts.join(CLASS_PART_SEPARATOR);
|
|
return classPartObject.validators.find(({ validator })=>validator(classRest))?.classGroupId;
|
|
};
|
|
const arbitraryPropertyRegex = /^\[(.+)\]$/;
|
|
const getGroupIdForArbitraryProperty = (className)=>{
|
|
if (arbitraryPropertyRegex.test(className)) {
|
|
const arbitraryPropertyClassName = arbitraryPropertyRegex.exec(className)[1];
|
|
const property = arbitraryPropertyClassName?.substring(0, arbitraryPropertyClassName.indexOf(':'));
|
|
if (property) {
|
|
// I use two dots here because one dot is used as prefix for class groups in plugins
|
|
return 'arbitrary..' + property;
|
|
}
|
|
}
|
|
};
|
|
/**
|
|
* Exported for testing only
|
|
*/ const createClassMap = (config)=>{
|
|
const { theme, prefix } = config;
|
|
const classMap = {
|
|
nextPart: new Map(),
|
|
validators: []
|
|
};
|
|
const prefixedClassGroupEntries = getPrefixedClassGroupEntries(Object.entries(config.classGroups), prefix);
|
|
prefixedClassGroupEntries.forEach(([classGroupId, classGroup])=>{
|
|
processClassesRecursively(classGroup, classMap, classGroupId, theme);
|
|
});
|
|
return classMap;
|
|
};
|
|
const processClassesRecursively = (classGroup, classPartObject, classGroupId, theme)=>{
|
|
classGroup.forEach((classDefinition)=>{
|
|
if (typeof classDefinition === 'string') {
|
|
const classPartObjectToEdit = classDefinition === '' ? classPartObject : getPart(classPartObject, classDefinition);
|
|
classPartObjectToEdit.classGroupId = classGroupId;
|
|
return;
|
|
}
|
|
if (typeof classDefinition === 'function') {
|
|
if (isThemeGetter(classDefinition)) {
|
|
processClassesRecursively(classDefinition(theme), classPartObject, classGroupId, theme);
|
|
return;
|
|
}
|
|
classPartObject.validators.push({
|
|
validator: classDefinition,
|
|
classGroupId
|
|
});
|
|
return;
|
|
}
|
|
Object.entries(classDefinition).forEach(([key, classGroup])=>{
|
|
processClassesRecursively(classGroup, getPart(classPartObject, key), classGroupId, theme);
|
|
});
|
|
});
|
|
};
|
|
const getPart = (classPartObject, path)=>{
|
|
let currentClassPartObject = classPartObject;
|
|
path.split(CLASS_PART_SEPARATOR).forEach((pathPart)=>{
|
|
if (!currentClassPartObject.nextPart.has(pathPart)) {
|
|
currentClassPartObject.nextPart.set(pathPart, {
|
|
nextPart: new Map(),
|
|
validators: []
|
|
});
|
|
}
|
|
currentClassPartObject = currentClassPartObject.nextPart.get(pathPart);
|
|
});
|
|
return currentClassPartObject;
|
|
};
|
|
const isThemeGetter = (func)=>func.isThemeGetter;
|
|
const getPrefixedClassGroupEntries = (classGroupEntries, prefix)=>{
|
|
if (!prefix) {
|
|
return classGroupEntries;
|
|
}
|
|
return classGroupEntries.map(([classGroupId, classGroup])=>{
|
|
const prefixedClassGroup = classGroup.map((classDefinition)=>{
|
|
if (typeof classDefinition === 'string') {
|
|
return prefix + classDefinition;
|
|
}
|
|
if (typeof classDefinition === 'object') {
|
|
return Object.fromEntries(Object.entries(classDefinition).map(([key, value])=>[
|
|
prefix + key,
|
|
value
|
|
]));
|
|
}
|
|
return classDefinition;
|
|
});
|
|
return [
|
|
classGroupId,
|
|
prefixedClassGroup
|
|
];
|
|
});
|
|
};
|
|
// LRU cache inspired from hashlru (https://github.com/dominictarr/hashlru/blob/v1.0.4/index.js) but object replaced with Map to improve performance
|
|
const createLruCache = (maxCacheSize)=>{
|
|
if (maxCacheSize < 1) {
|
|
return {
|
|
get: ()=>undefined,
|
|
set: ()=>{}
|
|
};
|
|
}
|
|
let cacheSize = 0;
|
|
let cache = new Map();
|
|
let previousCache = new Map();
|
|
const update = (key, value)=>{
|
|
cache.set(key, value);
|
|
cacheSize++;
|
|
if (cacheSize > maxCacheSize) {
|
|
cacheSize = 0;
|
|
previousCache = cache;
|
|
cache = new Map();
|
|
}
|
|
};
|
|
return {
|
|
get (key) {
|
|
let value = cache.get(key);
|
|
if (value !== undefined) {
|
|
return value;
|
|
}
|
|
if ((value = previousCache.get(key)) !== undefined) {
|
|
update(key, value);
|
|
return value;
|
|
}
|
|
},
|
|
set (key, value) {
|
|
if (cache.has(key)) {
|
|
cache.set(key, value);
|
|
} else {
|
|
update(key, value);
|
|
}
|
|
}
|
|
};
|
|
};
|
|
const IMPORTANT_MODIFIER = '!';
|
|
const createParseClassName = (config)=>{
|
|
const { separator, experimentalParseClassName } = config;
|
|
const isSeparatorSingleCharacter = separator.length === 1;
|
|
const firstSeparatorCharacter = separator[0];
|
|
const separatorLength = separator.length;
|
|
// parseClassName inspired by https://github.com/tailwindlabs/tailwindcss/blob/v3.2.2/src/util/splitAtTopLevelOnly.js
|
|
const parseClassName = (className)=>{
|
|
const modifiers = [];
|
|
let bracketDepth = 0;
|
|
let modifierStart = 0;
|
|
let postfixModifierPosition;
|
|
for(let index = 0; index < className.length; index++){
|
|
let currentCharacter = className[index];
|
|
if (bracketDepth === 0) {
|
|
if (currentCharacter === firstSeparatorCharacter && (isSeparatorSingleCharacter || className.slice(index, index + separatorLength) === separator)) {
|
|
modifiers.push(className.slice(modifierStart, index));
|
|
modifierStart = index + separatorLength;
|
|
continue;
|
|
}
|
|
if (currentCharacter === '/') {
|
|
postfixModifierPosition = index;
|
|
continue;
|
|
}
|
|
}
|
|
if (currentCharacter === '[') {
|
|
bracketDepth++;
|
|
} else if (currentCharacter === ']') {
|
|
bracketDepth--;
|
|
}
|
|
}
|
|
const baseClassNameWithImportantModifier = modifiers.length === 0 ? className : className.substring(modifierStart);
|
|
const hasImportantModifier = baseClassNameWithImportantModifier.startsWith(IMPORTANT_MODIFIER);
|
|
const baseClassName = hasImportantModifier ? baseClassNameWithImportantModifier.substring(1) : baseClassNameWithImportantModifier;
|
|
const maybePostfixModifierPosition = postfixModifierPosition && postfixModifierPosition > modifierStart ? postfixModifierPosition - modifierStart : undefined;
|
|
return {
|
|
modifiers,
|
|
hasImportantModifier,
|
|
baseClassName,
|
|
maybePostfixModifierPosition
|
|
};
|
|
};
|
|
if (experimentalParseClassName) {
|
|
return (className)=>experimentalParseClassName({
|
|
className,
|
|
parseClassName
|
|
});
|
|
}
|
|
return parseClassName;
|
|
};
|
|
/**
|
|
* Sorts modifiers according to following schema:
|
|
* - Predefined modifiers are sorted alphabetically
|
|
* - When an arbitrary variant appears, it must be preserved which modifiers are before and after it
|
|
*/ const sortModifiers = (modifiers)=>{
|
|
if (modifiers.length <= 1) {
|
|
return modifiers;
|
|
}
|
|
const sortedModifiers = [];
|
|
let unsortedModifiers = [];
|
|
modifiers.forEach((modifier)=>{
|
|
const isArbitraryVariant = modifier[0] === '[';
|
|
if (isArbitraryVariant) {
|
|
sortedModifiers.push(...unsortedModifiers.sort(), modifier);
|
|
unsortedModifiers = [];
|
|
} else {
|
|
unsortedModifiers.push(modifier);
|
|
}
|
|
});
|
|
sortedModifiers.push(...unsortedModifiers.sort());
|
|
return sortedModifiers;
|
|
};
|
|
const createConfigUtils = (config)=>({
|
|
cache: createLruCache(config.cacheSize),
|
|
parseClassName: createParseClassName(config),
|
|
...createClassGroupUtils(config)
|
|
});
|
|
const SPLIT_CLASSES_REGEX = /\s+/;
|
|
const mergeClassList = (classList, configUtils)=>{
|
|
const { parseClassName, getClassGroupId, getConflictingClassGroupIds } = configUtils;
|
|
/**
|
|
* Set of classGroupIds in following format:
|
|
* `{importantModifier}{variantModifiers}{classGroupId}`
|
|
* @example 'float'
|
|
* @example 'hover:focus:bg-color'
|
|
* @example 'md:!pr'
|
|
*/ const classGroupsInConflict = [];
|
|
const classNames = classList.trim().split(SPLIT_CLASSES_REGEX);
|
|
let result = '';
|
|
for(let index = classNames.length - 1; index >= 0; index -= 1){
|
|
const originalClassName = classNames[index];
|
|
const { modifiers, hasImportantModifier, baseClassName, maybePostfixModifierPosition } = parseClassName(originalClassName);
|
|
let hasPostfixModifier = Boolean(maybePostfixModifierPosition);
|
|
let classGroupId = getClassGroupId(hasPostfixModifier ? baseClassName.substring(0, maybePostfixModifierPosition) : baseClassName);
|
|
if (!classGroupId) {
|
|
if (!hasPostfixModifier) {
|
|
// Not a Tailwind class
|
|
result = originalClassName + (result.length > 0 ? ' ' + result : result);
|
|
continue;
|
|
}
|
|
classGroupId = getClassGroupId(baseClassName);
|
|
if (!classGroupId) {
|
|
// Not a Tailwind class
|
|
result = originalClassName + (result.length > 0 ? ' ' + result : result);
|
|
continue;
|
|
}
|
|
hasPostfixModifier = false;
|
|
}
|
|
const variantModifier = sortModifiers(modifiers).join(':');
|
|
const modifierId = hasImportantModifier ? variantModifier + IMPORTANT_MODIFIER : variantModifier;
|
|
const classId = modifierId + classGroupId;
|
|
if (classGroupsInConflict.includes(classId)) {
|
|
continue;
|
|
}
|
|
classGroupsInConflict.push(classId);
|
|
const conflictGroups = getConflictingClassGroupIds(classGroupId, hasPostfixModifier);
|
|
for(let i = 0; i < conflictGroups.length; ++i){
|
|
const group = conflictGroups[i];
|
|
classGroupsInConflict.push(modifierId + group);
|
|
}
|
|
// Tailwind class not in conflict
|
|
result = originalClassName + (result.length > 0 ? ' ' + result : result);
|
|
}
|
|
return result;
|
|
};
|
|
/**
|
|
* The code in this file is copied from https://github.com/lukeed/clsx and modified to suit the needs of tailwind-merge better.
|
|
*
|
|
* Specifically:
|
|
* - Runtime code from https://github.com/lukeed/clsx/blob/v1.2.1/src/index.js
|
|
* - TypeScript types from https://github.com/lukeed/clsx/blob/v1.2.1/clsx.d.ts
|
|
*
|
|
* Original code has MIT license: Copyright (c) Luke Edwards <luke.edwards05@gmail.com> (lukeed.com)
|
|
*/ function twJoin() {
|
|
let index = 0;
|
|
let argument;
|
|
let resolvedValue;
|
|
let string = '';
|
|
while(index < arguments.length){
|
|
if (argument = arguments[index++]) {
|
|
if (resolvedValue = toValue(argument)) {
|
|
string && (string += ' ');
|
|
string += resolvedValue;
|
|
}
|
|
}
|
|
}
|
|
return string;
|
|
}
|
|
const toValue = (mix)=>{
|
|
if (typeof mix === 'string') {
|
|
return mix;
|
|
}
|
|
let resolvedValue;
|
|
let string = '';
|
|
for(let k = 0; k < mix.length; k++){
|
|
if (mix[k]) {
|
|
if (resolvedValue = toValue(mix[k])) {
|
|
string && (string += ' ');
|
|
string += resolvedValue;
|
|
}
|
|
}
|
|
}
|
|
return string;
|
|
};
|
|
function createTailwindMerge(createConfigFirst, ...createConfigRest) {
|
|
let configUtils;
|
|
let cacheGet;
|
|
let cacheSet;
|
|
let functionToCall = initTailwindMerge;
|
|
function initTailwindMerge(classList) {
|
|
const config = createConfigRest.reduce((previousConfig, createConfigCurrent)=>createConfigCurrent(previousConfig), createConfigFirst());
|
|
configUtils = createConfigUtils(config);
|
|
cacheGet = configUtils.cache.get;
|
|
cacheSet = configUtils.cache.set;
|
|
functionToCall = tailwindMerge;
|
|
return tailwindMerge(classList);
|
|
}
|
|
function tailwindMerge(classList) {
|
|
const cachedResult = cacheGet(classList);
|
|
if (cachedResult) {
|
|
return cachedResult;
|
|
}
|
|
const result = mergeClassList(classList, configUtils);
|
|
cacheSet(classList, result);
|
|
return result;
|
|
}
|
|
return function callTailwindMerge() {
|
|
return functionToCall(twJoin.apply(null, arguments));
|
|
};
|
|
}
|
|
const fromTheme = (key)=>{
|
|
const themeGetter = (theme)=>theme[key] || [];
|
|
themeGetter.isThemeGetter = true;
|
|
return themeGetter;
|
|
};
|
|
const arbitraryValueRegex = /^\[(?:([a-z-]+):)?(.+)\]$/i;
|
|
const fractionRegex = /^\d+\/\d+$/;
|
|
const stringLengths = /*#__PURE__*/ new Set([
|
|
'px',
|
|
'full',
|
|
'screen'
|
|
]);
|
|
const tshirtUnitRegex = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/;
|
|
const lengthUnitRegex = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/;
|
|
const colorFunctionRegex = /^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/;
|
|
// Shadow always begins with x and y offset separated by underscore optionally prepended by inset
|
|
const shadowRegex = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/;
|
|
const imageRegex = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/;
|
|
const isLength = (value)=>isNumber(value) || stringLengths.has(value) || fractionRegex.test(value);
|
|
const isArbitraryLength = (value)=>getIsArbitraryValue(value, 'length', isLengthOnly);
|
|
const isNumber = (value)=>Boolean(value) && !Number.isNaN(Number(value));
|
|
const isArbitraryNumber = (value)=>getIsArbitraryValue(value, 'number', isNumber);
|
|
const isInteger = (value)=>Boolean(value) && Number.isInteger(Number(value));
|
|
const isPercent = (value)=>value.endsWith('%') && isNumber(value.slice(0, -1));
|
|
const isArbitraryValue = (value)=>arbitraryValueRegex.test(value);
|
|
const isTshirtSize = (value)=>tshirtUnitRegex.test(value);
|
|
const sizeLabels = /*#__PURE__*/ new Set([
|
|
'length',
|
|
'size',
|
|
'percentage'
|
|
]);
|
|
const isArbitrarySize = (value)=>getIsArbitraryValue(value, sizeLabels, isNever);
|
|
const isArbitraryPosition = (value)=>getIsArbitraryValue(value, 'position', isNever);
|
|
const imageLabels = /*#__PURE__*/ new Set([
|
|
'image',
|
|
'url'
|
|
]);
|
|
const isArbitraryImage = (value)=>getIsArbitraryValue(value, imageLabels, isImage);
|
|
const isArbitraryShadow = (value)=>getIsArbitraryValue(value, '', isShadow);
|
|
const isAny = ()=>true;
|
|
const getIsArbitraryValue = (value, label, testValue)=>{
|
|
const result = arbitraryValueRegex.exec(value);
|
|
if (result) {
|
|
if (result[1]) {
|
|
return typeof label === 'string' ? result[1] === label : label.has(result[1]);
|
|
}
|
|
return testValue(result[2]);
|
|
}
|
|
return false;
|
|
};
|
|
const isLengthOnly = (value)=>// `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths.
|
|
// For example, `hsl(0 0% 0%)` would be classified as a length without this check.
|
|
// I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
|
|
lengthUnitRegex.test(value) && !colorFunctionRegex.test(value);
|
|
const isNever = ()=>false;
|
|
const isShadow = (value)=>shadowRegex.test(value);
|
|
const isImage = (value)=>imageRegex.test(value);
|
|
const validators = /*#__PURE__*/ Object.defineProperty({
|
|
__proto__: null,
|
|
isAny,
|
|
isArbitraryImage,
|
|
isArbitraryLength,
|
|
isArbitraryNumber,
|
|
isArbitraryPosition,
|
|
isArbitraryShadow,
|
|
isArbitrarySize,
|
|
isArbitraryValue,
|
|
isInteger,
|
|
isLength,
|
|
isNumber,
|
|
isPercent,
|
|
isTshirtSize
|
|
}, Symbol.toStringTag, {
|
|
value: 'Module'
|
|
});
|
|
const getDefaultConfig = ()=>{
|
|
const colors = fromTheme('colors');
|
|
const spacing = fromTheme('spacing');
|
|
const blur = fromTheme('blur');
|
|
const brightness = fromTheme('brightness');
|
|
const borderColor = fromTheme('borderColor');
|
|
const borderRadius = fromTheme('borderRadius');
|
|
const borderSpacing = fromTheme('borderSpacing');
|
|
const borderWidth = fromTheme('borderWidth');
|
|
const contrast = fromTheme('contrast');
|
|
const grayscale = fromTheme('grayscale');
|
|
const hueRotate = fromTheme('hueRotate');
|
|
const invert = fromTheme('invert');
|
|
const gap = fromTheme('gap');
|
|
const gradientColorStops = fromTheme('gradientColorStops');
|
|
const gradientColorStopPositions = fromTheme('gradientColorStopPositions');
|
|
const inset = fromTheme('inset');
|
|
const margin = fromTheme('margin');
|
|
const opacity = fromTheme('opacity');
|
|
const padding = fromTheme('padding');
|
|
const saturate = fromTheme('saturate');
|
|
const scale = fromTheme('scale');
|
|
const sepia = fromTheme('sepia');
|
|
const skew = fromTheme('skew');
|
|
const space = fromTheme('space');
|
|
const translate = fromTheme('translate');
|
|
const getOverscroll = ()=>[
|
|
'auto',
|
|
'contain',
|
|
'none'
|
|
];
|
|
const getOverflow = ()=>[
|
|
'auto',
|
|
'hidden',
|
|
'clip',
|
|
'visible',
|
|
'scroll'
|
|
];
|
|
const getSpacingWithAutoAndArbitrary = ()=>[
|
|
'auto',
|
|
isArbitraryValue,
|
|
spacing
|
|
];
|
|
const getSpacingWithArbitrary = ()=>[
|
|
isArbitraryValue,
|
|
spacing
|
|
];
|
|
const getLengthWithEmptyAndArbitrary = ()=>[
|
|
'',
|
|
isLength,
|
|
isArbitraryLength
|
|
];
|
|
const getNumberWithAutoAndArbitrary = ()=>[
|
|
'auto',
|
|
isNumber,
|
|
isArbitraryValue
|
|
];
|
|
const getPositions = ()=>[
|
|
'bottom',
|
|
'center',
|
|
'left',
|
|
'left-bottom',
|
|
'left-top',
|
|
'right',
|
|
'right-bottom',
|
|
'right-top',
|
|
'top'
|
|
];
|
|
const getLineStyles = ()=>[
|
|
'solid',
|
|
'dashed',
|
|
'dotted',
|
|
'double',
|
|
'none'
|
|
];
|
|
const getBlendModes = ()=>[
|
|
'normal',
|
|
'multiply',
|
|
'screen',
|
|
'overlay',
|
|
'darken',
|
|
'lighten',
|
|
'color-dodge',
|
|
'color-burn',
|
|
'hard-light',
|
|
'soft-light',
|
|
'difference',
|
|
'exclusion',
|
|
'hue',
|
|
'saturation',
|
|
'color',
|
|
'luminosity'
|
|
];
|
|
const getAlign = ()=>[
|
|
'start',
|
|
'end',
|
|
'center',
|
|
'between',
|
|
'around',
|
|
'evenly',
|
|
'stretch'
|
|
];
|
|
const getZeroAndEmpty = ()=>[
|
|
'',
|
|
'0',
|
|
isArbitraryValue
|
|
];
|
|
const getBreaks = ()=>[
|
|
'auto',
|
|
'avoid',
|
|
'all',
|
|
'avoid-page',
|
|
'page',
|
|
'left',
|
|
'right',
|
|
'column'
|
|
];
|
|
const getNumberAndArbitrary = ()=>[
|
|
isNumber,
|
|
isArbitraryValue
|
|
];
|
|
return {
|
|
cacheSize: 500,
|
|
separator: ':',
|
|
theme: {
|
|
colors: [
|
|
isAny
|
|
],
|
|
spacing: [
|
|
isLength,
|
|
isArbitraryLength
|
|
],
|
|
blur: [
|
|
'none',
|
|
'',
|
|
isTshirtSize,
|
|
isArbitraryValue
|
|
],
|
|
brightness: getNumberAndArbitrary(),
|
|
borderColor: [
|
|
colors
|
|
],
|
|
borderRadius: [
|
|
'none',
|
|
'',
|
|
'full',
|
|
isTshirtSize,
|
|
isArbitraryValue
|
|
],
|
|
borderSpacing: getSpacingWithArbitrary(),
|
|
borderWidth: getLengthWithEmptyAndArbitrary(),
|
|
contrast: getNumberAndArbitrary(),
|
|
grayscale: getZeroAndEmpty(),
|
|
hueRotate: getNumberAndArbitrary(),
|
|
invert: getZeroAndEmpty(),
|
|
gap: getSpacingWithArbitrary(),
|
|
gradientColorStops: [
|
|
colors
|
|
],
|
|
gradientColorStopPositions: [
|
|
isPercent,
|
|
isArbitraryLength
|
|
],
|
|
inset: getSpacingWithAutoAndArbitrary(),
|
|
margin: getSpacingWithAutoAndArbitrary(),
|
|
opacity: getNumberAndArbitrary(),
|
|
padding: getSpacingWithArbitrary(),
|
|
saturate: getNumberAndArbitrary(),
|
|
scale: getNumberAndArbitrary(),
|
|
sepia: getZeroAndEmpty(),
|
|
skew: getNumberAndArbitrary(),
|
|
space: getSpacingWithArbitrary(),
|
|
translate: getSpacingWithArbitrary()
|
|
},
|
|
classGroups: {
|
|
// Layout
|
|
/**
|
|
* Aspect Ratio
|
|
* @see https://tailwindcss.com/docs/aspect-ratio
|
|
*/ aspect: [
|
|
{
|
|
aspect: [
|
|
'auto',
|
|
'square',
|
|
'video',
|
|
isArbitraryValue
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Container
|
|
* @see https://tailwindcss.com/docs/container
|
|
*/ container: [
|
|
'container'
|
|
],
|
|
/**
|
|
* Columns
|
|
* @see https://tailwindcss.com/docs/columns
|
|
*/ columns: [
|
|
{
|
|
columns: [
|
|
isTshirtSize
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Break After
|
|
* @see https://tailwindcss.com/docs/break-after
|
|
*/ 'break-after': [
|
|
{
|
|
'break-after': getBreaks()
|
|
}
|
|
],
|
|
/**
|
|
* Break Before
|
|
* @see https://tailwindcss.com/docs/break-before
|
|
*/ 'break-before': [
|
|
{
|
|
'break-before': getBreaks()
|
|
}
|
|
],
|
|
/**
|
|
* Break Inside
|
|
* @see https://tailwindcss.com/docs/break-inside
|
|
*/ 'break-inside': [
|
|
{
|
|
'break-inside': [
|
|
'auto',
|
|
'avoid',
|
|
'avoid-page',
|
|
'avoid-column'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Box Decoration Break
|
|
* @see https://tailwindcss.com/docs/box-decoration-break
|
|
*/ 'box-decoration': [
|
|
{
|
|
'box-decoration': [
|
|
'slice',
|
|
'clone'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Box Sizing
|
|
* @see https://tailwindcss.com/docs/box-sizing
|
|
*/ box: [
|
|
{
|
|
box: [
|
|
'border',
|
|
'content'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Display
|
|
* @see https://tailwindcss.com/docs/display
|
|
*/ display: [
|
|
'block',
|
|
'inline-block',
|
|
'inline',
|
|
'flex',
|
|
'inline-flex',
|
|
'table',
|
|
'inline-table',
|
|
'table-caption',
|
|
'table-cell',
|
|
'table-column',
|
|
'table-column-group',
|
|
'table-footer-group',
|
|
'table-header-group',
|
|
'table-row-group',
|
|
'table-row',
|
|
'flow-root',
|
|
'grid',
|
|
'inline-grid',
|
|
'contents',
|
|
'list-item',
|
|
'hidden'
|
|
],
|
|
/**
|
|
* Floats
|
|
* @see https://tailwindcss.com/docs/float
|
|
*/ float: [
|
|
{
|
|
float: [
|
|
'right',
|
|
'left',
|
|
'none',
|
|
'start',
|
|
'end'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Clear
|
|
* @see https://tailwindcss.com/docs/clear
|
|
*/ clear: [
|
|
{
|
|
clear: [
|
|
'left',
|
|
'right',
|
|
'both',
|
|
'none',
|
|
'start',
|
|
'end'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Isolation
|
|
* @see https://tailwindcss.com/docs/isolation
|
|
*/ isolation: [
|
|
'isolate',
|
|
'isolation-auto'
|
|
],
|
|
/**
|
|
* Object Fit
|
|
* @see https://tailwindcss.com/docs/object-fit
|
|
*/ 'object-fit': [
|
|
{
|
|
object: [
|
|
'contain',
|
|
'cover',
|
|
'fill',
|
|
'none',
|
|
'scale-down'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Object Position
|
|
* @see https://tailwindcss.com/docs/object-position
|
|
*/ 'object-position': [
|
|
{
|
|
object: [
|
|
...getPositions(),
|
|
isArbitraryValue
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Overflow
|
|
* @see https://tailwindcss.com/docs/overflow
|
|
*/ overflow: [
|
|
{
|
|
overflow: getOverflow()
|
|
}
|
|
],
|
|
/**
|
|
* Overflow X
|
|
* @see https://tailwindcss.com/docs/overflow
|
|
*/ 'overflow-x': [
|
|
{
|
|
'overflow-x': getOverflow()
|
|
}
|
|
],
|
|
/**
|
|
* Overflow Y
|
|
* @see https://tailwindcss.com/docs/overflow
|
|
*/ 'overflow-y': [
|
|
{
|
|
'overflow-y': getOverflow()
|
|
}
|
|
],
|
|
/**
|
|
* Overscroll Behavior
|
|
* @see https://tailwindcss.com/docs/overscroll-behavior
|
|
*/ overscroll: [
|
|
{
|
|
overscroll: getOverscroll()
|
|
}
|
|
],
|
|
/**
|
|
* Overscroll Behavior X
|
|
* @see https://tailwindcss.com/docs/overscroll-behavior
|
|
*/ 'overscroll-x': [
|
|
{
|
|
'overscroll-x': getOverscroll()
|
|
}
|
|
],
|
|
/**
|
|
* Overscroll Behavior Y
|
|
* @see https://tailwindcss.com/docs/overscroll-behavior
|
|
*/ 'overscroll-y': [
|
|
{
|
|
'overscroll-y': getOverscroll()
|
|
}
|
|
],
|
|
/**
|
|
* Position
|
|
* @see https://tailwindcss.com/docs/position
|
|
*/ position: [
|
|
'static',
|
|
'fixed',
|
|
'absolute',
|
|
'relative',
|
|
'sticky'
|
|
],
|
|
/**
|
|
* Top / Right / Bottom / Left
|
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
*/ inset: [
|
|
{
|
|
inset: [
|
|
inset
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Right / Left
|
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
*/ 'inset-x': [
|
|
{
|
|
'inset-x': [
|
|
inset
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Top / Bottom
|
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
*/ 'inset-y': [
|
|
{
|
|
'inset-y': [
|
|
inset
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Start
|
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
*/ start: [
|
|
{
|
|
start: [
|
|
inset
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* End
|
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
*/ end: [
|
|
{
|
|
end: [
|
|
inset
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Top
|
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
*/ top: [
|
|
{
|
|
top: [
|
|
inset
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Right
|
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
*/ right: [
|
|
{
|
|
right: [
|
|
inset
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Bottom
|
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
*/ bottom: [
|
|
{
|
|
bottom: [
|
|
inset
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Left
|
|
* @see https://tailwindcss.com/docs/top-right-bottom-left
|
|
*/ left: [
|
|
{
|
|
left: [
|
|
inset
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Visibility
|
|
* @see https://tailwindcss.com/docs/visibility
|
|
*/ visibility: [
|
|
'visible',
|
|
'invisible',
|
|
'collapse'
|
|
],
|
|
/**
|
|
* Z-Index
|
|
* @see https://tailwindcss.com/docs/z-index
|
|
*/ z: [
|
|
{
|
|
z: [
|
|
'auto',
|
|
isInteger,
|
|
isArbitraryValue
|
|
]
|
|
}
|
|
],
|
|
// Flexbox and Grid
|
|
/**
|
|
* Flex Basis
|
|
* @see https://tailwindcss.com/docs/flex-basis
|
|
*/ basis: [
|
|
{
|
|
basis: getSpacingWithAutoAndArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Flex Direction
|
|
* @see https://tailwindcss.com/docs/flex-direction
|
|
*/ 'flex-direction': [
|
|
{
|
|
flex: [
|
|
'row',
|
|
'row-reverse',
|
|
'col',
|
|
'col-reverse'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Flex Wrap
|
|
* @see https://tailwindcss.com/docs/flex-wrap
|
|
*/ 'flex-wrap': [
|
|
{
|
|
flex: [
|
|
'wrap',
|
|
'wrap-reverse',
|
|
'nowrap'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Flex
|
|
* @see https://tailwindcss.com/docs/flex
|
|
*/ flex: [
|
|
{
|
|
flex: [
|
|
'1',
|
|
'auto',
|
|
'initial',
|
|
'none',
|
|
isArbitraryValue
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Flex Grow
|
|
* @see https://tailwindcss.com/docs/flex-grow
|
|
*/ grow: [
|
|
{
|
|
grow: getZeroAndEmpty()
|
|
}
|
|
],
|
|
/**
|
|
* Flex Shrink
|
|
* @see https://tailwindcss.com/docs/flex-shrink
|
|
*/ shrink: [
|
|
{
|
|
shrink: getZeroAndEmpty()
|
|
}
|
|
],
|
|
/**
|
|
* Order
|
|
* @see https://tailwindcss.com/docs/order
|
|
*/ order: [
|
|
{
|
|
order: [
|
|
'first',
|
|
'last',
|
|
'none',
|
|
isInteger,
|
|
isArbitraryValue
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Grid Template Columns
|
|
* @see https://tailwindcss.com/docs/grid-template-columns
|
|
*/ 'grid-cols': [
|
|
{
|
|
'grid-cols': [
|
|
isAny
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Grid Column Start / End
|
|
* @see https://tailwindcss.com/docs/grid-column
|
|
*/ 'col-start-end': [
|
|
{
|
|
col: [
|
|
'auto',
|
|
{
|
|
span: [
|
|
'full',
|
|
isInteger,
|
|
isArbitraryValue
|
|
]
|
|
},
|
|
isArbitraryValue
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Grid Column Start
|
|
* @see https://tailwindcss.com/docs/grid-column
|
|
*/ 'col-start': [
|
|
{
|
|
'col-start': getNumberWithAutoAndArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Grid Column End
|
|
* @see https://tailwindcss.com/docs/grid-column
|
|
*/ 'col-end': [
|
|
{
|
|
'col-end': getNumberWithAutoAndArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Grid Template Rows
|
|
* @see https://tailwindcss.com/docs/grid-template-rows
|
|
*/ 'grid-rows': [
|
|
{
|
|
'grid-rows': [
|
|
isAny
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Grid Row Start / End
|
|
* @see https://tailwindcss.com/docs/grid-row
|
|
*/ 'row-start-end': [
|
|
{
|
|
row: [
|
|
'auto',
|
|
{
|
|
span: [
|
|
isInteger,
|
|
isArbitraryValue
|
|
]
|
|
},
|
|
isArbitraryValue
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Grid Row Start
|
|
* @see https://tailwindcss.com/docs/grid-row
|
|
*/ 'row-start': [
|
|
{
|
|
'row-start': getNumberWithAutoAndArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Grid Row End
|
|
* @see https://tailwindcss.com/docs/grid-row
|
|
*/ 'row-end': [
|
|
{
|
|
'row-end': getNumberWithAutoAndArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Grid Auto Flow
|
|
* @see https://tailwindcss.com/docs/grid-auto-flow
|
|
*/ 'grid-flow': [
|
|
{
|
|
'grid-flow': [
|
|
'row',
|
|
'col',
|
|
'dense',
|
|
'row-dense',
|
|
'col-dense'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Grid Auto Columns
|
|
* @see https://tailwindcss.com/docs/grid-auto-columns
|
|
*/ 'auto-cols': [
|
|
{
|
|
'auto-cols': [
|
|
'auto',
|
|
'min',
|
|
'max',
|
|
'fr',
|
|
isArbitraryValue
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Grid Auto Rows
|
|
* @see https://tailwindcss.com/docs/grid-auto-rows
|
|
*/ 'auto-rows': [
|
|
{
|
|
'auto-rows': [
|
|
'auto',
|
|
'min',
|
|
'max',
|
|
'fr',
|
|
isArbitraryValue
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Gap
|
|
* @see https://tailwindcss.com/docs/gap
|
|
*/ gap: [
|
|
{
|
|
gap: [
|
|
gap
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Gap X
|
|
* @see https://tailwindcss.com/docs/gap
|
|
*/ 'gap-x': [
|
|
{
|
|
'gap-x': [
|
|
gap
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Gap Y
|
|
* @see https://tailwindcss.com/docs/gap
|
|
*/ 'gap-y': [
|
|
{
|
|
'gap-y': [
|
|
gap
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Justify Content
|
|
* @see https://tailwindcss.com/docs/justify-content
|
|
*/ 'justify-content': [
|
|
{
|
|
justify: [
|
|
'normal',
|
|
...getAlign()
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Justify Items
|
|
* @see https://tailwindcss.com/docs/justify-items
|
|
*/ 'justify-items': [
|
|
{
|
|
'justify-items': [
|
|
'start',
|
|
'end',
|
|
'center',
|
|
'stretch'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Justify Self
|
|
* @see https://tailwindcss.com/docs/justify-self
|
|
*/ 'justify-self': [
|
|
{
|
|
'justify-self': [
|
|
'auto',
|
|
'start',
|
|
'end',
|
|
'center',
|
|
'stretch'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Align Content
|
|
* @see https://tailwindcss.com/docs/align-content
|
|
*/ 'align-content': [
|
|
{
|
|
content: [
|
|
'normal',
|
|
...getAlign(),
|
|
'baseline'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Align Items
|
|
* @see https://tailwindcss.com/docs/align-items
|
|
*/ 'align-items': [
|
|
{
|
|
items: [
|
|
'start',
|
|
'end',
|
|
'center',
|
|
'baseline',
|
|
'stretch'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Align Self
|
|
* @see https://tailwindcss.com/docs/align-self
|
|
*/ 'align-self': [
|
|
{
|
|
self: [
|
|
'auto',
|
|
'start',
|
|
'end',
|
|
'center',
|
|
'stretch',
|
|
'baseline'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Place Content
|
|
* @see https://tailwindcss.com/docs/place-content
|
|
*/ 'place-content': [
|
|
{
|
|
'place-content': [
|
|
...getAlign(),
|
|
'baseline'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Place Items
|
|
* @see https://tailwindcss.com/docs/place-items
|
|
*/ 'place-items': [
|
|
{
|
|
'place-items': [
|
|
'start',
|
|
'end',
|
|
'center',
|
|
'baseline',
|
|
'stretch'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Place Self
|
|
* @see https://tailwindcss.com/docs/place-self
|
|
*/ 'place-self': [
|
|
{
|
|
'place-self': [
|
|
'auto',
|
|
'start',
|
|
'end',
|
|
'center',
|
|
'stretch'
|
|
]
|
|
}
|
|
],
|
|
// Spacing
|
|
/**
|
|
* Padding
|
|
* @see https://tailwindcss.com/docs/padding
|
|
*/ p: [
|
|
{
|
|
p: [
|
|
padding
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Padding X
|
|
* @see https://tailwindcss.com/docs/padding
|
|
*/ px: [
|
|
{
|
|
px: [
|
|
padding
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Padding Y
|
|
* @see https://tailwindcss.com/docs/padding
|
|
*/ py: [
|
|
{
|
|
py: [
|
|
padding
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Padding Start
|
|
* @see https://tailwindcss.com/docs/padding
|
|
*/ ps: [
|
|
{
|
|
ps: [
|
|
padding
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Padding End
|
|
* @see https://tailwindcss.com/docs/padding
|
|
*/ pe: [
|
|
{
|
|
pe: [
|
|
padding
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Padding Top
|
|
* @see https://tailwindcss.com/docs/padding
|
|
*/ pt: [
|
|
{
|
|
pt: [
|
|
padding
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Padding Right
|
|
* @see https://tailwindcss.com/docs/padding
|
|
*/ pr: [
|
|
{
|
|
pr: [
|
|
padding
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Padding Bottom
|
|
* @see https://tailwindcss.com/docs/padding
|
|
*/ pb: [
|
|
{
|
|
pb: [
|
|
padding
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Padding Left
|
|
* @see https://tailwindcss.com/docs/padding
|
|
*/ pl: [
|
|
{
|
|
pl: [
|
|
padding
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Margin
|
|
* @see https://tailwindcss.com/docs/margin
|
|
*/ m: [
|
|
{
|
|
m: [
|
|
margin
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Margin X
|
|
* @see https://tailwindcss.com/docs/margin
|
|
*/ mx: [
|
|
{
|
|
mx: [
|
|
margin
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Margin Y
|
|
* @see https://tailwindcss.com/docs/margin
|
|
*/ my: [
|
|
{
|
|
my: [
|
|
margin
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Margin Start
|
|
* @see https://tailwindcss.com/docs/margin
|
|
*/ ms: [
|
|
{
|
|
ms: [
|
|
margin
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Margin End
|
|
* @see https://tailwindcss.com/docs/margin
|
|
*/ me: [
|
|
{
|
|
me: [
|
|
margin
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Margin Top
|
|
* @see https://tailwindcss.com/docs/margin
|
|
*/ mt: [
|
|
{
|
|
mt: [
|
|
margin
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Margin Right
|
|
* @see https://tailwindcss.com/docs/margin
|
|
*/ mr: [
|
|
{
|
|
mr: [
|
|
margin
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Margin Bottom
|
|
* @see https://tailwindcss.com/docs/margin
|
|
*/ mb: [
|
|
{
|
|
mb: [
|
|
margin
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Margin Left
|
|
* @see https://tailwindcss.com/docs/margin
|
|
*/ ml: [
|
|
{
|
|
ml: [
|
|
margin
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Space Between X
|
|
* @see https://tailwindcss.com/docs/space
|
|
*/ 'space-x': [
|
|
{
|
|
'space-x': [
|
|
space
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Space Between X Reverse
|
|
* @see https://tailwindcss.com/docs/space
|
|
*/ 'space-x-reverse': [
|
|
'space-x-reverse'
|
|
],
|
|
/**
|
|
* Space Between Y
|
|
* @see https://tailwindcss.com/docs/space
|
|
*/ 'space-y': [
|
|
{
|
|
'space-y': [
|
|
space
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Space Between Y Reverse
|
|
* @see https://tailwindcss.com/docs/space
|
|
*/ 'space-y-reverse': [
|
|
'space-y-reverse'
|
|
],
|
|
// Sizing
|
|
/**
|
|
* Width
|
|
* @see https://tailwindcss.com/docs/width
|
|
*/ w: [
|
|
{
|
|
w: [
|
|
'auto',
|
|
'min',
|
|
'max',
|
|
'fit',
|
|
'svw',
|
|
'lvw',
|
|
'dvw',
|
|
isArbitraryValue,
|
|
spacing
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Min-Width
|
|
* @see https://tailwindcss.com/docs/min-width
|
|
*/ 'min-w': [
|
|
{
|
|
'min-w': [
|
|
isArbitraryValue,
|
|
spacing,
|
|
'min',
|
|
'max',
|
|
'fit'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Max-Width
|
|
* @see https://tailwindcss.com/docs/max-width
|
|
*/ 'max-w': [
|
|
{
|
|
'max-w': [
|
|
isArbitraryValue,
|
|
spacing,
|
|
'none',
|
|
'full',
|
|
'min',
|
|
'max',
|
|
'fit',
|
|
'prose',
|
|
{
|
|
screen: [
|
|
isTshirtSize
|
|
]
|
|
},
|
|
isTshirtSize
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Height
|
|
* @see https://tailwindcss.com/docs/height
|
|
*/ h: [
|
|
{
|
|
h: [
|
|
isArbitraryValue,
|
|
spacing,
|
|
'auto',
|
|
'min',
|
|
'max',
|
|
'fit',
|
|
'svh',
|
|
'lvh',
|
|
'dvh'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Min-Height
|
|
* @see https://tailwindcss.com/docs/min-height
|
|
*/ 'min-h': [
|
|
{
|
|
'min-h': [
|
|
isArbitraryValue,
|
|
spacing,
|
|
'min',
|
|
'max',
|
|
'fit',
|
|
'svh',
|
|
'lvh',
|
|
'dvh'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Max-Height
|
|
* @see https://tailwindcss.com/docs/max-height
|
|
*/ 'max-h': [
|
|
{
|
|
'max-h': [
|
|
isArbitraryValue,
|
|
spacing,
|
|
'min',
|
|
'max',
|
|
'fit',
|
|
'svh',
|
|
'lvh',
|
|
'dvh'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Size
|
|
* @see https://tailwindcss.com/docs/size
|
|
*/ size: [
|
|
{
|
|
size: [
|
|
isArbitraryValue,
|
|
spacing,
|
|
'auto',
|
|
'min',
|
|
'max',
|
|
'fit'
|
|
]
|
|
}
|
|
],
|
|
// Typography
|
|
/**
|
|
* Font Size
|
|
* @see https://tailwindcss.com/docs/font-size
|
|
*/ 'font-size': [
|
|
{
|
|
text: [
|
|
'base',
|
|
isTshirtSize,
|
|
isArbitraryLength
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Font Smoothing
|
|
* @see https://tailwindcss.com/docs/font-smoothing
|
|
*/ 'font-smoothing': [
|
|
'antialiased',
|
|
'subpixel-antialiased'
|
|
],
|
|
/**
|
|
* Font Style
|
|
* @see https://tailwindcss.com/docs/font-style
|
|
*/ 'font-style': [
|
|
'italic',
|
|
'not-italic'
|
|
],
|
|
/**
|
|
* Font Weight
|
|
* @see https://tailwindcss.com/docs/font-weight
|
|
*/ 'font-weight': [
|
|
{
|
|
font: [
|
|
'thin',
|
|
'extralight',
|
|
'light',
|
|
'normal',
|
|
'medium',
|
|
'semibold',
|
|
'bold',
|
|
'extrabold',
|
|
'black',
|
|
isArbitraryNumber
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Font Family
|
|
* @see https://tailwindcss.com/docs/font-family
|
|
*/ 'font-family': [
|
|
{
|
|
font: [
|
|
isAny
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Font Variant Numeric
|
|
* @see https://tailwindcss.com/docs/font-variant-numeric
|
|
*/ 'fvn-normal': [
|
|
'normal-nums'
|
|
],
|
|
/**
|
|
* Font Variant Numeric
|
|
* @see https://tailwindcss.com/docs/font-variant-numeric
|
|
*/ 'fvn-ordinal': [
|
|
'ordinal'
|
|
],
|
|
/**
|
|
* Font Variant Numeric
|
|
* @see https://tailwindcss.com/docs/font-variant-numeric
|
|
*/ 'fvn-slashed-zero': [
|
|
'slashed-zero'
|
|
],
|
|
/**
|
|
* Font Variant Numeric
|
|
* @see https://tailwindcss.com/docs/font-variant-numeric
|
|
*/ 'fvn-figure': [
|
|
'lining-nums',
|
|
'oldstyle-nums'
|
|
],
|
|
/**
|
|
* Font Variant Numeric
|
|
* @see https://tailwindcss.com/docs/font-variant-numeric
|
|
*/ 'fvn-spacing': [
|
|
'proportional-nums',
|
|
'tabular-nums'
|
|
],
|
|
/**
|
|
* Font Variant Numeric
|
|
* @see https://tailwindcss.com/docs/font-variant-numeric
|
|
*/ 'fvn-fraction': [
|
|
'diagonal-fractions',
|
|
'stacked-fractions'
|
|
],
|
|
/**
|
|
* Letter Spacing
|
|
* @see https://tailwindcss.com/docs/letter-spacing
|
|
*/ tracking: [
|
|
{
|
|
tracking: [
|
|
'tighter',
|
|
'tight',
|
|
'normal',
|
|
'wide',
|
|
'wider',
|
|
'widest',
|
|
isArbitraryValue
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Line Clamp
|
|
* @see https://tailwindcss.com/docs/line-clamp
|
|
*/ 'line-clamp': [
|
|
{
|
|
'line-clamp': [
|
|
'none',
|
|
isNumber,
|
|
isArbitraryNumber
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Line Height
|
|
* @see https://tailwindcss.com/docs/line-height
|
|
*/ leading: [
|
|
{
|
|
leading: [
|
|
'none',
|
|
'tight',
|
|
'snug',
|
|
'normal',
|
|
'relaxed',
|
|
'loose',
|
|
isLength,
|
|
isArbitraryValue
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* List Style Image
|
|
* @see https://tailwindcss.com/docs/list-style-image
|
|
*/ 'list-image': [
|
|
{
|
|
'list-image': [
|
|
'none',
|
|
isArbitraryValue
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* List Style Type
|
|
* @see https://tailwindcss.com/docs/list-style-type
|
|
*/ 'list-style-type': [
|
|
{
|
|
list: [
|
|
'none',
|
|
'disc',
|
|
'decimal',
|
|
isArbitraryValue
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* List Style Position
|
|
* @see https://tailwindcss.com/docs/list-style-position
|
|
*/ 'list-style-position': [
|
|
{
|
|
list: [
|
|
'inside',
|
|
'outside'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Placeholder Color
|
|
* @deprecated since Tailwind CSS v3.0.0
|
|
* @see https://tailwindcss.com/docs/placeholder-color
|
|
*/ 'placeholder-color': [
|
|
{
|
|
placeholder: [
|
|
colors
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Placeholder Opacity
|
|
* @see https://tailwindcss.com/docs/placeholder-opacity
|
|
*/ 'placeholder-opacity': [
|
|
{
|
|
'placeholder-opacity': [
|
|
opacity
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Text Alignment
|
|
* @see https://tailwindcss.com/docs/text-align
|
|
*/ 'text-alignment': [
|
|
{
|
|
text: [
|
|
'left',
|
|
'center',
|
|
'right',
|
|
'justify',
|
|
'start',
|
|
'end'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Text Color
|
|
* @see https://tailwindcss.com/docs/text-color
|
|
*/ 'text-color': [
|
|
{
|
|
text: [
|
|
colors
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Text Opacity
|
|
* @see https://tailwindcss.com/docs/text-opacity
|
|
*/ 'text-opacity': [
|
|
{
|
|
'text-opacity': [
|
|
opacity
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Text Decoration
|
|
* @see https://tailwindcss.com/docs/text-decoration
|
|
*/ 'text-decoration': [
|
|
'underline',
|
|
'overline',
|
|
'line-through',
|
|
'no-underline'
|
|
],
|
|
/**
|
|
* Text Decoration Style
|
|
* @see https://tailwindcss.com/docs/text-decoration-style
|
|
*/ 'text-decoration-style': [
|
|
{
|
|
decoration: [
|
|
...getLineStyles(),
|
|
'wavy'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Text Decoration Thickness
|
|
* @see https://tailwindcss.com/docs/text-decoration-thickness
|
|
*/ 'text-decoration-thickness': [
|
|
{
|
|
decoration: [
|
|
'auto',
|
|
'from-font',
|
|
isLength,
|
|
isArbitraryLength
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Text Underline Offset
|
|
* @see https://tailwindcss.com/docs/text-underline-offset
|
|
*/ 'underline-offset': [
|
|
{
|
|
'underline-offset': [
|
|
'auto',
|
|
isLength,
|
|
isArbitraryValue
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Text Decoration Color
|
|
* @see https://tailwindcss.com/docs/text-decoration-color
|
|
*/ 'text-decoration-color': [
|
|
{
|
|
decoration: [
|
|
colors
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Text Transform
|
|
* @see https://tailwindcss.com/docs/text-transform
|
|
*/ 'text-transform': [
|
|
'uppercase',
|
|
'lowercase',
|
|
'capitalize',
|
|
'normal-case'
|
|
],
|
|
/**
|
|
* Text Overflow
|
|
* @see https://tailwindcss.com/docs/text-overflow
|
|
*/ 'text-overflow': [
|
|
'truncate',
|
|
'text-ellipsis',
|
|
'text-clip'
|
|
],
|
|
/**
|
|
* Text Wrap
|
|
* @see https://tailwindcss.com/docs/text-wrap
|
|
*/ 'text-wrap': [
|
|
{
|
|
text: [
|
|
'wrap',
|
|
'nowrap',
|
|
'balance',
|
|
'pretty'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Text Indent
|
|
* @see https://tailwindcss.com/docs/text-indent
|
|
*/ indent: [
|
|
{
|
|
indent: getSpacingWithArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Vertical Alignment
|
|
* @see https://tailwindcss.com/docs/vertical-align
|
|
*/ 'vertical-align': [
|
|
{
|
|
align: [
|
|
'baseline',
|
|
'top',
|
|
'middle',
|
|
'bottom',
|
|
'text-top',
|
|
'text-bottom',
|
|
'sub',
|
|
'super',
|
|
isArbitraryValue
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Whitespace
|
|
* @see https://tailwindcss.com/docs/whitespace
|
|
*/ whitespace: [
|
|
{
|
|
whitespace: [
|
|
'normal',
|
|
'nowrap',
|
|
'pre',
|
|
'pre-line',
|
|
'pre-wrap',
|
|
'break-spaces'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Word Break
|
|
* @see https://tailwindcss.com/docs/word-break
|
|
*/ break: [
|
|
{
|
|
break: [
|
|
'normal',
|
|
'words',
|
|
'all',
|
|
'keep'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Hyphens
|
|
* @see https://tailwindcss.com/docs/hyphens
|
|
*/ hyphens: [
|
|
{
|
|
hyphens: [
|
|
'none',
|
|
'manual',
|
|
'auto'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Content
|
|
* @see https://tailwindcss.com/docs/content
|
|
*/ content: [
|
|
{
|
|
content: [
|
|
'none',
|
|
isArbitraryValue
|
|
]
|
|
}
|
|
],
|
|
// Backgrounds
|
|
/**
|
|
* Background Attachment
|
|
* @see https://tailwindcss.com/docs/background-attachment
|
|
*/ 'bg-attachment': [
|
|
{
|
|
bg: [
|
|
'fixed',
|
|
'local',
|
|
'scroll'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Background Clip
|
|
* @see https://tailwindcss.com/docs/background-clip
|
|
*/ 'bg-clip': [
|
|
{
|
|
'bg-clip': [
|
|
'border',
|
|
'padding',
|
|
'content',
|
|
'text'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Background Opacity
|
|
* @deprecated since Tailwind CSS v3.0.0
|
|
* @see https://tailwindcss.com/docs/background-opacity
|
|
*/ 'bg-opacity': [
|
|
{
|
|
'bg-opacity': [
|
|
opacity
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Background Origin
|
|
* @see https://tailwindcss.com/docs/background-origin
|
|
*/ 'bg-origin': [
|
|
{
|
|
'bg-origin': [
|
|
'border',
|
|
'padding',
|
|
'content'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Background Position
|
|
* @see https://tailwindcss.com/docs/background-position
|
|
*/ 'bg-position': [
|
|
{
|
|
bg: [
|
|
...getPositions(),
|
|
isArbitraryPosition
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Background Repeat
|
|
* @see https://tailwindcss.com/docs/background-repeat
|
|
*/ 'bg-repeat': [
|
|
{
|
|
bg: [
|
|
'no-repeat',
|
|
{
|
|
repeat: [
|
|
'',
|
|
'x',
|
|
'y',
|
|
'round',
|
|
'space'
|
|
]
|
|
}
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Background Size
|
|
* @see https://tailwindcss.com/docs/background-size
|
|
*/ 'bg-size': [
|
|
{
|
|
bg: [
|
|
'auto',
|
|
'cover',
|
|
'contain',
|
|
isArbitrarySize
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Background Image
|
|
* @see https://tailwindcss.com/docs/background-image
|
|
*/ 'bg-image': [
|
|
{
|
|
bg: [
|
|
'none',
|
|
{
|
|
'gradient-to': [
|
|
't',
|
|
'tr',
|
|
'r',
|
|
'br',
|
|
'b',
|
|
'bl',
|
|
'l',
|
|
'tl'
|
|
]
|
|
},
|
|
isArbitraryImage
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Background Color
|
|
* @see https://tailwindcss.com/docs/background-color
|
|
*/ 'bg-color': [
|
|
{
|
|
bg: [
|
|
colors
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Gradient Color Stops From Position
|
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
*/ 'gradient-from-pos': [
|
|
{
|
|
from: [
|
|
gradientColorStopPositions
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Gradient Color Stops Via Position
|
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
*/ 'gradient-via-pos': [
|
|
{
|
|
via: [
|
|
gradientColorStopPositions
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Gradient Color Stops To Position
|
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
*/ 'gradient-to-pos': [
|
|
{
|
|
to: [
|
|
gradientColorStopPositions
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Gradient Color Stops From
|
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
*/ 'gradient-from': [
|
|
{
|
|
from: [
|
|
gradientColorStops
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Gradient Color Stops Via
|
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
*/ 'gradient-via': [
|
|
{
|
|
via: [
|
|
gradientColorStops
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Gradient Color Stops To
|
|
* @see https://tailwindcss.com/docs/gradient-color-stops
|
|
*/ 'gradient-to': [
|
|
{
|
|
to: [
|
|
gradientColorStops
|
|
]
|
|
}
|
|
],
|
|
// Borders
|
|
/**
|
|
* Border Radius
|
|
* @see https://tailwindcss.com/docs/border-radius
|
|
*/ rounded: [
|
|
{
|
|
rounded: [
|
|
borderRadius
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Radius Start
|
|
* @see https://tailwindcss.com/docs/border-radius
|
|
*/ 'rounded-s': [
|
|
{
|
|
'rounded-s': [
|
|
borderRadius
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Radius End
|
|
* @see https://tailwindcss.com/docs/border-radius
|
|
*/ 'rounded-e': [
|
|
{
|
|
'rounded-e': [
|
|
borderRadius
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Radius Top
|
|
* @see https://tailwindcss.com/docs/border-radius
|
|
*/ 'rounded-t': [
|
|
{
|
|
'rounded-t': [
|
|
borderRadius
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Radius Right
|
|
* @see https://tailwindcss.com/docs/border-radius
|
|
*/ 'rounded-r': [
|
|
{
|
|
'rounded-r': [
|
|
borderRadius
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Radius Bottom
|
|
* @see https://tailwindcss.com/docs/border-radius
|
|
*/ 'rounded-b': [
|
|
{
|
|
'rounded-b': [
|
|
borderRadius
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Radius Left
|
|
* @see https://tailwindcss.com/docs/border-radius
|
|
*/ 'rounded-l': [
|
|
{
|
|
'rounded-l': [
|
|
borderRadius
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Radius Start Start
|
|
* @see https://tailwindcss.com/docs/border-radius
|
|
*/ 'rounded-ss': [
|
|
{
|
|
'rounded-ss': [
|
|
borderRadius
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Radius Start End
|
|
* @see https://tailwindcss.com/docs/border-radius
|
|
*/ 'rounded-se': [
|
|
{
|
|
'rounded-se': [
|
|
borderRadius
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Radius End End
|
|
* @see https://tailwindcss.com/docs/border-radius
|
|
*/ 'rounded-ee': [
|
|
{
|
|
'rounded-ee': [
|
|
borderRadius
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Radius End Start
|
|
* @see https://tailwindcss.com/docs/border-radius
|
|
*/ 'rounded-es': [
|
|
{
|
|
'rounded-es': [
|
|
borderRadius
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Radius Top Left
|
|
* @see https://tailwindcss.com/docs/border-radius
|
|
*/ 'rounded-tl': [
|
|
{
|
|
'rounded-tl': [
|
|
borderRadius
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Radius Top Right
|
|
* @see https://tailwindcss.com/docs/border-radius
|
|
*/ 'rounded-tr': [
|
|
{
|
|
'rounded-tr': [
|
|
borderRadius
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Radius Bottom Right
|
|
* @see https://tailwindcss.com/docs/border-radius
|
|
*/ 'rounded-br': [
|
|
{
|
|
'rounded-br': [
|
|
borderRadius
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Radius Bottom Left
|
|
* @see https://tailwindcss.com/docs/border-radius
|
|
*/ 'rounded-bl': [
|
|
{
|
|
'rounded-bl': [
|
|
borderRadius
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Width
|
|
* @see https://tailwindcss.com/docs/border-width
|
|
*/ 'border-w': [
|
|
{
|
|
border: [
|
|
borderWidth
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Width X
|
|
* @see https://tailwindcss.com/docs/border-width
|
|
*/ 'border-w-x': [
|
|
{
|
|
'border-x': [
|
|
borderWidth
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Width Y
|
|
* @see https://tailwindcss.com/docs/border-width
|
|
*/ 'border-w-y': [
|
|
{
|
|
'border-y': [
|
|
borderWidth
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Width Start
|
|
* @see https://tailwindcss.com/docs/border-width
|
|
*/ 'border-w-s': [
|
|
{
|
|
'border-s': [
|
|
borderWidth
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Width End
|
|
* @see https://tailwindcss.com/docs/border-width
|
|
*/ 'border-w-e': [
|
|
{
|
|
'border-e': [
|
|
borderWidth
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Width Top
|
|
* @see https://tailwindcss.com/docs/border-width
|
|
*/ 'border-w-t': [
|
|
{
|
|
'border-t': [
|
|
borderWidth
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Width Right
|
|
* @see https://tailwindcss.com/docs/border-width
|
|
*/ 'border-w-r': [
|
|
{
|
|
'border-r': [
|
|
borderWidth
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Width Bottom
|
|
* @see https://tailwindcss.com/docs/border-width
|
|
*/ 'border-w-b': [
|
|
{
|
|
'border-b': [
|
|
borderWidth
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Width Left
|
|
* @see https://tailwindcss.com/docs/border-width
|
|
*/ 'border-w-l': [
|
|
{
|
|
'border-l': [
|
|
borderWidth
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Opacity
|
|
* @see https://tailwindcss.com/docs/border-opacity
|
|
*/ 'border-opacity': [
|
|
{
|
|
'border-opacity': [
|
|
opacity
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Style
|
|
* @see https://tailwindcss.com/docs/border-style
|
|
*/ 'border-style': [
|
|
{
|
|
border: [
|
|
...getLineStyles(),
|
|
'hidden'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Divide Width X
|
|
* @see https://tailwindcss.com/docs/divide-width
|
|
*/ 'divide-x': [
|
|
{
|
|
'divide-x': [
|
|
borderWidth
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Divide Width X Reverse
|
|
* @see https://tailwindcss.com/docs/divide-width
|
|
*/ 'divide-x-reverse': [
|
|
'divide-x-reverse'
|
|
],
|
|
/**
|
|
* Divide Width Y
|
|
* @see https://tailwindcss.com/docs/divide-width
|
|
*/ 'divide-y': [
|
|
{
|
|
'divide-y': [
|
|
borderWidth
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Divide Width Y Reverse
|
|
* @see https://tailwindcss.com/docs/divide-width
|
|
*/ 'divide-y-reverse': [
|
|
'divide-y-reverse'
|
|
],
|
|
/**
|
|
* Divide Opacity
|
|
* @see https://tailwindcss.com/docs/divide-opacity
|
|
*/ 'divide-opacity': [
|
|
{
|
|
'divide-opacity': [
|
|
opacity
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Divide Style
|
|
* @see https://tailwindcss.com/docs/divide-style
|
|
*/ 'divide-style': [
|
|
{
|
|
divide: getLineStyles()
|
|
}
|
|
],
|
|
/**
|
|
* Border Color
|
|
* @see https://tailwindcss.com/docs/border-color
|
|
*/ 'border-color': [
|
|
{
|
|
border: [
|
|
borderColor
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Color X
|
|
* @see https://tailwindcss.com/docs/border-color
|
|
*/ 'border-color-x': [
|
|
{
|
|
'border-x': [
|
|
borderColor
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Color Y
|
|
* @see https://tailwindcss.com/docs/border-color
|
|
*/ 'border-color-y': [
|
|
{
|
|
'border-y': [
|
|
borderColor
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Color S
|
|
* @see https://tailwindcss.com/docs/border-color
|
|
*/ 'border-color-s': [
|
|
{
|
|
'border-s': [
|
|
borderColor
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Color E
|
|
* @see https://tailwindcss.com/docs/border-color
|
|
*/ 'border-color-e': [
|
|
{
|
|
'border-e': [
|
|
borderColor
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Color Top
|
|
* @see https://tailwindcss.com/docs/border-color
|
|
*/ 'border-color-t': [
|
|
{
|
|
'border-t': [
|
|
borderColor
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Color Right
|
|
* @see https://tailwindcss.com/docs/border-color
|
|
*/ 'border-color-r': [
|
|
{
|
|
'border-r': [
|
|
borderColor
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Color Bottom
|
|
* @see https://tailwindcss.com/docs/border-color
|
|
*/ 'border-color-b': [
|
|
{
|
|
'border-b': [
|
|
borderColor
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Color Left
|
|
* @see https://tailwindcss.com/docs/border-color
|
|
*/ 'border-color-l': [
|
|
{
|
|
'border-l': [
|
|
borderColor
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Divide Color
|
|
* @see https://tailwindcss.com/docs/divide-color
|
|
*/ 'divide-color': [
|
|
{
|
|
divide: [
|
|
borderColor
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Outline Style
|
|
* @see https://tailwindcss.com/docs/outline-style
|
|
*/ 'outline-style': [
|
|
{
|
|
outline: [
|
|
'',
|
|
...getLineStyles()
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Outline Offset
|
|
* @see https://tailwindcss.com/docs/outline-offset
|
|
*/ 'outline-offset': [
|
|
{
|
|
'outline-offset': [
|
|
isLength,
|
|
isArbitraryValue
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Outline Width
|
|
* @see https://tailwindcss.com/docs/outline-width
|
|
*/ 'outline-w': [
|
|
{
|
|
outline: [
|
|
isLength,
|
|
isArbitraryLength
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Outline Color
|
|
* @see https://tailwindcss.com/docs/outline-color
|
|
*/ 'outline-color': [
|
|
{
|
|
outline: [
|
|
colors
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Ring Width
|
|
* @see https://tailwindcss.com/docs/ring-width
|
|
*/ 'ring-w': [
|
|
{
|
|
ring: getLengthWithEmptyAndArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Ring Width Inset
|
|
* @see https://tailwindcss.com/docs/ring-width
|
|
*/ 'ring-w-inset': [
|
|
'ring-inset'
|
|
],
|
|
/**
|
|
* Ring Color
|
|
* @see https://tailwindcss.com/docs/ring-color
|
|
*/ 'ring-color': [
|
|
{
|
|
ring: [
|
|
colors
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Ring Opacity
|
|
* @see https://tailwindcss.com/docs/ring-opacity
|
|
*/ 'ring-opacity': [
|
|
{
|
|
'ring-opacity': [
|
|
opacity
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Ring Offset Width
|
|
* @see https://tailwindcss.com/docs/ring-offset-width
|
|
*/ 'ring-offset-w': [
|
|
{
|
|
'ring-offset': [
|
|
isLength,
|
|
isArbitraryLength
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Ring Offset Color
|
|
* @see https://tailwindcss.com/docs/ring-offset-color
|
|
*/ 'ring-offset-color': [
|
|
{
|
|
'ring-offset': [
|
|
colors
|
|
]
|
|
}
|
|
],
|
|
// Effects
|
|
/**
|
|
* Box Shadow
|
|
* @see https://tailwindcss.com/docs/box-shadow
|
|
*/ shadow: [
|
|
{
|
|
shadow: [
|
|
'',
|
|
'inner',
|
|
'none',
|
|
isTshirtSize,
|
|
isArbitraryShadow
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Box Shadow Color
|
|
* @see https://tailwindcss.com/docs/box-shadow-color
|
|
*/ 'shadow-color': [
|
|
{
|
|
shadow: [
|
|
isAny
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Opacity
|
|
* @see https://tailwindcss.com/docs/opacity
|
|
*/ opacity: [
|
|
{
|
|
opacity: [
|
|
opacity
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Mix Blend Mode
|
|
* @see https://tailwindcss.com/docs/mix-blend-mode
|
|
*/ 'mix-blend': [
|
|
{
|
|
'mix-blend': [
|
|
...getBlendModes(),
|
|
'plus-lighter',
|
|
'plus-darker'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Background Blend Mode
|
|
* @see https://tailwindcss.com/docs/background-blend-mode
|
|
*/ 'bg-blend': [
|
|
{
|
|
'bg-blend': getBlendModes()
|
|
}
|
|
],
|
|
// Filters
|
|
/**
|
|
* Filter
|
|
* @deprecated since Tailwind CSS v3.0.0
|
|
* @see https://tailwindcss.com/docs/filter
|
|
*/ filter: [
|
|
{
|
|
filter: [
|
|
'',
|
|
'none'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Blur
|
|
* @see https://tailwindcss.com/docs/blur
|
|
*/ blur: [
|
|
{
|
|
blur: [
|
|
blur
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Brightness
|
|
* @see https://tailwindcss.com/docs/brightness
|
|
*/ brightness: [
|
|
{
|
|
brightness: [
|
|
brightness
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Contrast
|
|
* @see https://tailwindcss.com/docs/contrast
|
|
*/ contrast: [
|
|
{
|
|
contrast: [
|
|
contrast
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Drop Shadow
|
|
* @see https://tailwindcss.com/docs/drop-shadow
|
|
*/ 'drop-shadow': [
|
|
{
|
|
'drop-shadow': [
|
|
'',
|
|
'none',
|
|
isTshirtSize,
|
|
isArbitraryValue
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Grayscale
|
|
* @see https://tailwindcss.com/docs/grayscale
|
|
*/ grayscale: [
|
|
{
|
|
grayscale: [
|
|
grayscale
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Hue Rotate
|
|
* @see https://tailwindcss.com/docs/hue-rotate
|
|
*/ 'hue-rotate': [
|
|
{
|
|
'hue-rotate': [
|
|
hueRotate
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Invert
|
|
* @see https://tailwindcss.com/docs/invert
|
|
*/ invert: [
|
|
{
|
|
invert: [
|
|
invert
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Saturate
|
|
* @see https://tailwindcss.com/docs/saturate
|
|
*/ saturate: [
|
|
{
|
|
saturate: [
|
|
saturate
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Sepia
|
|
* @see https://tailwindcss.com/docs/sepia
|
|
*/ sepia: [
|
|
{
|
|
sepia: [
|
|
sepia
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Backdrop Filter
|
|
* @deprecated since Tailwind CSS v3.0.0
|
|
* @see https://tailwindcss.com/docs/backdrop-filter
|
|
*/ 'backdrop-filter': [
|
|
{
|
|
'backdrop-filter': [
|
|
'',
|
|
'none'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Backdrop Blur
|
|
* @see https://tailwindcss.com/docs/backdrop-blur
|
|
*/ 'backdrop-blur': [
|
|
{
|
|
'backdrop-blur': [
|
|
blur
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Backdrop Brightness
|
|
* @see https://tailwindcss.com/docs/backdrop-brightness
|
|
*/ 'backdrop-brightness': [
|
|
{
|
|
'backdrop-brightness': [
|
|
brightness
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Backdrop Contrast
|
|
* @see https://tailwindcss.com/docs/backdrop-contrast
|
|
*/ 'backdrop-contrast': [
|
|
{
|
|
'backdrop-contrast': [
|
|
contrast
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Backdrop Grayscale
|
|
* @see https://tailwindcss.com/docs/backdrop-grayscale
|
|
*/ 'backdrop-grayscale': [
|
|
{
|
|
'backdrop-grayscale': [
|
|
grayscale
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Backdrop Hue Rotate
|
|
* @see https://tailwindcss.com/docs/backdrop-hue-rotate
|
|
*/ 'backdrop-hue-rotate': [
|
|
{
|
|
'backdrop-hue-rotate': [
|
|
hueRotate
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Backdrop Invert
|
|
* @see https://tailwindcss.com/docs/backdrop-invert
|
|
*/ 'backdrop-invert': [
|
|
{
|
|
'backdrop-invert': [
|
|
invert
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Backdrop Opacity
|
|
* @see https://tailwindcss.com/docs/backdrop-opacity
|
|
*/ 'backdrop-opacity': [
|
|
{
|
|
'backdrop-opacity': [
|
|
opacity
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Backdrop Saturate
|
|
* @see https://tailwindcss.com/docs/backdrop-saturate
|
|
*/ 'backdrop-saturate': [
|
|
{
|
|
'backdrop-saturate': [
|
|
saturate
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Backdrop Sepia
|
|
* @see https://tailwindcss.com/docs/backdrop-sepia
|
|
*/ 'backdrop-sepia': [
|
|
{
|
|
'backdrop-sepia': [
|
|
sepia
|
|
]
|
|
}
|
|
],
|
|
// Tables
|
|
/**
|
|
* Border Collapse
|
|
* @see https://tailwindcss.com/docs/border-collapse
|
|
*/ 'border-collapse': [
|
|
{
|
|
border: [
|
|
'collapse',
|
|
'separate'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Spacing
|
|
* @see https://tailwindcss.com/docs/border-spacing
|
|
*/ 'border-spacing': [
|
|
{
|
|
'border-spacing': [
|
|
borderSpacing
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Spacing X
|
|
* @see https://tailwindcss.com/docs/border-spacing
|
|
*/ 'border-spacing-x': [
|
|
{
|
|
'border-spacing-x': [
|
|
borderSpacing
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Border Spacing Y
|
|
* @see https://tailwindcss.com/docs/border-spacing
|
|
*/ 'border-spacing-y': [
|
|
{
|
|
'border-spacing-y': [
|
|
borderSpacing
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Table Layout
|
|
* @see https://tailwindcss.com/docs/table-layout
|
|
*/ 'table-layout': [
|
|
{
|
|
table: [
|
|
'auto',
|
|
'fixed'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Caption Side
|
|
* @see https://tailwindcss.com/docs/caption-side
|
|
*/ caption: [
|
|
{
|
|
caption: [
|
|
'top',
|
|
'bottom'
|
|
]
|
|
}
|
|
],
|
|
// Transitions and Animation
|
|
/**
|
|
* Tranisition Property
|
|
* @see https://tailwindcss.com/docs/transition-property
|
|
*/ transition: [
|
|
{
|
|
transition: [
|
|
'none',
|
|
'all',
|
|
'',
|
|
'colors',
|
|
'opacity',
|
|
'shadow',
|
|
'transform',
|
|
isArbitraryValue
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Transition Duration
|
|
* @see https://tailwindcss.com/docs/transition-duration
|
|
*/ duration: [
|
|
{
|
|
duration: getNumberAndArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Transition Timing Function
|
|
* @see https://tailwindcss.com/docs/transition-timing-function
|
|
*/ ease: [
|
|
{
|
|
ease: [
|
|
'linear',
|
|
'in',
|
|
'out',
|
|
'in-out',
|
|
isArbitraryValue
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Transition Delay
|
|
* @see https://tailwindcss.com/docs/transition-delay
|
|
*/ delay: [
|
|
{
|
|
delay: getNumberAndArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Animation
|
|
* @see https://tailwindcss.com/docs/animation
|
|
*/ animate: [
|
|
{
|
|
animate: [
|
|
'none',
|
|
'spin',
|
|
'ping',
|
|
'pulse',
|
|
'bounce',
|
|
isArbitraryValue
|
|
]
|
|
}
|
|
],
|
|
// Transforms
|
|
/**
|
|
* Transform
|
|
* @see https://tailwindcss.com/docs/transform
|
|
*/ transform: [
|
|
{
|
|
transform: [
|
|
'',
|
|
'gpu',
|
|
'none'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Scale
|
|
* @see https://tailwindcss.com/docs/scale
|
|
*/ scale: [
|
|
{
|
|
scale: [
|
|
scale
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Scale X
|
|
* @see https://tailwindcss.com/docs/scale
|
|
*/ 'scale-x': [
|
|
{
|
|
'scale-x': [
|
|
scale
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Scale Y
|
|
* @see https://tailwindcss.com/docs/scale
|
|
*/ 'scale-y': [
|
|
{
|
|
'scale-y': [
|
|
scale
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Rotate
|
|
* @see https://tailwindcss.com/docs/rotate
|
|
*/ rotate: [
|
|
{
|
|
rotate: [
|
|
isInteger,
|
|
isArbitraryValue
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Translate X
|
|
* @see https://tailwindcss.com/docs/translate
|
|
*/ 'translate-x': [
|
|
{
|
|
'translate-x': [
|
|
translate
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Translate Y
|
|
* @see https://tailwindcss.com/docs/translate
|
|
*/ 'translate-y': [
|
|
{
|
|
'translate-y': [
|
|
translate
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Skew X
|
|
* @see https://tailwindcss.com/docs/skew
|
|
*/ 'skew-x': [
|
|
{
|
|
'skew-x': [
|
|
skew
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Skew Y
|
|
* @see https://tailwindcss.com/docs/skew
|
|
*/ 'skew-y': [
|
|
{
|
|
'skew-y': [
|
|
skew
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Transform Origin
|
|
* @see https://tailwindcss.com/docs/transform-origin
|
|
*/ 'transform-origin': [
|
|
{
|
|
origin: [
|
|
'center',
|
|
'top',
|
|
'top-right',
|
|
'right',
|
|
'bottom-right',
|
|
'bottom',
|
|
'bottom-left',
|
|
'left',
|
|
'top-left',
|
|
isArbitraryValue
|
|
]
|
|
}
|
|
],
|
|
// Interactivity
|
|
/**
|
|
* Accent Color
|
|
* @see https://tailwindcss.com/docs/accent-color
|
|
*/ accent: [
|
|
{
|
|
accent: [
|
|
'auto',
|
|
colors
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Appearance
|
|
* @see https://tailwindcss.com/docs/appearance
|
|
*/ appearance: [
|
|
{
|
|
appearance: [
|
|
'none',
|
|
'auto'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Cursor
|
|
* @see https://tailwindcss.com/docs/cursor
|
|
*/ cursor: [
|
|
{
|
|
cursor: [
|
|
'auto',
|
|
'default',
|
|
'pointer',
|
|
'wait',
|
|
'text',
|
|
'move',
|
|
'help',
|
|
'not-allowed',
|
|
'none',
|
|
'context-menu',
|
|
'progress',
|
|
'cell',
|
|
'crosshair',
|
|
'vertical-text',
|
|
'alias',
|
|
'copy',
|
|
'no-drop',
|
|
'grab',
|
|
'grabbing',
|
|
'all-scroll',
|
|
'col-resize',
|
|
'row-resize',
|
|
'n-resize',
|
|
'e-resize',
|
|
's-resize',
|
|
'w-resize',
|
|
'ne-resize',
|
|
'nw-resize',
|
|
'se-resize',
|
|
'sw-resize',
|
|
'ew-resize',
|
|
'ns-resize',
|
|
'nesw-resize',
|
|
'nwse-resize',
|
|
'zoom-in',
|
|
'zoom-out',
|
|
isArbitraryValue
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Caret Color
|
|
* @see https://tailwindcss.com/docs/just-in-time-mode#caret-color-utilities
|
|
*/ 'caret-color': [
|
|
{
|
|
caret: [
|
|
colors
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Pointer Events
|
|
* @see https://tailwindcss.com/docs/pointer-events
|
|
*/ 'pointer-events': [
|
|
{
|
|
'pointer-events': [
|
|
'none',
|
|
'auto'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Resize
|
|
* @see https://tailwindcss.com/docs/resize
|
|
*/ resize: [
|
|
{
|
|
resize: [
|
|
'none',
|
|
'y',
|
|
'x',
|
|
''
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Scroll Behavior
|
|
* @see https://tailwindcss.com/docs/scroll-behavior
|
|
*/ 'scroll-behavior': [
|
|
{
|
|
scroll: [
|
|
'auto',
|
|
'smooth'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Scroll Margin
|
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
*/ 'scroll-m': [
|
|
{
|
|
'scroll-m': getSpacingWithArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Scroll Margin X
|
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
*/ 'scroll-mx': [
|
|
{
|
|
'scroll-mx': getSpacingWithArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Scroll Margin Y
|
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
*/ 'scroll-my': [
|
|
{
|
|
'scroll-my': getSpacingWithArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Scroll Margin Start
|
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
*/ 'scroll-ms': [
|
|
{
|
|
'scroll-ms': getSpacingWithArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Scroll Margin End
|
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
*/ 'scroll-me': [
|
|
{
|
|
'scroll-me': getSpacingWithArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Scroll Margin Top
|
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
*/ 'scroll-mt': [
|
|
{
|
|
'scroll-mt': getSpacingWithArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Scroll Margin Right
|
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
*/ 'scroll-mr': [
|
|
{
|
|
'scroll-mr': getSpacingWithArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Scroll Margin Bottom
|
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
*/ 'scroll-mb': [
|
|
{
|
|
'scroll-mb': getSpacingWithArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Scroll Margin Left
|
|
* @see https://tailwindcss.com/docs/scroll-margin
|
|
*/ 'scroll-ml': [
|
|
{
|
|
'scroll-ml': getSpacingWithArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Scroll Padding
|
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
*/ 'scroll-p': [
|
|
{
|
|
'scroll-p': getSpacingWithArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Scroll Padding X
|
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
*/ 'scroll-px': [
|
|
{
|
|
'scroll-px': getSpacingWithArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Scroll Padding Y
|
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
*/ 'scroll-py': [
|
|
{
|
|
'scroll-py': getSpacingWithArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Scroll Padding Start
|
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
*/ 'scroll-ps': [
|
|
{
|
|
'scroll-ps': getSpacingWithArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Scroll Padding End
|
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
*/ 'scroll-pe': [
|
|
{
|
|
'scroll-pe': getSpacingWithArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Scroll Padding Top
|
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
*/ 'scroll-pt': [
|
|
{
|
|
'scroll-pt': getSpacingWithArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Scroll Padding Right
|
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
*/ 'scroll-pr': [
|
|
{
|
|
'scroll-pr': getSpacingWithArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Scroll Padding Bottom
|
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
*/ 'scroll-pb': [
|
|
{
|
|
'scroll-pb': getSpacingWithArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Scroll Padding Left
|
|
* @see https://tailwindcss.com/docs/scroll-padding
|
|
*/ 'scroll-pl': [
|
|
{
|
|
'scroll-pl': getSpacingWithArbitrary()
|
|
}
|
|
],
|
|
/**
|
|
* Scroll Snap Align
|
|
* @see https://tailwindcss.com/docs/scroll-snap-align
|
|
*/ 'snap-align': [
|
|
{
|
|
snap: [
|
|
'start',
|
|
'end',
|
|
'center',
|
|
'align-none'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Scroll Snap Stop
|
|
* @see https://tailwindcss.com/docs/scroll-snap-stop
|
|
*/ 'snap-stop': [
|
|
{
|
|
snap: [
|
|
'normal',
|
|
'always'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Scroll Snap Type
|
|
* @see https://tailwindcss.com/docs/scroll-snap-type
|
|
*/ 'snap-type': [
|
|
{
|
|
snap: [
|
|
'none',
|
|
'x',
|
|
'y',
|
|
'both'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Scroll Snap Type Strictness
|
|
* @see https://tailwindcss.com/docs/scroll-snap-type
|
|
*/ 'snap-strictness': [
|
|
{
|
|
snap: [
|
|
'mandatory',
|
|
'proximity'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Touch Action
|
|
* @see https://tailwindcss.com/docs/touch-action
|
|
*/ touch: [
|
|
{
|
|
touch: [
|
|
'auto',
|
|
'none',
|
|
'manipulation'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Touch Action X
|
|
* @see https://tailwindcss.com/docs/touch-action
|
|
*/ 'touch-x': [
|
|
{
|
|
'touch-pan': [
|
|
'x',
|
|
'left',
|
|
'right'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Touch Action Y
|
|
* @see https://tailwindcss.com/docs/touch-action
|
|
*/ 'touch-y': [
|
|
{
|
|
'touch-pan': [
|
|
'y',
|
|
'up',
|
|
'down'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Touch Action Pinch Zoom
|
|
* @see https://tailwindcss.com/docs/touch-action
|
|
*/ 'touch-pz': [
|
|
'touch-pinch-zoom'
|
|
],
|
|
/**
|
|
* User Select
|
|
* @see https://tailwindcss.com/docs/user-select
|
|
*/ select: [
|
|
{
|
|
select: [
|
|
'none',
|
|
'text',
|
|
'all',
|
|
'auto'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Will Change
|
|
* @see https://tailwindcss.com/docs/will-change
|
|
*/ 'will-change': [
|
|
{
|
|
'will-change': [
|
|
'auto',
|
|
'scroll',
|
|
'contents',
|
|
'transform',
|
|
isArbitraryValue
|
|
]
|
|
}
|
|
],
|
|
// SVG
|
|
/**
|
|
* Fill
|
|
* @see https://tailwindcss.com/docs/fill
|
|
*/ fill: [
|
|
{
|
|
fill: [
|
|
colors,
|
|
'none'
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Stroke Width
|
|
* @see https://tailwindcss.com/docs/stroke-width
|
|
*/ 'stroke-w': [
|
|
{
|
|
stroke: [
|
|
isLength,
|
|
isArbitraryLength,
|
|
isArbitraryNumber
|
|
]
|
|
}
|
|
],
|
|
/**
|
|
* Stroke
|
|
* @see https://tailwindcss.com/docs/stroke
|
|
*/ stroke: [
|
|
{
|
|
stroke: [
|
|
colors,
|
|
'none'
|
|
]
|
|
}
|
|
],
|
|
// Accessibility
|
|
/**
|
|
* Screen Readers
|
|
* @see https://tailwindcss.com/docs/screen-readers
|
|
*/ sr: [
|
|
'sr-only',
|
|
'not-sr-only'
|
|
],
|
|
/**
|
|
* Forced Color Adjust
|
|
* @see https://tailwindcss.com/docs/forced-color-adjust
|
|
*/ 'forced-color-adjust': [
|
|
{
|
|
'forced-color-adjust': [
|
|
'auto',
|
|
'none'
|
|
]
|
|
}
|
|
]
|
|
},
|
|
conflictingClassGroups: {
|
|
overflow: [
|
|
'overflow-x',
|
|
'overflow-y'
|
|
],
|
|
overscroll: [
|
|
'overscroll-x',
|
|
'overscroll-y'
|
|
],
|
|
inset: [
|
|
'inset-x',
|
|
'inset-y',
|
|
'start',
|
|
'end',
|
|
'top',
|
|
'right',
|
|
'bottom',
|
|
'left'
|
|
],
|
|
'inset-x': [
|
|
'right',
|
|
'left'
|
|
],
|
|
'inset-y': [
|
|
'top',
|
|
'bottom'
|
|
],
|
|
flex: [
|
|
'basis',
|
|
'grow',
|
|
'shrink'
|
|
],
|
|
gap: [
|
|
'gap-x',
|
|
'gap-y'
|
|
],
|
|
p: [
|
|
'px',
|
|
'py',
|
|
'ps',
|
|
'pe',
|
|
'pt',
|
|
'pr',
|
|
'pb',
|
|
'pl'
|
|
],
|
|
px: [
|
|
'pr',
|
|
'pl'
|
|
],
|
|
py: [
|
|
'pt',
|
|
'pb'
|
|
],
|
|
m: [
|
|
'mx',
|
|
'my',
|
|
'ms',
|
|
'me',
|
|
'mt',
|
|
'mr',
|
|
'mb',
|
|
'ml'
|
|
],
|
|
mx: [
|
|
'mr',
|
|
'ml'
|
|
],
|
|
my: [
|
|
'mt',
|
|
'mb'
|
|
],
|
|
size: [
|
|
'w',
|
|
'h'
|
|
],
|
|
'font-size': [
|
|
'leading'
|
|
],
|
|
'fvn-normal': [
|
|
'fvn-ordinal',
|
|
'fvn-slashed-zero',
|
|
'fvn-figure',
|
|
'fvn-spacing',
|
|
'fvn-fraction'
|
|
],
|
|
'fvn-ordinal': [
|
|
'fvn-normal'
|
|
],
|
|
'fvn-slashed-zero': [
|
|
'fvn-normal'
|
|
],
|
|
'fvn-figure': [
|
|
'fvn-normal'
|
|
],
|
|
'fvn-spacing': [
|
|
'fvn-normal'
|
|
],
|
|
'fvn-fraction': [
|
|
'fvn-normal'
|
|
],
|
|
'line-clamp': [
|
|
'display',
|
|
'overflow'
|
|
],
|
|
rounded: [
|
|
'rounded-s',
|
|
'rounded-e',
|
|
'rounded-t',
|
|
'rounded-r',
|
|
'rounded-b',
|
|
'rounded-l',
|
|
'rounded-ss',
|
|
'rounded-se',
|
|
'rounded-ee',
|
|
'rounded-es',
|
|
'rounded-tl',
|
|
'rounded-tr',
|
|
'rounded-br',
|
|
'rounded-bl'
|
|
],
|
|
'rounded-s': [
|
|
'rounded-ss',
|
|
'rounded-es'
|
|
],
|
|
'rounded-e': [
|
|
'rounded-se',
|
|
'rounded-ee'
|
|
],
|
|
'rounded-t': [
|
|
'rounded-tl',
|
|
'rounded-tr'
|
|
],
|
|
'rounded-r': [
|
|
'rounded-tr',
|
|
'rounded-br'
|
|
],
|
|
'rounded-b': [
|
|
'rounded-br',
|
|
'rounded-bl'
|
|
],
|
|
'rounded-l': [
|
|
'rounded-tl',
|
|
'rounded-bl'
|
|
],
|
|
'border-spacing': [
|
|
'border-spacing-x',
|
|
'border-spacing-y'
|
|
],
|
|
'border-w': [
|
|
'border-w-s',
|
|
'border-w-e',
|
|
'border-w-t',
|
|
'border-w-r',
|
|
'border-w-b',
|
|
'border-w-l'
|
|
],
|
|
'border-w-x': [
|
|
'border-w-r',
|
|
'border-w-l'
|
|
],
|
|
'border-w-y': [
|
|
'border-w-t',
|
|
'border-w-b'
|
|
],
|
|
'border-color': [
|
|
'border-color-s',
|
|
'border-color-e',
|
|
'border-color-t',
|
|
'border-color-r',
|
|
'border-color-b',
|
|
'border-color-l'
|
|
],
|
|
'border-color-x': [
|
|
'border-color-r',
|
|
'border-color-l'
|
|
],
|
|
'border-color-y': [
|
|
'border-color-t',
|
|
'border-color-b'
|
|
],
|
|
'scroll-m': [
|
|
'scroll-mx',
|
|
'scroll-my',
|
|
'scroll-ms',
|
|
'scroll-me',
|
|
'scroll-mt',
|
|
'scroll-mr',
|
|
'scroll-mb',
|
|
'scroll-ml'
|
|
],
|
|
'scroll-mx': [
|
|
'scroll-mr',
|
|
'scroll-ml'
|
|
],
|
|
'scroll-my': [
|
|
'scroll-mt',
|
|
'scroll-mb'
|
|
],
|
|
'scroll-p': [
|
|
'scroll-px',
|
|
'scroll-py',
|
|
'scroll-ps',
|
|
'scroll-pe',
|
|
'scroll-pt',
|
|
'scroll-pr',
|
|
'scroll-pb',
|
|
'scroll-pl'
|
|
],
|
|
'scroll-px': [
|
|
'scroll-pr',
|
|
'scroll-pl'
|
|
],
|
|
'scroll-py': [
|
|
'scroll-pt',
|
|
'scroll-pb'
|
|
],
|
|
touch: [
|
|
'touch-x',
|
|
'touch-y',
|
|
'touch-pz'
|
|
],
|
|
'touch-x': [
|
|
'touch'
|
|
],
|
|
'touch-y': [
|
|
'touch'
|
|
],
|
|
'touch-pz': [
|
|
'touch'
|
|
]
|
|
},
|
|
conflictingClassGroupModifiers: {
|
|
'font-size': [
|
|
'leading'
|
|
]
|
|
}
|
|
};
|
|
};
|
|
/**
|
|
* @param baseConfig Config where other config will be merged into. This object will be mutated.
|
|
* @param configExtension Partial config to merge into the `baseConfig`.
|
|
*/ const mergeConfigs = (baseConfig, { cacheSize, prefix, separator, experimentalParseClassName, extend = {}, override = {} })=>{
|
|
overrideProperty(baseConfig, 'cacheSize', cacheSize);
|
|
overrideProperty(baseConfig, 'prefix', prefix);
|
|
overrideProperty(baseConfig, 'separator', separator);
|
|
overrideProperty(baseConfig, 'experimentalParseClassName', experimentalParseClassName);
|
|
for(const configKey in override){
|
|
overrideConfigProperties(baseConfig[configKey], override[configKey]);
|
|
}
|
|
for(const key in extend){
|
|
mergeConfigProperties(baseConfig[key], extend[key]);
|
|
}
|
|
return baseConfig;
|
|
};
|
|
const overrideProperty = (baseObject, overrideKey, overrideValue)=>{
|
|
if (overrideValue !== undefined) {
|
|
baseObject[overrideKey] = overrideValue;
|
|
}
|
|
};
|
|
const overrideConfigProperties = (baseObject, overrideObject)=>{
|
|
if (overrideObject) {
|
|
for(const key in overrideObject){
|
|
overrideProperty(baseObject, key, overrideObject[key]);
|
|
}
|
|
}
|
|
};
|
|
const mergeConfigProperties = (baseObject, mergeObject)=>{
|
|
if (mergeObject) {
|
|
for(const key in mergeObject){
|
|
const mergeValue = mergeObject[key];
|
|
if (mergeValue !== undefined) {
|
|
baseObject[key] = (baseObject[key] || []).concat(mergeValue);
|
|
}
|
|
}
|
|
}
|
|
};
|
|
const extendTailwindMerge = (configExtension, ...createConfig)=>typeof configExtension === 'function' ? createTailwindMerge(getDefaultConfig, configExtension, ...createConfig) : createTailwindMerge(()=>mergeConfigs(getDefaultConfig(), configExtension), ...createConfig);
|
|
const twMerge = /*#__PURE__*/ createTailwindMerge(getDefaultConfig);
|
|
;
|
|
//# sourceMappingURL=bundle-mjs.mjs.map
|
|
}),
|
|
"[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/lucide-react@0.454.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils.js [app-client] (ecmascript)", ((__turbopack_context__) => {
|
|
"use strict";
|
|
|
|
/**
|
|
* @license lucide-react v0.454.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/ __turbopack_context__.s([
|
|
"mergeClasses",
|
|
()=>mergeClasses,
|
|
"toKebabCase",
|
|
()=>toKebabCase
|
|
]);
|
|
const toKebabCase = (string)=>string.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase();
|
|
const mergeClasses = (...classes)=>classes.filter((className, index, array)=>{
|
|
return Boolean(className) && className.trim() !== "" && array.indexOf(className) === index;
|
|
}).join(" ").trim();
|
|
;
|
|
//# sourceMappingURL=utils.js.map
|
|
}),
|
|
"[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/lucide-react@0.454.0_react@19.2.0/node_modules/lucide-react/dist/esm/defaultAttributes.js [app-client] (ecmascript)", ((__turbopack_context__) => {
|
|
"use strict";
|
|
|
|
/**
|
|
* @license lucide-react v0.454.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/ __turbopack_context__.s([
|
|
"default",
|
|
()=>defaultAttributes
|
|
]);
|
|
var defaultAttributes = {
|
|
xmlns: "http://www.w3.org/2000/svg",
|
|
width: 24,
|
|
height: 24,
|
|
viewBox: "0 0 24 24",
|
|
fill: "none",
|
|
stroke: "currentColor",
|
|
strokeWidth: 2,
|
|
strokeLinecap: "round",
|
|
strokeLinejoin: "round"
|
|
};
|
|
;
|
|
//# sourceMappingURL=defaultAttributes.js.map
|
|
}),
|
|
"[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/lucide-react@0.454.0_react@19.2.0/node_modules/lucide-react/dist/esm/Icon.js [app-client] (ecmascript)", ((__turbopack_context__) => {
|
|
"use strict";
|
|
|
|
/**
|
|
* @license lucide-react v0.454.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/ __turbopack_context__.s([
|
|
"default",
|
|
()=>Icon
|
|
]);
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/next@16.0.3_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/next/dist/compiled/react/index.js [app-client] (ecmascript)");
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$lucide$2d$react$40$0$2e$454$2e$0_react$40$19$2e$2$2e$0$2f$node_modules$2f$lucide$2d$react$2f$dist$2f$esm$2f$defaultAttributes$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/lucide-react@0.454.0_react@19.2.0/node_modules/lucide-react/dist/esm/defaultAttributes.js [app-client] (ecmascript)");
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$lucide$2d$react$40$0$2e$454$2e$0_react$40$19$2e$2$2e$0$2f$node_modules$2f$lucide$2d$react$2f$dist$2f$esm$2f$shared$2f$src$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/lucide-react@0.454.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils.js [app-client] (ecmascript)");
|
|
;
|
|
;
|
|
;
|
|
const Icon = (0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["forwardRef"])(({ color = "currentColor", size = 24, strokeWidth = 2, absoluteStrokeWidth, className = "", children, iconNode, ...rest }, ref)=>{
|
|
return (0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["createElement"])("svg", {
|
|
ref,
|
|
...__TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$lucide$2d$react$40$0$2e$454$2e$0_react$40$19$2e$2$2e$0$2f$node_modules$2f$lucide$2d$react$2f$dist$2f$esm$2f$defaultAttributes$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"],
|
|
width: size,
|
|
height: size,
|
|
stroke: color,
|
|
strokeWidth: absoluteStrokeWidth ? Number(strokeWidth) * 24 / Number(size) : strokeWidth,
|
|
className: (0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$lucide$2d$react$40$0$2e$454$2e$0_react$40$19$2e$2$2e$0$2f$node_modules$2f$lucide$2d$react$2f$dist$2f$esm$2f$shared$2f$src$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["mergeClasses"])("lucide", className),
|
|
...rest
|
|
}, [
|
|
...iconNode.map(([tag, attrs])=>(0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["createElement"])(tag, attrs)),
|
|
...Array.isArray(children) ? children : [
|
|
children
|
|
]
|
|
]);
|
|
});
|
|
;
|
|
//# sourceMappingURL=Icon.js.map
|
|
}),
|
|
"[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/lucide-react@0.454.0_react@19.2.0/node_modules/lucide-react/dist/esm/createLucideIcon.js [app-client] (ecmascript)", ((__turbopack_context__) => {
|
|
"use strict";
|
|
|
|
/**
|
|
* @license lucide-react v0.454.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/ __turbopack_context__.s([
|
|
"default",
|
|
()=>createLucideIcon
|
|
]);
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/next@16.0.3_react-dom@19.2.0_react@19.2.0__react@19.2.0/node_modules/next/dist/compiled/react/index.js [app-client] (ecmascript)");
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$lucide$2d$react$40$0$2e$454$2e$0_react$40$19$2e$2$2e$0$2f$node_modules$2f$lucide$2d$react$2f$dist$2f$esm$2f$shared$2f$src$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/lucide-react@0.454.0_react@19.2.0/node_modules/lucide-react/dist/esm/shared/src/utils.js [app-client] (ecmascript)");
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$lucide$2d$react$40$0$2e$454$2e$0_react$40$19$2e$2$2e$0$2f$node_modules$2f$lucide$2d$react$2f$dist$2f$esm$2f$Icon$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/lucide-react@0.454.0_react@19.2.0/node_modules/lucide-react/dist/esm/Icon.js [app-client] (ecmascript)");
|
|
;
|
|
;
|
|
;
|
|
const createLucideIcon = (iconName, iconNode)=>{
|
|
const Component = (0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["forwardRef"])(({ className, ...props }, ref)=>(0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$next$40$16$2e$0$2e$3_react$2d$dom$40$19$2e$2$2e$0_react$40$19$2e$2$2e$0_$5f$react$40$19$2e$2$2e$0$2f$node_modules$2f$next$2f$dist$2f$compiled$2f$react$2f$index$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["createElement"])(__TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$lucide$2d$react$40$0$2e$454$2e$0_react$40$19$2e$2$2e$0$2f$node_modules$2f$lucide$2d$react$2f$dist$2f$esm$2f$Icon$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"], {
|
|
ref,
|
|
iconNode,
|
|
className: (0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$lucide$2d$react$40$0$2e$454$2e$0_react$40$19$2e$2$2e$0$2f$node_modules$2f$lucide$2d$react$2f$dist$2f$esm$2f$shared$2f$src$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["mergeClasses"])(`lucide-${(0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$lucide$2d$react$40$0$2e$454$2e$0_react$40$19$2e$2$2e$0$2f$node_modules$2f$lucide$2d$react$2f$dist$2f$esm$2f$shared$2f$src$2f$utils$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["toKebabCase"])(iconName)}`, className),
|
|
...props
|
|
}));
|
|
Component.displayName = `${iconName}`;
|
|
return Component;
|
|
};
|
|
;
|
|
//# sourceMappingURL=createLucideIcon.js.map
|
|
}),
|
|
"[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/lucide-react@0.454.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/download.js [app-client] (ecmascript)", ((__turbopack_context__) => {
|
|
"use strict";
|
|
|
|
/**
|
|
* @license lucide-react v0.454.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/ __turbopack_context__.s([
|
|
"default",
|
|
()=>Download
|
|
]);
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$lucide$2d$react$40$0$2e$454$2e$0_react$40$19$2e$2$2e$0$2f$node_modules$2f$lucide$2d$react$2f$dist$2f$esm$2f$createLucideIcon$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/lucide-react@0.454.0_react@19.2.0/node_modules/lucide-react/dist/esm/createLucideIcon.js [app-client] (ecmascript)");
|
|
;
|
|
const Download = (0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$lucide$2d$react$40$0$2e$454$2e$0_react$40$19$2e$2$2e$0$2f$node_modules$2f$lucide$2d$react$2f$dist$2f$esm$2f$createLucideIcon$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"])("Download", [
|
|
[
|
|
"path",
|
|
{
|
|
d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",
|
|
key: "ih7n3h"
|
|
}
|
|
],
|
|
[
|
|
"polyline",
|
|
{
|
|
points: "7 10 12 15 17 10",
|
|
key: "2ggqvy"
|
|
}
|
|
],
|
|
[
|
|
"line",
|
|
{
|
|
x1: "12",
|
|
x2: "12",
|
|
y1: "15",
|
|
y2: "3",
|
|
key: "1vk2je"
|
|
}
|
|
]
|
|
]);
|
|
;
|
|
//# sourceMappingURL=download.js.map
|
|
}),
|
|
"[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/lucide-react@0.454.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/download.js [app-client] (ecmascript) <export default as Download>", ((__turbopack_context__) => {
|
|
"use strict";
|
|
|
|
__turbopack_context__.s([
|
|
"Download",
|
|
()=>__TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$lucide$2d$react$40$0$2e$454$2e$0_react$40$19$2e$2$2e$0$2f$node_modules$2f$lucide$2d$react$2f$dist$2f$esm$2f$icons$2f$download$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"]
|
|
]);
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$lucide$2d$react$40$0$2e$454$2e$0_react$40$19$2e$2$2e$0$2f$node_modules$2f$lucide$2d$react$2f$dist$2f$esm$2f$icons$2f$download$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/lucide-react@0.454.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/download.js [app-client] (ecmascript)");
|
|
}),
|
|
"[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/lucide-react@0.454.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/x.js [app-client] (ecmascript)", ((__turbopack_context__) => {
|
|
"use strict";
|
|
|
|
/**
|
|
* @license lucide-react v0.454.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/ __turbopack_context__.s([
|
|
"default",
|
|
()=>X
|
|
]);
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$lucide$2d$react$40$0$2e$454$2e$0_react$40$19$2e$2$2e$0$2f$node_modules$2f$lucide$2d$react$2f$dist$2f$esm$2f$createLucideIcon$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/lucide-react@0.454.0_react@19.2.0/node_modules/lucide-react/dist/esm/createLucideIcon.js [app-client] (ecmascript)");
|
|
;
|
|
const X = (0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$lucide$2d$react$40$0$2e$454$2e$0_react$40$19$2e$2$2e$0$2f$node_modules$2f$lucide$2d$react$2f$dist$2f$esm$2f$createLucideIcon$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"])("X", [
|
|
[
|
|
"path",
|
|
{
|
|
d: "M18 6 6 18",
|
|
key: "1bl5f8"
|
|
}
|
|
],
|
|
[
|
|
"path",
|
|
{
|
|
d: "m6 6 12 12",
|
|
key: "d8bk6v"
|
|
}
|
|
]
|
|
]);
|
|
;
|
|
//# sourceMappingURL=x.js.map
|
|
}),
|
|
"[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/lucide-react@0.454.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/x.js [app-client] (ecmascript) <export default as X>", ((__turbopack_context__) => {
|
|
"use strict";
|
|
|
|
__turbopack_context__.s([
|
|
"X",
|
|
()=>__TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$lucide$2d$react$40$0$2e$454$2e$0_react$40$19$2e$2$2e$0$2f$node_modules$2f$lucide$2d$react$2f$dist$2f$esm$2f$icons$2f$x$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"]
|
|
]);
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$lucide$2d$react$40$0$2e$454$2e$0_react$40$19$2e$2$2e$0$2f$node_modules$2f$lucide$2d$react$2f$dist$2f$esm$2f$icons$2f$x$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/lucide-react@0.454.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/x.js [app-client] (ecmascript)");
|
|
}),
|
|
"[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/lucide-react@0.454.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/smartphone.js [app-client] (ecmascript)", ((__turbopack_context__) => {
|
|
"use strict";
|
|
|
|
/**
|
|
* @license lucide-react v0.454.0 - ISC
|
|
*
|
|
* This source code is licensed under the ISC license.
|
|
* See the LICENSE file in the root directory of this source tree.
|
|
*/ __turbopack_context__.s([
|
|
"default",
|
|
()=>Smartphone
|
|
]);
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$lucide$2d$react$40$0$2e$454$2e$0_react$40$19$2e$2$2e$0$2f$node_modules$2f$lucide$2d$react$2f$dist$2f$esm$2f$createLucideIcon$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/lucide-react@0.454.0_react@19.2.0/node_modules/lucide-react/dist/esm/createLucideIcon.js [app-client] (ecmascript)");
|
|
;
|
|
const Smartphone = (0, __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$lucide$2d$react$40$0$2e$454$2e$0_react$40$19$2e$2$2e$0$2f$node_modules$2f$lucide$2d$react$2f$dist$2f$esm$2f$createLucideIcon$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"])("Smartphone", [
|
|
[
|
|
"rect",
|
|
{
|
|
width: "14",
|
|
height: "20",
|
|
x: "5",
|
|
y: "2",
|
|
rx: "2",
|
|
ry: "2",
|
|
key: "1yt0o3"
|
|
}
|
|
],
|
|
[
|
|
"path",
|
|
{
|
|
d: "M12 18h.01",
|
|
key: "mhygvu"
|
|
}
|
|
]
|
|
]);
|
|
;
|
|
//# sourceMappingURL=smartphone.js.map
|
|
}),
|
|
"[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/lucide-react@0.454.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/smartphone.js [app-client] (ecmascript) <export default as Smartphone>", ((__turbopack_context__) => {
|
|
"use strict";
|
|
|
|
__turbopack_context__.s([
|
|
"Smartphone",
|
|
()=>__TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$lucide$2d$react$40$0$2e$454$2e$0_react$40$19$2e$2$2e$0$2f$node_modules$2f$lucide$2d$react$2f$dist$2f$esm$2f$icons$2f$smartphone$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__["default"]
|
|
]);
|
|
var __TURBOPACK__imported__module__$5b$project$5d2f$Documents$2f$go$2d$new$2f$chinese$2d$family$2d$tree$2f$node_modules$2f2e$pnpm$2f$lucide$2d$react$40$0$2e$454$2e$0_react$40$19$2e$2$2e$0$2f$node_modules$2f$lucide$2d$react$2f$dist$2f$esm$2f$icons$2f$smartphone$2e$js__$5b$app$2d$client$5d$__$28$ecmascript$29$__ = __turbopack_context__.i("[project]/Documents/go-new/chinese-family-tree/node_modules/.pnpm/lucide-react@0.454.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/smartphone.js [app-client] (ecmascript)");
|
|
}),
|
|
]);
|
|
|
|
//# sourceMappingURL=a0629__pnpm_099d4172._.js.map
|