n8n-editor-ui 1.63.2 → 1.64.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{AnnotationTagsDropdown.ee-BrHzX0gM.js → AnnotationTagsDropdown.ee.vue_vue_type_script_setup_true_lang-D3L0Zqex.js} +2 -3
- package/dist/assets/{AuthView-DBTpAWBR.js → AuthView-Bc_d9TU4.js} +3 -6
- package/dist/assets/{AuthView-BnHKMYu_.css → AuthView-Cnr31xHM.css} +6 -5
- package/dist/assets/{CanvasControls-DJjSv7Wo.js → CanvasControls-BZZ5xUA4.js} +1 -31
- package/dist/assets/{ChangePasswordView-4HfufusV.js → ChangePasswordView-BmKDYqVl.js} +2 -32
- package/dist/assets/CollectionParameter-CZX6_SwN.js +4 -0
- package/dist/assets/{CredentialsView-ChVc0kqb.js → CredentialsView-BERKB9pX.js} +5 -35
- package/dist/assets/{ErrorView-C3MNpu-h.js → ErrorView-CGHYke1h.js} +1 -31
- package/dist/assets/{ExecutionsFilter-C71cMIbt.js → ExecutionsFilter-DgmpIaxp.js} +2 -5
- package/dist/assets/{ExecutionsView-CyfD2AaP.js → ExecutionsView-BVJE03N7.js} +18 -54
- package/dist/assets/{file-saver-Dbfm4l4I.js → FileSaver.min-vFM8HBH6.js} +5 -12
- package/dist/assets/{FixedCollectionParameter-DjS7zdm4.js → FixedCollectionParameter-Cu1pUHaU.js} +1 -32
- package/dist/assets/{ForgotMyPasswordView-BThu5AzW.js → ForgotMyPasswordView-CA1z31op.js} +2 -32
- package/dist/assets/{MainHeader-BonioYN5.js → MainHeader-lphq3_C7.js} +8 -47
- package/dist/assets/{MainSidebar-NOlas3VF.js → MainSidebar-CkmsLAKw.js} +5 -44
- package/dist/assets/{NodeCreation-ByUlHR8c.js → NodeCreation-CDKKeIJl.js} +4 -7
- package/dist/assets/{NodeCreator-DE9FRbnS.js → NodeCreator-vrcCon6T.js} +20 -64
- package/dist/assets/{NodeViewSwitcher-D7fdLnF1.js → NodeViewSwitcher-CebfwLIC.js} +17198 -4326
- package/dist/assets/{NodeViewSwitcher-BMWd0Gm9.css → NodeViewSwitcher-DFIa0RPL.css} +136 -135
- package/dist/assets/{ProjectCardBadge-f4baniz3.js → ProjectCardBadge.vue_vue_type_script_setup_true_lang-FPZVaoxg.js} +1 -12
- package/dist/assets/{ProjectSettings-CeJUMGSQ.js → ProjectSettings-CGPWNP7C.js} +6 -38
- package/dist/assets/{ProjectTabs-dq7a740r.js → ProjectTabs-D-UxAFWq.js} +1 -3
- package/dist/assets/{PushConnectionTracker-Bs_UzKPJ.js → PushConnectionTracker-dMPKSiLd.js} +1 -4
- package/dist/assets/{ResourcesListLayout-B1XBsMRy.js → ResourcesListLayout-BmEYzLen.js} +2 -7
- package/dist/assets/{RunDataAi-DdGO06st.js → RunDataAi-iy_LiKYx.js} +51 -13
- package/dist/assets/{RunDataJson-DTKvzLZz.js → RunDataJson-30CwTvxp.js} +11 -34
- package/dist/assets/{jsonpath--XXuA3UN.js → RunDataJsonActions-DM8Iegu4.js} +272 -73
- package/dist/assets/{RunDataSearch-CW0connN.js → RunDataSearch-BBZyQz1l.js} +1 -31
- package/dist/assets/{RunDataTable-C-mEq2dD.js → RunDataTable-DlYCaRmD.js} +43 -70
- package/dist/assets/{SamlOnboarding-BfsNvcA1.js → SamlOnboarding-YPyqQAED.js} +2 -32
- package/dist/assets/{SettingsApiView--aIfdlDF.js → SettingsApiView-DM8-r2vC.js} +11 -42
- package/dist/assets/{SettingsCommunityNodesView-DdyT-sgu.js → SettingsCommunityNodesView-CKUSvNJA.js} +3 -35
- package/dist/assets/{SettingsExternalSecrets-DTMX68vp.js → SettingsExternalSecrets-rn0Uon3J.js} +2 -32
- package/dist/assets/SettingsFakeDoorView-DRt2eUs1.js +44 -0
- package/dist/assets/{humanize-duration-DdvB4QXM.js → SettingsLdapView-BkNvZbuP.js} +827 -12
- package/dist/assets/{SettingsLogStreamingView-lQvw760T.js → SettingsLogStreamingView-DJgGrIQ1.js} +1 -31
- package/dist/assets/{SettingsPersonalView-2vlxeSgj.js → SettingsPersonalView-B2bLHSrL.js} +1 -31
- package/dist/assets/{SettingsSourceControl-1Z-AF1Yv.js → SettingsSourceControl-B_iPYBUX.js} +4 -35
- package/dist/assets/{SettingsSso-Bp82V4Mw.js → SettingsSso-Bo8ktz1t.js} +1 -31
- package/dist/assets/{SettingsUsageAndPlan-CDXY25ax.js → SettingsUsageAndPlan-C9jiEOqE.js} +1 -32
- package/dist/assets/{SettingsUsersView-3sIYeb4A.js → SettingsUsersView-Do-E2R-M.js} +1 -31
- package/dist/assets/{SettingsView-BNNArsIx.js → SettingsView-DK-_ao4_.js} +25 -34
- package/dist/assets/{SetupView-pspJi2at.js → SetupView-ZFKQKIJD.js} +2 -32
- package/dist/assets/{SetupWorkflowCredentialsButton-SC5-MI0D.js → SetupWorkflowCredentialsButton-BaMJBfk2.js} +1 -31
- package/dist/assets/{SetupWorkflowFromTemplateView-CU3grpvN.js → SetupWorkflowFromTemplateView-BvmNbGYh.js} +3 -33
- package/dist/assets/{SigninView-CZdE2LU3.js → SigninView-k_FnQgNC.js} +2 -32
- package/dist/assets/SignoutView-DTgJmCun.js +27 -0
- package/dist/assets/{SignupView-BPlt_Lbh.js → SignupView-GFIqKxQ1.js} +2 -32
- package/dist/assets/{TemplateDetails-CdRKYWL6.js → TemplateDetails-CrE5d8Z2.js} +1 -4
- package/dist/assets/{TemplateList-BYq50eQG.js → TemplateList-DugVXLa6.js} +1 -3
- package/dist/assets/{TemplatesCollectionView-D-N6pD00.js → TemplatesCollectionView-BulzRTVk.js} +5 -35
- package/dist/assets/{TemplatesSearchView-CaRL_LUd.js → TemplatesSearchView--aU9JJ_A.js} +738 -41
- package/dist/assets/{TemplatesSearchView-BYNWZYGm.css → TemplatesSearchView-BiokbeYf.css} +94 -1
- package/dist/assets/{TemplatesView-C5HnqMFU.js → TemplatesView-VxuSLtRB.js} +1 -3
- package/dist/assets/{TemplatesWorkflowView-XV_mNcau.js → TemplatesWorkflowView-DEOmoGFU.js} +5 -35
- package/dist/assets/{VariablesView-CDacoelY.js → VariablesView-D0qaiG35.js} +2 -33
- package/dist/assets/{WorkerView-DciBUDzM.js → WorkerView-BQWPVPCG.js} +159 -43
- package/dist/assets/{WorkflowActivator-GHyUbwAO.js → WorkflowActivator-CFE8HnEQ.js} +3 -7
- package/dist/assets/{WorkflowExecutionsInfoAccordion-Dez7kHwM.js → WorkflowExecutionsInfoAccordion-j1oBChRL.js} +1 -3
- package/dist/assets/{WorkflowExecutionsLandingPage-j7sS9stL.js → WorkflowExecutionsLandingPage-7PqoziUe.js} +2 -32
- package/dist/assets/{WorkflowExecutionsPreview-DLogApYK.js → WorkflowExecutionsPreview-BCKc44DY.js} +10 -42
- package/dist/assets/{WorkflowExecutionsView-CZ0E-5CZ.js → WorkflowExecutionsView-De-rqjwc.js} +6 -37
- package/dist/assets/{WorkflowHistory-D6BLJ_QX.js → WorkflowHistory-BQHDI-k-.js} +8 -45
- package/dist/assets/{WorkflowOnboardingView-7Z0s7yrd.js → WorkflowOnboardingView-B3aKS1PJ.js} +1 -31
- package/dist/assets/{WorkflowPreview-C2zFAYYi.js → WorkflowPreview-jblZXN9D.js} +1 -3
- package/dist/assets/{WorkflowsView-CLNYtnzv.js → WorkflowsView-DQqwovww.js} +19 -37
- package/dist/assets/cloud-ChkMgrsu.js +37 -0
- package/dist/assets/{dateFormatter-B-oph3V5.js → dateFormatter-BOFH7hQn.js} +1 -1
- package/dist/assets/index-B5Li9oNe.js +331713 -0
- package/dist/assets/{index-B5Pl_Rdy.css → index-BGyoJ6bM.css} +3941 -8
- package/dist/assets/{pushConnection.store-C38m0a4q.js → pushConnection.store-Cp0wdk-m.js} +3 -3
- package/dist/assets/{templateActions-BDzt5tYG.js → templateActions-DbRugCSY.js} +1 -1
- package/dist/assets/{useBeforeUnload-DAuWtScP.js → useBeforeUnload-HSb2Wsej.js} +1 -2
- package/dist/assets/{useExecutionDebugging-DjezN4ny.js → useExecutionDebugging-Czs7eCHy.js} +1 -2
- package/dist/assets/{usePushConnection-C-AngCFB.js → usePushConnection-CLr2QrgA.js} +12 -17
- package/dist/assets/{useWorkflowActivate-CgGEceEs.js → useWorkflowActivate-D9OoUkBo.js} +1 -2
- package/dist/index.html +2 -33
- package/package.json +1 -1
- package/vite.config.mts +0 -41
- package/dist/assets/@jsplumb/browser-ui-D3WTv2iL.js +0 -5431
- package/dist/assets/@jsplumb/common-Cn2WooAp.js +0 -142
- package/dist/assets/@jsplumb/connector-bezier-BsoOTqok.js +0 -1019
- package/dist/assets/@jsplumb/core-DLCSr9D4.js +0 -7317
- package/dist/assets/@jsplumb/util-DggqnqQo.js +0 -936
- package/dist/assets/@lezer/common-Bs5t-XhT.js +0 -1988
- package/dist/assets/@n8n/api-types-Clq_Leox.js +0 -1
- package/dist/assets/@n8n/codemirror-lang-Bizw8G99.js +0 -20928
- package/dist/assets/@n8n/codemirror-lang-sql-C9sfSTUi.js +0 -14443
- package/dist/assets/@n8n/permissions-BxSXRD9U.js +0 -52
- package/dist/assets/@sentry/vue-By9cUXYj.js +0 -23618
- package/dist/assets/@vue-flow/background-B1J8rodd.js +0 -123
- package/dist/assets/@vue-flow/controls-B4bXJQnK.js +0 -204
- package/dist/assets/@vue-flow/core-tETEFGtP.js +0 -9818
- package/dist/assets/@vue-flow/minimap-CGW7BbeH.js +0 -2951
- package/dist/assets/@vue-flow/node-resizer-C7hxX6Ea.js +0 -1398
- package/dist/assets/@vueuse/core-BTO0AmLR.js +0 -8894
- package/dist/assets/RunDataJsonActions-0J53luAF.js +0 -270
- package/dist/assets/SettingsFakeDoorView-CpouiCJM.js +0 -74
- package/dist/assets/SettingsLdapView-DtUi0T-K.js +0 -746
- package/dist/assets/SignoutView-DN2qdM5U.js +0 -57
- package/dist/assets/aws-secrets-manager-NwVFybsa.svg +0 -18
- package/dist/assets/axios-BW6T4tHC.js +0 -2403
- package/dist/assets/azure-key-vault-DTTl_IR7.svg +0 -23
- package/dist/assets/bowser-CDCHPFWD.js +0 -1931
- package/dist/assets/change-case-Dux1iW35.js +0 -137
- package/dist/assets/chart.js-BYpPl_l4.js +0 -14318
- package/dist/assets/cloud-DJUTi_f-.js +0 -95
- package/dist/assets/codemirror-lang-html-n8n-BElKE4vf.js +0 -2498
- package/dist/assets/dateformat-BevCJF2z.js +0 -208
- package/dist/assets/email-providers-Brdpqw-Z.js +0 -1
- package/dist/assets/esprima-next-DUEu30kB.js +0 -6712
- package/dist/assets/fast-json-stable-stringify-D9R5x91P.js +0 -55
- package/dist/assets/flatted-BLlNkUR-.js +0 -76
- package/dist/assets/gcp-secrets-manager-BcK0Zj6Y.svg +0 -9
- package/dist/assets/hashicorp-5zlHdJCj.webp +0 -0
- package/dist/assets/highlight.js-Brdpqw-Z.js +0 -1
- package/dist/assets/index-DOjaKjUd.js +0 -87778
- package/dist/assets/infisical-Db7VXgLp.webp +0 -0
- package/dist/assets/lodash-es-DCRmYdQ5.js +0 -6061
- package/dist/assets/luxon-N8mghSWH.js +0 -6159
- package/dist/assets/n8n-C6KBCWah.css +0 -4973
- package/dist/assets/n8n-o-6nV4eX.js +0 -163925
- package/dist/assets/pinia-BWzoPyXU.js +0 -1650
- package/dist/assets/prettier-eWLVZldr.js +0 -2294
- package/dist/assets/qrcode.vue-BavVPFUM.js +0 -1132
- package/dist/assets/timeago.js-CgQus8nl.js +0 -116
- package/dist/assets/useUserHelpers-nsswfS_i.js +0 -27
- package/dist/assets/uuid-DRDfXVM2.js +0 -542
- package/dist/assets/v3-infinite-loading-CHlSsXAy.js +0 -114
- package/dist/assets/vendor-D8YCjNHu.js +0 -14463
- package/dist/assets/vue-agile-B2NGbzqY.css +0 -93
- package/dist/assets/vue-agile-Busf3nxn.js +0 -727
- package/dist/assets/vue-chartjs-DBNEiLG-.js +0 -203
- package/dist/assets/vue-i18n-CeifA_Nk.js +0 -5329
- package/dist/assets/vue-json-pretty-DHS8nWi_.js +0 -340
- package/dist/assets/vue3-touch-events-DVOgU3fI.js +0 -301
- package/dist/assets/xss-Brdpqw-Z.js +0 -1
|
@@ -1,1650 +0,0 @@
|
|
|
1
|
-
import { aJ as hasInjectionContext, i as inject, ak as toRaw, b as watch, u as unref, A as markRaw, e as effectScope, r as ref, d as isRef, y as isReactive, g as getCurrentScope, o as onScopeDispose, t as toRefs, f as computed, n as nextTick, h as reactive, j as toRef, k as getCurrentInstance } from "./vendor-D8YCjNHu.js";
|
|
2
|
-
var isVue2 = false;
|
|
3
|
-
var isVue3 = true;
|
|
4
|
-
var Vue2 = void 0;
|
|
5
|
-
function install() {
|
|
6
|
-
}
|
|
7
|
-
function set(target, key, val) {
|
|
8
|
-
if (Array.isArray(target)) {
|
|
9
|
-
target.length = Math.max(target.length, key);
|
|
10
|
-
target.splice(key, 1, val);
|
|
11
|
-
return val;
|
|
12
|
-
}
|
|
13
|
-
target[key] = val;
|
|
14
|
-
return val;
|
|
15
|
-
}
|
|
16
|
-
function del(target, key) {
|
|
17
|
-
if (Array.isArray(target)) {
|
|
18
|
-
target.splice(key, 1);
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
delete target[key];
|
|
22
|
-
}
|
|
23
|
-
function getDevtoolsGlobalHook() {
|
|
24
|
-
return getTarget().__VUE_DEVTOOLS_GLOBAL_HOOK__;
|
|
25
|
-
}
|
|
26
|
-
function getTarget() {
|
|
27
|
-
return typeof navigator !== "undefined" && typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : {};
|
|
28
|
-
}
|
|
29
|
-
const isProxyAvailable = typeof Proxy === "function";
|
|
30
|
-
const HOOK_SETUP = "devtools-plugin:setup";
|
|
31
|
-
const HOOK_PLUGIN_SETTINGS_SET = "plugin:settings:set";
|
|
32
|
-
let supported;
|
|
33
|
-
let perf;
|
|
34
|
-
function isPerformanceSupported() {
|
|
35
|
-
var _a;
|
|
36
|
-
if (supported !== void 0) {
|
|
37
|
-
return supported;
|
|
38
|
-
}
|
|
39
|
-
if (typeof window !== "undefined" && window.performance) {
|
|
40
|
-
supported = true;
|
|
41
|
-
perf = window.performance;
|
|
42
|
-
} else if (typeof global !== "undefined" && ((_a = global.perf_hooks) === null || _a === void 0 ? void 0 : _a.performance)) {
|
|
43
|
-
supported = true;
|
|
44
|
-
perf = global.perf_hooks.performance;
|
|
45
|
-
} else {
|
|
46
|
-
supported = false;
|
|
47
|
-
}
|
|
48
|
-
return supported;
|
|
49
|
-
}
|
|
50
|
-
function now() {
|
|
51
|
-
return isPerformanceSupported() ? perf.now() : Date.now();
|
|
52
|
-
}
|
|
53
|
-
class ApiProxy {
|
|
54
|
-
constructor(plugin, hook) {
|
|
55
|
-
this.target = null;
|
|
56
|
-
this.targetQueue = [];
|
|
57
|
-
this.onQueue = [];
|
|
58
|
-
this.plugin = plugin;
|
|
59
|
-
this.hook = hook;
|
|
60
|
-
const defaultSettings = {};
|
|
61
|
-
if (plugin.settings) {
|
|
62
|
-
for (const id in plugin.settings) {
|
|
63
|
-
const item = plugin.settings[id];
|
|
64
|
-
defaultSettings[id] = item.defaultValue;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
const localSettingsSaveId = `__vue-devtools-plugin-settings__${plugin.id}`;
|
|
68
|
-
let currentSettings = Object.assign({}, defaultSettings);
|
|
69
|
-
try {
|
|
70
|
-
const raw = localStorage.getItem(localSettingsSaveId);
|
|
71
|
-
const data = JSON.parse(raw);
|
|
72
|
-
Object.assign(currentSettings, data);
|
|
73
|
-
} catch (e) {
|
|
74
|
-
}
|
|
75
|
-
this.fallbacks = {
|
|
76
|
-
getSettings() {
|
|
77
|
-
return currentSettings;
|
|
78
|
-
},
|
|
79
|
-
setSettings(value) {
|
|
80
|
-
try {
|
|
81
|
-
localStorage.setItem(localSettingsSaveId, JSON.stringify(value));
|
|
82
|
-
} catch (e) {
|
|
83
|
-
}
|
|
84
|
-
currentSettings = value;
|
|
85
|
-
},
|
|
86
|
-
now() {
|
|
87
|
-
return now();
|
|
88
|
-
}
|
|
89
|
-
};
|
|
90
|
-
if (hook) {
|
|
91
|
-
hook.on(HOOK_PLUGIN_SETTINGS_SET, (pluginId, value) => {
|
|
92
|
-
if (pluginId === this.plugin.id) {
|
|
93
|
-
this.fallbacks.setSettings(value);
|
|
94
|
-
}
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
this.proxiedOn = new Proxy({}, {
|
|
98
|
-
get: (_target, prop) => {
|
|
99
|
-
if (this.target) {
|
|
100
|
-
return this.target.on[prop];
|
|
101
|
-
} else {
|
|
102
|
-
return (...args) => {
|
|
103
|
-
this.onQueue.push({
|
|
104
|
-
method: prop,
|
|
105
|
-
args
|
|
106
|
-
});
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
this.proxiedTarget = new Proxy({}, {
|
|
112
|
-
get: (_target, prop) => {
|
|
113
|
-
if (this.target) {
|
|
114
|
-
return this.target[prop];
|
|
115
|
-
} else if (prop === "on") {
|
|
116
|
-
return this.proxiedOn;
|
|
117
|
-
} else if (Object.keys(this.fallbacks).includes(prop)) {
|
|
118
|
-
return (...args) => {
|
|
119
|
-
this.targetQueue.push({
|
|
120
|
-
method: prop,
|
|
121
|
-
args,
|
|
122
|
-
resolve: () => {
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
return this.fallbacks[prop](...args);
|
|
126
|
-
};
|
|
127
|
-
} else {
|
|
128
|
-
return (...args) => {
|
|
129
|
-
return new Promise((resolve) => {
|
|
130
|
-
this.targetQueue.push({
|
|
131
|
-
method: prop,
|
|
132
|
-
args,
|
|
133
|
-
resolve
|
|
134
|
-
});
|
|
135
|
-
});
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
async setRealTarget(target) {
|
|
142
|
-
this.target = target;
|
|
143
|
-
for (const item of this.onQueue) {
|
|
144
|
-
this.target.on[item.method](...item.args);
|
|
145
|
-
}
|
|
146
|
-
for (const item of this.targetQueue) {
|
|
147
|
-
item.resolve(await this.target[item.method](...item.args));
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
function setupDevtoolsPlugin(pluginDescriptor, setupFn) {
|
|
152
|
-
const descriptor = pluginDescriptor;
|
|
153
|
-
const target = getTarget();
|
|
154
|
-
const hook = getDevtoolsGlobalHook();
|
|
155
|
-
const enableProxy = isProxyAvailable && descriptor.enableEarlyProxy;
|
|
156
|
-
if (hook && (target.__VUE_DEVTOOLS_PLUGIN_API_AVAILABLE__ || !enableProxy)) {
|
|
157
|
-
hook.emit(HOOK_SETUP, pluginDescriptor, setupFn);
|
|
158
|
-
} else {
|
|
159
|
-
const proxy = enableProxy ? new ApiProxy(descriptor, hook) : null;
|
|
160
|
-
const list = target.__VUE_DEVTOOLS_PLUGINS__ = target.__VUE_DEVTOOLS_PLUGINS__ || [];
|
|
161
|
-
list.push({
|
|
162
|
-
pluginDescriptor: descriptor,
|
|
163
|
-
setupFn,
|
|
164
|
-
proxy
|
|
165
|
-
});
|
|
166
|
-
if (proxy)
|
|
167
|
-
setupFn(proxy.proxiedTarget);
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
/*!
|
|
171
|
-
* pinia v2.1.6
|
|
172
|
-
* (c) 2023 Eduardo San Martin Morote
|
|
173
|
-
* @license MIT
|
|
174
|
-
*/
|
|
175
|
-
let activePinia;
|
|
176
|
-
const setActivePinia = (pinia) => activePinia = pinia;
|
|
177
|
-
const getActivePinia = () => hasInjectionContext() && inject(piniaSymbol) || activePinia;
|
|
178
|
-
const piniaSymbol = false ? Symbol("pinia") : (
|
|
179
|
-
/* istanbul ignore next */
|
|
180
|
-
Symbol()
|
|
181
|
-
);
|
|
182
|
-
function isPlainObject(o) {
|
|
183
|
-
return o && typeof o === "object" && Object.prototype.toString.call(o) === "[object Object]" && typeof o.toJSON !== "function";
|
|
184
|
-
}
|
|
185
|
-
var MutationType;
|
|
186
|
-
(function(MutationType2) {
|
|
187
|
-
MutationType2["direct"] = "direct";
|
|
188
|
-
MutationType2["patchObject"] = "patch object";
|
|
189
|
-
MutationType2["patchFunction"] = "patch function";
|
|
190
|
-
})(MutationType || (MutationType = {}));
|
|
191
|
-
const IS_CLIENT = typeof window !== "undefined";
|
|
192
|
-
const USE_DEVTOOLS = false;
|
|
193
|
-
const _global = /* @__PURE__ */ (() => typeof window === "object" && window.window === window ? window : typeof self === "object" && self.self === self ? self : typeof global === "object" && global.global === global ? global : typeof globalThis === "object" ? globalThis : { HTMLElement: null })();
|
|
194
|
-
function bom(blob, { autoBom = false } = {}) {
|
|
195
|
-
if (autoBom && /^\s*(?:text\/\S*|application\/xml|\S*\/\S*\+xml)\s*;.*charset\s*=\s*utf-8/i.test(blob.type)) {
|
|
196
|
-
return new Blob([String.fromCharCode(65279), blob], { type: blob.type });
|
|
197
|
-
}
|
|
198
|
-
return blob;
|
|
199
|
-
}
|
|
200
|
-
function download(url, name, opts) {
|
|
201
|
-
const xhr = new XMLHttpRequest();
|
|
202
|
-
xhr.open("GET", url);
|
|
203
|
-
xhr.responseType = "blob";
|
|
204
|
-
xhr.onload = function() {
|
|
205
|
-
saveAs(xhr.response, name, opts);
|
|
206
|
-
};
|
|
207
|
-
xhr.onerror = function() {
|
|
208
|
-
console.error("could not download file");
|
|
209
|
-
};
|
|
210
|
-
xhr.send();
|
|
211
|
-
}
|
|
212
|
-
function corsEnabled(url) {
|
|
213
|
-
const xhr = new XMLHttpRequest();
|
|
214
|
-
xhr.open("HEAD", url, false);
|
|
215
|
-
try {
|
|
216
|
-
xhr.send();
|
|
217
|
-
} catch (e) {
|
|
218
|
-
}
|
|
219
|
-
return xhr.status >= 200 && xhr.status <= 299;
|
|
220
|
-
}
|
|
221
|
-
function click(node) {
|
|
222
|
-
try {
|
|
223
|
-
node.dispatchEvent(new MouseEvent("click"));
|
|
224
|
-
} catch (e) {
|
|
225
|
-
const evt = document.createEvent("MouseEvents");
|
|
226
|
-
evt.initMouseEvent("click", true, true, window, 0, 0, 0, 80, 20, false, false, false, false, 0, null);
|
|
227
|
-
node.dispatchEvent(evt);
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
const _navigator = typeof navigator === "object" ? navigator : { userAgent: "" };
|
|
231
|
-
const isMacOSWebView = /* @__PURE__ */ (() => /Macintosh/.test(_navigator.userAgent) && /AppleWebKit/.test(_navigator.userAgent) && !/Safari/.test(_navigator.userAgent))();
|
|
232
|
-
const saveAs = !IS_CLIENT ? () => {
|
|
233
|
-
} : (
|
|
234
|
-
// Use download attribute first if possible (#193 Lumia mobile) unless this is a macOS WebView or mini program
|
|
235
|
-
typeof HTMLAnchorElement !== "undefined" && "download" in HTMLAnchorElement.prototype && !isMacOSWebView ? downloadSaveAs : (
|
|
236
|
-
// Use msSaveOrOpenBlob as a second approach
|
|
237
|
-
"msSaveOrOpenBlob" in _navigator ? msSaveAs : (
|
|
238
|
-
// Fallback to using FileReader and a popup
|
|
239
|
-
fileSaverSaveAs
|
|
240
|
-
)
|
|
241
|
-
)
|
|
242
|
-
);
|
|
243
|
-
function downloadSaveAs(blob, name = "download", opts) {
|
|
244
|
-
const a = document.createElement("a");
|
|
245
|
-
a.download = name;
|
|
246
|
-
a.rel = "noopener";
|
|
247
|
-
if (typeof blob === "string") {
|
|
248
|
-
a.href = blob;
|
|
249
|
-
if (a.origin !== location.origin) {
|
|
250
|
-
if (corsEnabled(a.href)) {
|
|
251
|
-
download(blob, name, opts);
|
|
252
|
-
} else {
|
|
253
|
-
a.target = "_blank";
|
|
254
|
-
click(a);
|
|
255
|
-
}
|
|
256
|
-
} else {
|
|
257
|
-
click(a);
|
|
258
|
-
}
|
|
259
|
-
} else {
|
|
260
|
-
a.href = URL.createObjectURL(blob);
|
|
261
|
-
setTimeout(function() {
|
|
262
|
-
URL.revokeObjectURL(a.href);
|
|
263
|
-
}, 4e4);
|
|
264
|
-
setTimeout(function() {
|
|
265
|
-
click(a);
|
|
266
|
-
}, 0);
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
function msSaveAs(blob, name = "download", opts) {
|
|
270
|
-
if (typeof blob === "string") {
|
|
271
|
-
if (corsEnabled(blob)) {
|
|
272
|
-
download(blob, name, opts);
|
|
273
|
-
} else {
|
|
274
|
-
const a = document.createElement("a");
|
|
275
|
-
a.href = blob;
|
|
276
|
-
a.target = "_blank";
|
|
277
|
-
setTimeout(function() {
|
|
278
|
-
click(a);
|
|
279
|
-
});
|
|
280
|
-
}
|
|
281
|
-
} else {
|
|
282
|
-
navigator.msSaveOrOpenBlob(bom(blob, opts), name);
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
function fileSaverSaveAs(blob, name, opts, popup) {
|
|
286
|
-
popup = popup || open("", "_blank");
|
|
287
|
-
if (popup) {
|
|
288
|
-
popup.document.title = popup.document.body.innerText = "downloading...";
|
|
289
|
-
}
|
|
290
|
-
if (typeof blob === "string")
|
|
291
|
-
return download(blob, name, opts);
|
|
292
|
-
const force = blob.type === "application/octet-stream";
|
|
293
|
-
const isSafari = /constructor/i.test(String(_global.HTMLElement)) || "safari" in _global;
|
|
294
|
-
const isChromeIOS = /CriOS\/[\d]+/.test(navigator.userAgent);
|
|
295
|
-
if ((isChromeIOS || force && isSafari || isMacOSWebView) && typeof FileReader !== "undefined") {
|
|
296
|
-
const reader = new FileReader();
|
|
297
|
-
reader.onloadend = function() {
|
|
298
|
-
let url = reader.result;
|
|
299
|
-
if (typeof url !== "string") {
|
|
300
|
-
popup = null;
|
|
301
|
-
throw new Error("Wrong reader.result type");
|
|
302
|
-
}
|
|
303
|
-
url = isChromeIOS ? url : url.replace(/^data:[^;]*;/, "data:attachment/file;");
|
|
304
|
-
if (popup) {
|
|
305
|
-
popup.location.href = url;
|
|
306
|
-
} else {
|
|
307
|
-
location.assign(url);
|
|
308
|
-
}
|
|
309
|
-
popup = null;
|
|
310
|
-
};
|
|
311
|
-
reader.readAsDataURL(blob);
|
|
312
|
-
} else {
|
|
313
|
-
const url = URL.createObjectURL(blob);
|
|
314
|
-
if (popup)
|
|
315
|
-
popup.location.assign(url);
|
|
316
|
-
else
|
|
317
|
-
location.href = url;
|
|
318
|
-
popup = null;
|
|
319
|
-
setTimeout(function() {
|
|
320
|
-
URL.revokeObjectURL(url);
|
|
321
|
-
}, 4e4);
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
function toastMessage(message, type) {
|
|
325
|
-
const piniaMessage = "🍍 " + message;
|
|
326
|
-
if (typeof __VUE_DEVTOOLS_TOAST__ === "function") {
|
|
327
|
-
__VUE_DEVTOOLS_TOAST__(piniaMessage, type);
|
|
328
|
-
} else if (type === "error") {
|
|
329
|
-
console.error(piniaMessage);
|
|
330
|
-
} else if (type === "warn") {
|
|
331
|
-
console.warn(piniaMessage);
|
|
332
|
-
} else {
|
|
333
|
-
console.log(piniaMessage);
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
function isPinia(o) {
|
|
337
|
-
return "_a" in o && "install" in o;
|
|
338
|
-
}
|
|
339
|
-
function checkClipboardAccess() {
|
|
340
|
-
if (!("clipboard" in navigator)) {
|
|
341
|
-
toastMessage(`Your browser doesn't support the Clipboard API`, "error");
|
|
342
|
-
return true;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
function checkNotFocusedError(error) {
|
|
346
|
-
if (error instanceof Error && error.message.toLowerCase().includes("document is not focused")) {
|
|
347
|
-
toastMessage('You need to activate the "Emulate a focused page" setting in the "Rendering" panel of devtools.', "warn");
|
|
348
|
-
return true;
|
|
349
|
-
}
|
|
350
|
-
return false;
|
|
351
|
-
}
|
|
352
|
-
async function actionGlobalCopyState(pinia) {
|
|
353
|
-
if (checkClipboardAccess())
|
|
354
|
-
return;
|
|
355
|
-
try {
|
|
356
|
-
await navigator.clipboard.writeText(JSON.stringify(pinia.state.value));
|
|
357
|
-
toastMessage("Global state copied to clipboard.");
|
|
358
|
-
} catch (error) {
|
|
359
|
-
if (checkNotFocusedError(error))
|
|
360
|
-
return;
|
|
361
|
-
toastMessage(`Failed to serialize the state. Check the console for more details.`, "error");
|
|
362
|
-
console.error(error);
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
async function actionGlobalPasteState(pinia) {
|
|
366
|
-
if (checkClipboardAccess())
|
|
367
|
-
return;
|
|
368
|
-
try {
|
|
369
|
-
loadStoresState(pinia, JSON.parse(await navigator.clipboard.readText()));
|
|
370
|
-
toastMessage("Global state pasted from clipboard.");
|
|
371
|
-
} catch (error) {
|
|
372
|
-
if (checkNotFocusedError(error))
|
|
373
|
-
return;
|
|
374
|
-
toastMessage(`Failed to deserialize the state from clipboard. Check the console for more details.`, "error");
|
|
375
|
-
console.error(error);
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
async function actionGlobalSaveState(pinia) {
|
|
379
|
-
try {
|
|
380
|
-
saveAs(new Blob([JSON.stringify(pinia.state.value)], {
|
|
381
|
-
type: "text/plain;charset=utf-8"
|
|
382
|
-
}), "pinia-state.json");
|
|
383
|
-
} catch (error) {
|
|
384
|
-
toastMessage(`Failed to export the state as JSON. Check the console for more details.`, "error");
|
|
385
|
-
console.error(error);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
let fileInput;
|
|
389
|
-
function getFileOpener() {
|
|
390
|
-
if (!fileInput) {
|
|
391
|
-
fileInput = document.createElement("input");
|
|
392
|
-
fileInput.type = "file";
|
|
393
|
-
fileInput.accept = ".json";
|
|
394
|
-
}
|
|
395
|
-
function openFile() {
|
|
396
|
-
return new Promise((resolve, reject) => {
|
|
397
|
-
fileInput.onchange = async () => {
|
|
398
|
-
const files = fileInput.files;
|
|
399
|
-
if (!files)
|
|
400
|
-
return resolve(null);
|
|
401
|
-
const file = files.item(0);
|
|
402
|
-
if (!file)
|
|
403
|
-
return resolve(null);
|
|
404
|
-
return resolve({ text: await file.text(), file });
|
|
405
|
-
};
|
|
406
|
-
fileInput.oncancel = () => resolve(null);
|
|
407
|
-
fileInput.onerror = reject;
|
|
408
|
-
fileInput.click();
|
|
409
|
-
});
|
|
410
|
-
}
|
|
411
|
-
return openFile;
|
|
412
|
-
}
|
|
413
|
-
async function actionGlobalOpenStateFile(pinia) {
|
|
414
|
-
try {
|
|
415
|
-
const open2 = getFileOpener();
|
|
416
|
-
const result = await open2();
|
|
417
|
-
if (!result)
|
|
418
|
-
return;
|
|
419
|
-
const { text, file } = result;
|
|
420
|
-
loadStoresState(pinia, JSON.parse(text));
|
|
421
|
-
toastMessage(`Global state imported from "${file.name}".`);
|
|
422
|
-
} catch (error) {
|
|
423
|
-
toastMessage(`Failed to import the state from JSON. Check the console for more details.`, "error");
|
|
424
|
-
console.error(error);
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
function loadStoresState(pinia, state) {
|
|
428
|
-
for (const key in state) {
|
|
429
|
-
const storeState = pinia.state.value[key];
|
|
430
|
-
if (storeState) {
|
|
431
|
-
Object.assign(storeState, state[key]);
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
function formatDisplay(display) {
|
|
436
|
-
return {
|
|
437
|
-
_custom: {
|
|
438
|
-
display
|
|
439
|
-
}
|
|
440
|
-
};
|
|
441
|
-
}
|
|
442
|
-
const PINIA_ROOT_LABEL = "🍍 Pinia (root)";
|
|
443
|
-
const PINIA_ROOT_ID = "_root";
|
|
444
|
-
function formatStoreForInspectorTree(store) {
|
|
445
|
-
return isPinia(store) ? {
|
|
446
|
-
id: PINIA_ROOT_ID,
|
|
447
|
-
label: PINIA_ROOT_LABEL
|
|
448
|
-
} : {
|
|
449
|
-
id: store.$id,
|
|
450
|
-
label: store.$id
|
|
451
|
-
};
|
|
452
|
-
}
|
|
453
|
-
function formatStoreForInspectorState(store) {
|
|
454
|
-
if (isPinia(store)) {
|
|
455
|
-
const storeNames = Array.from(store._s.keys());
|
|
456
|
-
const storeMap = store._s;
|
|
457
|
-
const state2 = {
|
|
458
|
-
state: storeNames.map((storeId) => ({
|
|
459
|
-
editable: true,
|
|
460
|
-
key: storeId,
|
|
461
|
-
value: store.state.value[storeId]
|
|
462
|
-
})),
|
|
463
|
-
getters: storeNames.filter((id) => storeMap.get(id)._getters).map((id) => {
|
|
464
|
-
const store2 = storeMap.get(id);
|
|
465
|
-
return {
|
|
466
|
-
editable: false,
|
|
467
|
-
key: id,
|
|
468
|
-
value: store2._getters.reduce((getters, key) => {
|
|
469
|
-
getters[key] = store2[key];
|
|
470
|
-
return getters;
|
|
471
|
-
}, {})
|
|
472
|
-
};
|
|
473
|
-
})
|
|
474
|
-
};
|
|
475
|
-
return state2;
|
|
476
|
-
}
|
|
477
|
-
const state = {
|
|
478
|
-
state: Object.keys(store.$state).map((key) => ({
|
|
479
|
-
editable: true,
|
|
480
|
-
key,
|
|
481
|
-
value: store.$state[key]
|
|
482
|
-
}))
|
|
483
|
-
};
|
|
484
|
-
if (store._getters && store._getters.length) {
|
|
485
|
-
state.getters = store._getters.map((getterName) => ({
|
|
486
|
-
editable: false,
|
|
487
|
-
key: getterName,
|
|
488
|
-
value: store[getterName]
|
|
489
|
-
}));
|
|
490
|
-
}
|
|
491
|
-
if (store._customProperties.size) {
|
|
492
|
-
state.customProperties = Array.from(store._customProperties).map((key) => ({
|
|
493
|
-
editable: true,
|
|
494
|
-
key,
|
|
495
|
-
value: store[key]
|
|
496
|
-
}));
|
|
497
|
-
}
|
|
498
|
-
return state;
|
|
499
|
-
}
|
|
500
|
-
function formatEventData(events) {
|
|
501
|
-
if (!events)
|
|
502
|
-
return {};
|
|
503
|
-
if (Array.isArray(events)) {
|
|
504
|
-
return events.reduce((data, event) => {
|
|
505
|
-
data.keys.push(event.key);
|
|
506
|
-
data.operations.push(event.type);
|
|
507
|
-
data.oldValue[event.key] = event.oldValue;
|
|
508
|
-
data.newValue[event.key] = event.newValue;
|
|
509
|
-
return data;
|
|
510
|
-
}, {
|
|
511
|
-
oldValue: {},
|
|
512
|
-
keys: [],
|
|
513
|
-
operations: [],
|
|
514
|
-
newValue: {}
|
|
515
|
-
});
|
|
516
|
-
} else {
|
|
517
|
-
return {
|
|
518
|
-
operation: formatDisplay(events.type),
|
|
519
|
-
key: formatDisplay(events.key),
|
|
520
|
-
oldValue: events.oldValue,
|
|
521
|
-
newValue: events.newValue
|
|
522
|
-
};
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
function formatMutationType(type) {
|
|
526
|
-
switch (type) {
|
|
527
|
-
case MutationType.direct:
|
|
528
|
-
return "mutation";
|
|
529
|
-
case MutationType.patchFunction:
|
|
530
|
-
return "$patch";
|
|
531
|
-
case MutationType.patchObject:
|
|
532
|
-
return "$patch";
|
|
533
|
-
default:
|
|
534
|
-
return "unknown";
|
|
535
|
-
}
|
|
536
|
-
}
|
|
537
|
-
let isTimelineActive = true;
|
|
538
|
-
const componentStateTypes = [];
|
|
539
|
-
const MUTATIONS_LAYER_ID = "pinia:mutations";
|
|
540
|
-
const INSPECTOR_ID = "pinia";
|
|
541
|
-
const { assign: assign$1 } = Object;
|
|
542
|
-
const getStoreType = (id) => "🍍 " + id;
|
|
543
|
-
function registerPiniaDevtools(app, pinia) {
|
|
544
|
-
setupDevtoolsPlugin({
|
|
545
|
-
id: "dev.esm.pinia",
|
|
546
|
-
label: "Pinia 🍍",
|
|
547
|
-
logo: "https://pinia.vuejs.org/logo.svg",
|
|
548
|
-
packageName: "pinia",
|
|
549
|
-
homepage: "https://pinia.vuejs.org",
|
|
550
|
-
componentStateTypes,
|
|
551
|
-
app
|
|
552
|
-
}, (api) => {
|
|
553
|
-
if (typeof api.now !== "function") {
|
|
554
|
-
toastMessage("You seem to be using an outdated version of Vue Devtools. Are you still using the Beta release instead of the stable one? You can find the links at https://devtools.vuejs.org/guide/installation.html.");
|
|
555
|
-
}
|
|
556
|
-
api.addTimelineLayer({
|
|
557
|
-
id: MUTATIONS_LAYER_ID,
|
|
558
|
-
label: `Pinia 🍍`,
|
|
559
|
-
color: 15064968
|
|
560
|
-
});
|
|
561
|
-
api.addInspector({
|
|
562
|
-
id: INSPECTOR_ID,
|
|
563
|
-
label: "Pinia 🍍",
|
|
564
|
-
icon: "storage",
|
|
565
|
-
treeFilterPlaceholder: "Search stores",
|
|
566
|
-
actions: [
|
|
567
|
-
{
|
|
568
|
-
icon: "content_copy",
|
|
569
|
-
action: () => {
|
|
570
|
-
actionGlobalCopyState(pinia);
|
|
571
|
-
},
|
|
572
|
-
tooltip: "Serialize and copy the state"
|
|
573
|
-
},
|
|
574
|
-
{
|
|
575
|
-
icon: "content_paste",
|
|
576
|
-
action: async () => {
|
|
577
|
-
await actionGlobalPasteState(pinia);
|
|
578
|
-
api.sendInspectorTree(INSPECTOR_ID);
|
|
579
|
-
api.sendInspectorState(INSPECTOR_ID);
|
|
580
|
-
},
|
|
581
|
-
tooltip: "Replace the state with the content of your clipboard"
|
|
582
|
-
},
|
|
583
|
-
{
|
|
584
|
-
icon: "save",
|
|
585
|
-
action: () => {
|
|
586
|
-
actionGlobalSaveState(pinia);
|
|
587
|
-
},
|
|
588
|
-
tooltip: "Save the state as a JSON file"
|
|
589
|
-
},
|
|
590
|
-
{
|
|
591
|
-
icon: "folder_open",
|
|
592
|
-
action: async () => {
|
|
593
|
-
await actionGlobalOpenStateFile(pinia);
|
|
594
|
-
api.sendInspectorTree(INSPECTOR_ID);
|
|
595
|
-
api.sendInspectorState(INSPECTOR_ID);
|
|
596
|
-
},
|
|
597
|
-
tooltip: "Import the state from a JSON file"
|
|
598
|
-
}
|
|
599
|
-
],
|
|
600
|
-
nodeActions: [
|
|
601
|
-
{
|
|
602
|
-
icon: "restore",
|
|
603
|
-
tooltip: 'Reset the state (with "$reset")',
|
|
604
|
-
action: (nodeId) => {
|
|
605
|
-
const store = pinia._s.get(nodeId);
|
|
606
|
-
if (!store) {
|
|
607
|
-
toastMessage(`Cannot reset "${nodeId}" store because it wasn't found.`, "warn");
|
|
608
|
-
} else if (typeof store.$reset !== "function") {
|
|
609
|
-
toastMessage(`Cannot reset "${nodeId}" store because it doesn't have a "$reset" method implemented.`, "warn");
|
|
610
|
-
} else {
|
|
611
|
-
store.$reset();
|
|
612
|
-
toastMessage(`Store "${nodeId}" reset.`);
|
|
613
|
-
}
|
|
614
|
-
}
|
|
615
|
-
}
|
|
616
|
-
]
|
|
617
|
-
});
|
|
618
|
-
api.on.inspectComponent((payload, ctx) => {
|
|
619
|
-
const proxy = payload.componentInstance && payload.componentInstance.proxy;
|
|
620
|
-
if (proxy && proxy._pStores) {
|
|
621
|
-
const piniaStores = payload.componentInstance.proxy._pStores;
|
|
622
|
-
Object.values(piniaStores).forEach((store) => {
|
|
623
|
-
payload.instanceData.state.push({
|
|
624
|
-
type: getStoreType(store.$id),
|
|
625
|
-
key: "state",
|
|
626
|
-
editable: true,
|
|
627
|
-
value: store._isOptionsAPI ? {
|
|
628
|
-
_custom: {
|
|
629
|
-
value: toRaw(store.$state),
|
|
630
|
-
actions: [
|
|
631
|
-
{
|
|
632
|
-
icon: "restore",
|
|
633
|
-
tooltip: "Reset the state of this store",
|
|
634
|
-
action: () => store.$reset()
|
|
635
|
-
}
|
|
636
|
-
]
|
|
637
|
-
}
|
|
638
|
-
} : (
|
|
639
|
-
// NOTE: workaround to unwrap transferred refs
|
|
640
|
-
Object.keys(store.$state).reduce((state, key) => {
|
|
641
|
-
state[key] = store.$state[key];
|
|
642
|
-
return state;
|
|
643
|
-
}, {})
|
|
644
|
-
)
|
|
645
|
-
});
|
|
646
|
-
if (store._getters && store._getters.length) {
|
|
647
|
-
payload.instanceData.state.push({
|
|
648
|
-
type: getStoreType(store.$id),
|
|
649
|
-
key: "getters",
|
|
650
|
-
editable: false,
|
|
651
|
-
value: store._getters.reduce((getters, key) => {
|
|
652
|
-
try {
|
|
653
|
-
getters[key] = store[key];
|
|
654
|
-
} catch (error) {
|
|
655
|
-
getters[key] = error;
|
|
656
|
-
}
|
|
657
|
-
return getters;
|
|
658
|
-
}, {})
|
|
659
|
-
});
|
|
660
|
-
}
|
|
661
|
-
});
|
|
662
|
-
}
|
|
663
|
-
});
|
|
664
|
-
api.on.getInspectorTree((payload) => {
|
|
665
|
-
if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
|
|
666
|
-
let stores = [pinia];
|
|
667
|
-
stores = stores.concat(Array.from(pinia._s.values()));
|
|
668
|
-
payload.rootNodes = (payload.filter ? stores.filter((store) => "$id" in store ? store.$id.toLowerCase().includes(payload.filter.toLowerCase()) : PINIA_ROOT_LABEL.toLowerCase().includes(payload.filter.toLowerCase())) : stores).map(formatStoreForInspectorTree);
|
|
669
|
-
}
|
|
670
|
-
});
|
|
671
|
-
api.on.getInspectorState((payload) => {
|
|
672
|
-
if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
|
|
673
|
-
const inspectedStore = payload.nodeId === PINIA_ROOT_ID ? pinia : pinia._s.get(payload.nodeId);
|
|
674
|
-
if (!inspectedStore) {
|
|
675
|
-
return;
|
|
676
|
-
}
|
|
677
|
-
if (inspectedStore) {
|
|
678
|
-
payload.state = formatStoreForInspectorState(inspectedStore);
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
});
|
|
682
|
-
api.on.editInspectorState((payload, ctx) => {
|
|
683
|
-
if (payload.app === app && payload.inspectorId === INSPECTOR_ID) {
|
|
684
|
-
const inspectedStore = payload.nodeId === PINIA_ROOT_ID ? pinia : pinia._s.get(payload.nodeId);
|
|
685
|
-
if (!inspectedStore) {
|
|
686
|
-
return toastMessage(`store "${payload.nodeId}" not found`, "error");
|
|
687
|
-
}
|
|
688
|
-
const { path } = payload;
|
|
689
|
-
if (!isPinia(inspectedStore)) {
|
|
690
|
-
if (path.length !== 1 || !inspectedStore._customProperties.has(path[0]) || path[0] in inspectedStore.$state) {
|
|
691
|
-
path.unshift("$state");
|
|
692
|
-
}
|
|
693
|
-
} else {
|
|
694
|
-
path.unshift("state");
|
|
695
|
-
}
|
|
696
|
-
isTimelineActive = false;
|
|
697
|
-
payload.set(inspectedStore, path, payload.state.value);
|
|
698
|
-
isTimelineActive = true;
|
|
699
|
-
}
|
|
700
|
-
});
|
|
701
|
-
api.on.editComponentState((payload) => {
|
|
702
|
-
if (payload.type.startsWith("🍍")) {
|
|
703
|
-
const storeId = payload.type.replace(/^🍍\s*/, "");
|
|
704
|
-
const store = pinia._s.get(storeId);
|
|
705
|
-
if (!store) {
|
|
706
|
-
return toastMessage(`store "${storeId}" not found`, "error");
|
|
707
|
-
}
|
|
708
|
-
const { path } = payload;
|
|
709
|
-
if (path[0] !== "state") {
|
|
710
|
-
return toastMessage(`Invalid path for store "${storeId}":
|
|
711
|
-
${path}
|
|
712
|
-
Only state can be modified.`);
|
|
713
|
-
}
|
|
714
|
-
path[0] = "$state";
|
|
715
|
-
isTimelineActive = false;
|
|
716
|
-
payload.set(store, path, payload.state.value);
|
|
717
|
-
isTimelineActive = true;
|
|
718
|
-
}
|
|
719
|
-
});
|
|
720
|
-
});
|
|
721
|
-
}
|
|
722
|
-
function addStoreToDevtools(app, store) {
|
|
723
|
-
if (!componentStateTypes.includes(getStoreType(store.$id))) {
|
|
724
|
-
componentStateTypes.push(getStoreType(store.$id));
|
|
725
|
-
}
|
|
726
|
-
setupDevtoolsPlugin({
|
|
727
|
-
id: "dev.esm.pinia",
|
|
728
|
-
label: "Pinia 🍍",
|
|
729
|
-
logo: "https://pinia.vuejs.org/logo.svg",
|
|
730
|
-
packageName: "pinia",
|
|
731
|
-
homepage: "https://pinia.vuejs.org",
|
|
732
|
-
componentStateTypes,
|
|
733
|
-
app,
|
|
734
|
-
settings: {
|
|
735
|
-
logStoreChanges: {
|
|
736
|
-
label: "Notify about new/deleted stores",
|
|
737
|
-
type: "boolean",
|
|
738
|
-
defaultValue: true
|
|
739
|
-
}
|
|
740
|
-
// useEmojis: {
|
|
741
|
-
// label: 'Use emojis in messages ⚡️',
|
|
742
|
-
// type: 'boolean',
|
|
743
|
-
// defaultValue: true,
|
|
744
|
-
// },
|
|
745
|
-
}
|
|
746
|
-
}, (api) => {
|
|
747
|
-
const now2 = typeof api.now === "function" ? api.now.bind(api) : Date.now;
|
|
748
|
-
store.$onAction(({ after, onError, name, args }) => {
|
|
749
|
-
const groupId = runningActionId++;
|
|
750
|
-
api.addTimelineEvent({
|
|
751
|
-
layerId: MUTATIONS_LAYER_ID,
|
|
752
|
-
event: {
|
|
753
|
-
time: now2(),
|
|
754
|
-
title: "🛫 " + name,
|
|
755
|
-
subtitle: "start",
|
|
756
|
-
data: {
|
|
757
|
-
store: formatDisplay(store.$id),
|
|
758
|
-
action: formatDisplay(name),
|
|
759
|
-
args
|
|
760
|
-
},
|
|
761
|
-
groupId
|
|
762
|
-
}
|
|
763
|
-
});
|
|
764
|
-
after((result) => {
|
|
765
|
-
activeAction = void 0;
|
|
766
|
-
api.addTimelineEvent({
|
|
767
|
-
layerId: MUTATIONS_LAYER_ID,
|
|
768
|
-
event: {
|
|
769
|
-
time: now2(),
|
|
770
|
-
title: "🛬 " + name,
|
|
771
|
-
subtitle: "end",
|
|
772
|
-
data: {
|
|
773
|
-
store: formatDisplay(store.$id),
|
|
774
|
-
action: formatDisplay(name),
|
|
775
|
-
args,
|
|
776
|
-
result
|
|
777
|
-
},
|
|
778
|
-
groupId
|
|
779
|
-
}
|
|
780
|
-
});
|
|
781
|
-
});
|
|
782
|
-
onError((error) => {
|
|
783
|
-
activeAction = void 0;
|
|
784
|
-
api.addTimelineEvent({
|
|
785
|
-
layerId: MUTATIONS_LAYER_ID,
|
|
786
|
-
event: {
|
|
787
|
-
time: now2(),
|
|
788
|
-
logType: "error",
|
|
789
|
-
title: "💥 " + name,
|
|
790
|
-
subtitle: "end",
|
|
791
|
-
data: {
|
|
792
|
-
store: formatDisplay(store.$id),
|
|
793
|
-
action: formatDisplay(name),
|
|
794
|
-
args,
|
|
795
|
-
error
|
|
796
|
-
},
|
|
797
|
-
groupId
|
|
798
|
-
}
|
|
799
|
-
});
|
|
800
|
-
});
|
|
801
|
-
}, true);
|
|
802
|
-
store._customProperties.forEach((name) => {
|
|
803
|
-
watch(() => unref(store[name]), (newValue, oldValue) => {
|
|
804
|
-
api.notifyComponentUpdate();
|
|
805
|
-
api.sendInspectorState(INSPECTOR_ID);
|
|
806
|
-
if (isTimelineActive) {
|
|
807
|
-
api.addTimelineEvent({
|
|
808
|
-
layerId: MUTATIONS_LAYER_ID,
|
|
809
|
-
event: {
|
|
810
|
-
time: now2(),
|
|
811
|
-
title: "Change",
|
|
812
|
-
subtitle: name,
|
|
813
|
-
data: {
|
|
814
|
-
newValue,
|
|
815
|
-
oldValue
|
|
816
|
-
},
|
|
817
|
-
groupId: activeAction
|
|
818
|
-
}
|
|
819
|
-
});
|
|
820
|
-
}
|
|
821
|
-
}, { deep: true });
|
|
822
|
-
});
|
|
823
|
-
store.$subscribe(({ events, type }, state) => {
|
|
824
|
-
api.notifyComponentUpdate();
|
|
825
|
-
api.sendInspectorState(INSPECTOR_ID);
|
|
826
|
-
if (!isTimelineActive)
|
|
827
|
-
return;
|
|
828
|
-
const eventData = {
|
|
829
|
-
time: now2(),
|
|
830
|
-
title: formatMutationType(type),
|
|
831
|
-
data: assign$1({ store: formatDisplay(store.$id) }, formatEventData(events)),
|
|
832
|
-
groupId: activeAction
|
|
833
|
-
};
|
|
834
|
-
if (type === MutationType.patchFunction) {
|
|
835
|
-
eventData.subtitle = "⤵️";
|
|
836
|
-
} else if (type === MutationType.patchObject) {
|
|
837
|
-
eventData.subtitle = "🧩";
|
|
838
|
-
} else if (events && !Array.isArray(events)) {
|
|
839
|
-
eventData.subtitle = events.type;
|
|
840
|
-
}
|
|
841
|
-
if (events) {
|
|
842
|
-
eventData.data["rawEvent(s)"] = {
|
|
843
|
-
_custom: {
|
|
844
|
-
display: "DebuggerEvent",
|
|
845
|
-
type: "object",
|
|
846
|
-
tooltip: "raw DebuggerEvent[]",
|
|
847
|
-
value: events
|
|
848
|
-
}
|
|
849
|
-
};
|
|
850
|
-
}
|
|
851
|
-
api.addTimelineEvent({
|
|
852
|
-
layerId: MUTATIONS_LAYER_ID,
|
|
853
|
-
event: eventData
|
|
854
|
-
});
|
|
855
|
-
}, { detached: true, flush: "sync" });
|
|
856
|
-
const hotUpdate = store._hotUpdate;
|
|
857
|
-
store._hotUpdate = markRaw((newStore) => {
|
|
858
|
-
hotUpdate(newStore);
|
|
859
|
-
api.addTimelineEvent({
|
|
860
|
-
layerId: MUTATIONS_LAYER_ID,
|
|
861
|
-
event: {
|
|
862
|
-
time: now2(),
|
|
863
|
-
title: "🔥 " + store.$id,
|
|
864
|
-
subtitle: "HMR update",
|
|
865
|
-
data: {
|
|
866
|
-
store: formatDisplay(store.$id),
|
|
867
|
-
info: formatDisplay(`HMR update`)
|
|
868
|
-
}
|
|
869
|
-
}
|
|
870
|
-
});
|
|
871
|
-
api.notifyComponentUpdate();
|
|
872
|
-
api.sendInspectorTree(INSPECTOR_ID);
|
|
873
|
-
api.sendInspectorState(INSPECTOR_ID);
|
|
874
|
-
});
|
|
875
|
-
const { $dispose } = store;
|
|
876
|
-
store.$dispose = () => {
|
|
877
|
-
$dispose();
|
|
878
|
-
api.notifyComponentUpdate();
|
|
879
|
-
api.sendInspectorTree(INSPECTOR_ID);
|
|
880
|
-
api.sendInspectorState(INSPECTOR_ID);
|
|
881
|
-
api.getSettings().logStoreChanges && toastMessage(`Disposed "${store.$id}" store 🗑`);
|
|
882
|
-
};
|
|
883
|
-
api.notifyComponentUpdate();
|
|
884
|
-
api.sendInspectorTree(INSPECTOR_ID);
|
|
885
|
-
api.sendInspectorState(INSPECTOR_ID);
|
|
886
|
-
api.getSettings().logStoreChanges && toastMessage(`"${store.$id}" store installed 🆕`);
|
|
887
|
-
});
|
|
888
|
-
}
|
|
889
|
-
let runningActionId = 0;
|
|
890
|
-
let activeAction;
|
|
891
|
-
function patchActionForGrouping(store, actionNames, wrapWithProxy) {
|
|
892
|
-
const actions = actionNames.reduce((storeActions, actionName) => {
|
|
893
|
-
storeActions[actionName] = toRaw(store)[actionName];
|
|
894
|
-
return storeActions;
|
|
895
|
-
}, {});
|
|
896
|
-
for (const actionName in actions) {
|
|
897
|
-
store[actionName] = function() {
|
|
898
|
-
const _actionId = runningActionId;
|
|
899
|
-
const trackedStore = wrapWithProxy ? new Proxy(store, {
|
|
900
|
-
get(...args) {
|
|
901
|
-
activeAction = _actionId;
|
|
902
|
-
return Reflect.get(...args);
|
|
903
|
-
},
|
|
904
|
-
set(...args) {
|
|
905
|
-
activeAction = _actionId;
|
|
906
|
-
return Reflect.set(...args);
|
|
907
|
-
}
|
|
908
|
-
}) : store;
|
|
909
|
-
activeAction = _actionId;
|
|
910
|
-
const retValue = actions[actionName].apply(trackedStore, arguments);
|
|
911
|
-
activeAction = void 0;
|
|
912
|
-
return retValue;
|
|
913
|
-
};
|
|
914
|
-
}
|
|
915
|
-
}
|
|
916
|
-
function devtoolsPlugin({ app, store, options }) {
|
|
917
|
-
if (store.$id.startsWith("__hot:")) {
|
|
918
|
-
return;
|
|
919
|
-
}
|
|
920
|
-
store._isOptionsAPI = !!options.state;
|
|
921
|
-
patchActionForGrouping(store, Object.keys(options.actions), store._isOptionsAPI);
|
|
922
|
-
const originalHotUpdate = store._hotUpdate;
|
|
923
|
-
toRaw(store)._hotUpdate = function(newStore) {
|
|
924
|
-
originalHotUpdate.apply(this, arguments);
|
|
925
|
-
patchActionForGrouping(store, Object.keys(newStore._hmrPayload.actions), !!store._isOptionsAPI);
|
|
926
|
-
};
|
|
927
|
-
addStoreToDevtools(
|
|
928
|
-
app,
|
|
929
|
-
// FIXME: is there a way to allow the assignment from Store<Id, S, G, A> to StoreGeneric?
|
|
930
|
-
store
|
|
931
|
-
);
|
|
932
|
-
}
|
|
933
|
-
function createPinia() {
|
|
934
|
-
const scope = effectScope(true);
|
|
935
|
-
const state = scope.run(() => ref({}));
|
|
936
|
-
let _p = [];
|
|
937
|
-
let toBeInstalled = [];
|
|
938
|
-
const pinia = markRaw({
|
|
939
|
-
install(app) {
|
|
940
|
-
setActivePinia(pinia);
|
|
941
|
-
if (!isVue2) {
|
|
942
|
-
pinia._a = app;
|
|
943
|
-
app.provide(piniaSymbol, pinia);
|
|
944
|
-
app.config.globalProperties.$pinia = pinia;
|
|
945
|
-
if (USE_DEVTOOLS) {
|
|
946
|
-
registerPiniaDevtools(app, pinia);
|
|
947
|
-
}
|
|
948
|
-
toBeInstalled.forEach((plugin) => _p.push(plugin));
|
|
949
|
-
toBeInstalled = [];
|
|
950
|
-
}
|
|
951
|
-
},
|
|
952
|
-
use(plugin) {
|
|
953
|
-
if (!this._a && !isVue2) {
|
|
954
|
-
toBeInstalled.push(plugin);
|
|
955
|
-
} else {
|
|
956
|
-
_p.push(plugin);
|
|
957
|
-
}
|
|
958
|
-
return this;
|
|
959
|
-
},
|
|
960
|
-
_p,
|
|
961
|
-
// it's actually undefined here
|
|
962
|
-
// @ts-expect-error
|
|
963
|
-
_a: null,
|
|
964
|
-
_e: scope,
|
|
965
|
-
_s: /* @__PURE__ */ new Map(),
|
|
966
|
-
state
|
|
967
|
-
});
|
|
968
|
-
if (USE_DEVTOOLS && typeof Proxy !== "undefined") {
|
|
969
|
-
pinia.use(devtoolsPlugin);
|
|
970
|
-
}
|
|
971
|
-
return pinia;
|
|
972
|
-
}
|
|
973
|
-
const isUseStore = (fn) => {
|
|
974
|
-
return typeof fn === "function" && typeof fn.$id === "string";
|
|
975
|
-
};
|
|
976
|
-
function patchObject(newState, oldState) {
|
|
977
|
-
for (const key in oldState) {
|
|
978
|
-
const subPatch = oldState[key];
|
|
979
|
-
if (!(key in newState)) {
|
|
980
|
-
continue;
|
|
981
|
-
}
|
|
982
|
-
const targetValue = newState[key];
|
|
983
|
-
if (isPlainObject(targetValue) && isPlainObject(subPatch) && !isRef(subPatch) && !isReactive(subPatch)) {
|
|
984
|
-
newState[key] = patchObject(targetValue, subPatch);
|
|
985
|
-
} else {
|
|
986
|
-
if (isVue2) {
|
|
987
|
-
set(newState, key, subPatch);
|
|
988
|
-
} else {
|
|
989
|
-
newState[key] = subPatch;
|
|
990
|
-
}
|
|
991
|
-
}
|
|
992
|
-
}
|
|
993
|
-
return newState;
|
|
994
|
-
}
|
|
995
|
-
function acceptHMRUpdate(initialUseStore, hot) {
|
|
996
|
-
if (true) {
|
|
997
|
-
return () => {
|
|
998
|
-
};
|
|
999
|
-
}
|
|
1000
|
-
return (newModule) => {
|
|
1001
|
-
const pinia = hot.data.pinia || initialUseStore._pinia;
|
|
1002
|
-
if (!pinia) {
|
|
1003
|
-
return;
|
|
1004
|
-
}
|
|
1005
|
-
hot.data.pinia = pinia;
|
|
1006
|
-
for (const exportName in newModule) {
|
|
1007
|
-
const useStore = newModule[exportName];
|
|
1008
|
-
if (isUseStore(useStore) && pinia._s.has(useStore.$id)) {
|
|
1009
|
-
const id = useStore.$id;
|
|
1010
|
-
if (id !== initialUseStore.$id) {
|
|
1011
|
-
console.warn(`The id of the store changed from "${initialUseStore.$id}" to "${id}". Reloading.`);
|
|
1012
|
-
return hot.invalidate();
|
|
1013
|
-
}
|
|
1014
|
-
const existingStore = pinia._s.get(id);
|
|
1015
|
-
if (!existingStore) {
|
|
1016
|
-
console.log(`[Pinia]: skipping hmr because store doesn't exist yet`);
|
|
1017
|
-
return;
|
|
1018
|
-
}
|
|
1019
|
-
useStore(pinia, existingStore);
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
};
|
|
1023
|
-
}
|
|
1024
|
-
const noop = () => {
|
|
1025
|
-
};
|
|
1026
|
-
function addSubscription(subscriptions, callback, detached, onCleanup = noop) {
|
|
1027
|
-
subscriptions.push(callback);
|
|
1028
|
-
const removeSubscription = () => {
|
|
1029
|
-
const idx = subscriptions.indexOf(callback);
|
|
1030
|
-
if (idx > -1) {
|
|
1031
|
-
subscriptions.splice(idx, 1);
|
|
1032
|
-
onCleanup();
|
|
1033
|
-
}
|
|
1034
|
-
};
|
|
1035
|
-
if (!detached && getCurrentScope()) {
|
|
1036
|
-
onScopeDispose(removeSubscription);
|
|
1037
|
-
}
|
|
1038
|
-
return removeSubscription;
|
|
1039
|
-
}
|
|
1040
|
-
function triggerSubscriptions(subscriptions, ...args) {
|
|
1041
|
-
subscriptions.slice().forEach((callback) => {
|
|
1042
|
-
callback(...args);
|
|
1043
|
-
});
|
|
1044
|
-
}
|
|
1045
|
-
const fallbackRunWithContext = (fn) => fn();
|
|
1046
|
-
function mergeReactiveObjects(target, patchToApply) {
|
|
1047
|
-
if (target instanceof Map && patchToApply instanceof Map) {
|
|
1048
|
-
patchToApply.forEach((value, key) => target.set(key, value));
|
|
1049
|
-
}
|
|
1050
|
-
if (target instanceof Set && patchToApply instanceof Set) {
|
|
1051
|
-
patchToApply.forEach(target.add, target);
|
|
1052
|
-
}
|
|
1053
|
-
for (const key in patchToApply) {
|
|
1054
|
-
if (!patchToApply.hasOwnProperty(key))
|
|
1055
|
-
continue;
|
|
1056
|
-
const subPatch = patchToApply[key];
|
|
1057
|
-
const targetValue = target[key];
|
|
1058
|
-
if (isPlainObject(targetValue) && isPlainObject(subPatch) && target.hasOwnProperty(key) && !isRef(subPatch) && !isReactive(subPatch)) {
|
|
1059
|
-
target[key] = mergeReactiveObjects(targetValue, subPatch);
|
|
1060
|
-
} else {
|
|
1061
|
-
target[key] = subPatch;
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
return target;
|
|
1065
|
-
}
|
|
1066
|
-
const skipHydrateSymbol = false ? Symbol("pinia:skipHydration") : (
|
|
1067
|
-
/* istanbul ignore next */
|
|
1068
|
-
Symbol()
|
|
1069
|
-
);
|
|
1070
|
-
const skipHydrateMap = /* @__PURE__ */ new WeakMap();
|
|
1071
|
-
function skipHydrate(obj) {
|
|
1072
|
-
return isVue2 ? (
|
|
1073
|
-
// in @vue/composition-api, the refs are sealed so defineProperty doesn't work...
|
|
1074
|
-
/* istanbul ignore next */
|
|
1075
|
-
skipHydrateMap.set(obj, 1) && obj
|
|
1076
|
-
) : Object.defineProperty(obj, skipHydrateSymbol, {});
|
|
1077
|
-
}
|
|
1078
|
-
function shouldHydrate(obj) {
|
|
1079
|
-
return isVue2 ? (
|
|
1080
|
-
/* istanbul ignore next */
|
|
1081
|
-
!skipHydrateMap.has(obj)
|
|
1082
|
-
) : !isPlainObject(obj) || !obj.hasOwnProperty(skipHydrateSymbol);
|
|
1083
|
-
}
|
|
1084
|
-
const { assign } = Object;
|
|
1085
|
-
function isComputed(o) {
|
|
1086
|
-
return !!(isRef(o) && o.effect);
|
|
1087
|
-
}
|
|
1088
|
-
function createOptionsStore(id, options, pinia, hot) {
|
|
1089
|
-
const { state, actions, getters } = options;
|
|
1090
|
-
const initialState = pinia.state.value[id];
|
|
1091
|
-
let store;
|
|
1092
|
-
function setup() {
|
|
1093
|
-
if (!initialState && true) {
|
|
1094
|
-
if (isVue2) {
|
|
1095
|
-
set(pinia.state.value, id, state ? state() : {});
|
|
1096
|
-
} else {
|
|
1097
|
-
pinia.state.value[id] = state ? state() : {};
|
|
1098
|
-
}
|
|
1099
|
-
}
|
|
1100
|
-
const localState = false ? (
|
|
1101
|
-
// use ref() to unwrap refs inside state TODO: check if this is still necessary
|
|
1102
|
-
toRefs(ref(state ? state() : {}).value)
|
|
1103
|
-
) : toRefs(pinia.state.value[id]);
|
|
1104
|
-
return assign(localState, actions, Object.keys(getters || {}).reduce((computedGetters, name) => {
|
|
1105
|
-
if (false) {
|
|
1106
|
-
console.warn(`[🍍]: A getter cannot have the same name as another state property. Rename one of them. Found with "${name}" in store "${id}".`);
|
|
1107
|
-
}
|
|
1108
|
-
computedGetters[name] = markRaw(computed(() => {
|
|
1109
|
-
setActivePinia(pinia);
|
|
1110
|
-
const store2 = pinia._s.get(id);
|
|
1111
|
-
if (isVue2 && !store2._r)
|
|
1112
|
-
return;
|
|
1113
|
-
return getters[name].call(store2, store2);
|
|
1114
|
-
}));
|
|
1115
|
-
return computedGetters;
|
|
1116
|
-
}, {}));
|
|
1117
|
-
}
|
|
1118
|
-
store = createSetupStore(id, setup, options, pinia, hot, true);
|
|
1119
|
-
return store;
|
|
1120
|
-
}
|
|
1121
|
-
function createSetupStore($id, setup, options = {}, pinia, hot, isOptionsStore) {
|
|
1122
|
-
let scope;
|
|
1123
|
-
const optionsForPlugin = assign({ actions: {} }, options);
|
|
1124
|
-
if (false) {
|
|
1125
|
-
throw new Error("Pinia destroyed");
|
|
1126
|
-
}
|
|
1127
|
-
const $subscribeOptions = {
|
|
1128
|
-
deep: true
|
|
1129
|
-
// flush: 'post',
|
|
1130
|
-
};
|
|
1131
|
-
if (false) {
|
|
1132
|
-
$subscribeOptions.onTrigger = (event) => {
|
|
1133
|
-
if (isListening) {
|
|
1134
|
-
debuggerEvents = event;
|
|
1135
|
-
} else if (isListening == false && !store._hotUpdating) {
|
|
1136
|
-
if (Array.isArray(debuggerEvents)) {
|
|
1137
|
-
debuggerEvents.push(event);
|
|
1138
|
-
} else {
|
|
1139
|
-
console.error("🍍 debuggerEvents should be an array. This is most likely an internal Pinia bug.");
|
|
1140
|
-
}
|
|
1141
|
-
}
|
|
1142
|
-
};
|
|
1143
|
-
}
|
|
1144
|
-
let isListening;
|
|
1145
|
-
let isSyncListening;
|
|
1146
|
-
let subscriptions = [];
|
|
1147
|
-
let actionSubscriptions = [];
|
|
1148
|
-
let debuggerEvents;
|
|
1149
|
-
const initialState = pinia.state.value[$id];
|
|
1150
|
-
if (!isOptionsStore && !initialState && true) {
|
|
1151
|
-
if (isVue2) {
|
|
1152
|
-
set(pinia.state.value, $id, {});
|
|
1153
|
-
} else {
|
|
1154
|
-
pinia.state.value[$id] = {};
|
|
1155
|
-
}
|
|
1156
|
-
}
|
|
1157
|
-
const hotState = ref({});
|
|
1158
|
-
let activeListener;
|
|
1159
|
-
function $patch(partialStateOrMutator) {
|
|
1160
|
-
let subscriptionMutation;
|
|
1161
|
-
isListening = isSyncListening = false;
|
|
1162
|
-
if (false) {
|
|
1163
|
-
debuggerEvents = [];
|
|
1164
|
-
}
|
|
1165
|
-
if (typeof partialStateOrMutator === "function") {
|
|
1166
|
-
partialStateOrMutator(pinia.state.value[$id]);
|
|
1167
|
-
subscriptionMutation = {
|
|
1168
|
-
type: MutationType.patchFunction,
|
|
1169
|
-
storeId: $id,
|
|
1170
|
-
events: debuggerEvents
|
|
1171
|
-
};
|
|
1172
|
-
} else {
|
|
1173
|
-
mergeReactiveObjects(pinia.state.value[$id], partialStateOrMutator);
|
|
1174
|
-
subscriptionMutation = {
|
|
1175
|
-
type: MutationType.patchObject,
|
|
1176
|
-
payload: partialStateOrMutator,
|
|
1177
|
-
storeId: $id,
|
|
1178
|
-
events: debuggerEvents
|
|
1179
|
-
};
|
|
1180
|
-
}
|
|
1181
|
-
const myListenerId = activeListener = Symbol();
|
|
1182
|
-
nextTick().then(() => {
|
|
1183
|
-
if (activeListener === myListenerId) {
|
|
1184
|
-
isListening = true;
|
|
1185
|
-
}
|
|
1186
|
-
});
|
|
1187
|
-
isSyncListening = true;
|
|
1188
|
-
triggerSubscriptions(subscriptions, subscriptionMutation, pinia.state.value[$id]);
|
|
1189
|
-
}
|
|
1190
|
-
const $reset = isOptionsStore ? function $reset2() {
|
|
1191
|
-
const { state } = options;
|
|
1192
|
-
const newState = state ? state() : {};
|
|
1193
|
-
this.$patch(($state) => {
|
|
1194
|
-
assign($state, newState);
|
|
1195
|
-
});
|
|
1196
|
-
} : (
|
|
1197
|
-
/* istanbul ignore next */
|
|
1198
|
-
false ? () => {
|
|
1199
|
-
throw new Error(`🍍: Store "${$id}" is built using the setup syntax and does not implement $reset().`);
|
|
1200
|
-
} : noop
|
|
1201
|
-
);
|
|
1202
|
-
function $dispose() {
|
|
1203
|
-
scope.stop();
|
|
1204
|
-
subscriptions = [];
|
|
1205
|
-
actionSubscriptions = [];
|
|
1206
|
-
pinia._s.delete($id);
|
|
1207
|
-
}
|
|
1208
|
-
function wrapAction(name, action) {
|
|
1209
|
-
return function() {
|
|
1210
|
-
setActivePinia(pinia);
|
|
1211
|
-
const args = Array.from(arguments);
|
|
1212
|
-
const afterCallbackList = [];
|
|
1213
|
-
const onErrorCallbackList = [];
|
|
1214
|
-
function after(callback) {
|
|
1215
|
-
afterCallbackList.push(callback);
|
|
1216
|
-
}
|
|
1217
|
-
function onError(callback) {
|
|
1218
|
-
onErrorCallbackList.push(callback);
|
|
1219
|
-
}
|
|
1220
|
-
triggerSubscriptions(actionSubscriptions, {
|
|
1221
|
-
args,
|
|
1222
|
-
name,
|
|
1223
|
-
store,
|
|
1224
|
-
after,
|
|
1225
|
-
onError
|
|
1226
|
-
});
|
|
1227
|
-
let ret;
|
|
1228
|
-
try {
|
|
1229
|
-
ret = action.apply(this && this.$id === $id ? this : store, args);
|
|
1230
|
-
} catch (error) {
|
|
1231
|
-
triggerSubscriptions(onErrorCallbackList, error);
|
|
1232
|
-
throw error;
|
|
1233
|
-
}
|
|
1234
|
-
if (ret instanceof Promise) {
|
|
1235
|
-
return ret.then((value) => {
|
|
1236
|
-
triggerSubscriptions(afterCallbackList, value);
|
|
1237
|
-
return value;
|
|
1238
|
-
}).catch((error) => {
|
|
1239
|
-
triggerSubscriptions(onErrorCallbackList, error);
|
|
1240
|
-
return Promise.reject(error);
|
|
1241
|
-
});
|
|
1242
|
-
}
|
|
1243
|
-
triggerSubscriptions(afterCallbackList, ret);
|
|
1244
|
-
return ret;
|
|
1245
|
-
};
|
|
1246
|
-
}
|
|
1247
|
-
const _hmrPayload = /* @__PURE__ */ markRaw({
|
|
1248
|
-
actions: {},
|
|
1249
|
-
getters: {},
|
|
1250
|
-
state: [],
|
|
1251
|
-
hotState
|
|
1252
|
-
});
|
|
1253
|
-
const partialStore = {
|
|
1254
|
-
_p: pinia,
|
|
1255
|
-
// _s: scope,
|
|
1256
|
-
$id,
|
|
1257
|
-
$onAction: addSubscription.bind(null, actionSubscriptions),
|
|
1258
|
-
$patch,
|
|
1259
|
-
$reset,
|
|
1260
|
-
$subscribe(callback, options2 = {}) {
|
|
1261
|
-
const removeSubscription = addSubscription(subscriptions, callback, options2.detached, () => stopWatcher());
|
|
1262
|
-
const stopWatcher = scope.run(() => watch(() => pinia.state.value[$id], (state) => {
|
|
1263
|
-
if (options2.flush === "sync" ? isSyncListening : isListening) {
|
|
1264
|
-
callback({
|
|
1265
|
-
storeId: $id,
|
|
1266
|
-
type: MutationType.direct,
|
|
1267
|
-
events: debuggerEvents
|
|
1268
|
-
}, state);
|
|
1269
|
-
}
|
|
1270
|
-
}, assign({}, $subscribeOptions, options2)));
|
|
1271
|
-
return removeSubscription;
|
|
1272
|
-
},
|
|
1273
|
-
$dispose
|
|
1274
|
-
};
|
|
1275
|
-
if (isVue2) {
|
|
1276
|
-
partialStore._r = false;
|
|
1277
|
-
}
|
|
1278
|
-
const store = reactive(USE_DEVTOOLS ? assign(
|
|
1279
|
-
{
|
|
1280
|
-
_hmrPayload,
|
|
1281
|
-
_customProperties: markRaw(/* @__PURE__ */ new Set())
|
|
1282
|
-
// devtools custom properties
|
|
1283
|
-
},
|
|
1284
|
-
partialStore
|
|
1285
|
-
// must be added later
|
|
1286
|
-
// setupStore
|
|
1287
|
-
) : partialStore);
|
|
1288
|
-
pinia._s.set($id, store);
|
|
1289
|
-
const runWithContext = pinia._a && pinia._a.runWithContext || fallbackRunWithContext;
|
|
1290
|
-
const setupStore = pinia._e.run(() => {
|
|
1291
|
-
scope = effectScope();
|
|
1292
|
-
return runWithContext(() => scope.run(setup));
|
|
1293
|
-
});
|
|
1294
|
-
for (const key in setupStore) {
|
|
1295
|
-
const prop = setupStore[key];
|
|
1296
|
-
if (isRef(prop) && !isComputed(prop) || isReactive(prop)) {
|
|
1297
|
-
if (false) {
|
|
1298
|
-
set(hotState.value, key, toRef(setupStore, key));
|
|
1299
|
-
} else if (!isOptionsStore) {
|
|
1300
|
-
if (initialState && shouldHydrate(prop)) {
|
|
1301
|
-
if (isRef(prop)) {
|
|
1302
|
-
prop.value = initialState[key];
|
|
1303
|
-
} else {
|
|
1304
|
-
mergeReactiveObjects(prop, initialState[key]);
|
|
1305
|
-
}
|
|
1306
|
-
}
|
|
1307
|
-
if (isVue2) {
|
|
1308
|
-
set(pinia.state.value[$id], key, prop);
|
|
1309
|
-
} else {
|
|
1310
|
-
pinia.state.value[$id][key] = prop;
|
|
1311
|
-
}
|
|
1312
|
-
}
|
|
1313
|
-
if (false) {
|
|
1314
|
-
_hmrPayload.state.push(key);
|
|
1315
|
-
}
|
|
1316
|
-
} else if (typeof prop === "function") {
|
|
1317
|
-
const actionValue = false ? prop : wrapAction(key, prop);
|
|
1318
|
-
if (isVue2) {
|
|
1319
|
-
set(setupStore, key, actionValue);
|
|
1320
|
-
} else {
|
|
1321
|
-
setupStore[key] = actionValue;
|
|
1322
|
-
}
|
|
1323
|
-
if (false) {
|
|
1324
|
-
_hmrPayload.actions[key] = prop;
|
|
1325
|
-
}
|
|
1326
|
-
optionsForPlugin.actions[key] = prop;
|
|
1327
|
-
} else if (false) {
|
|
1328
|
-
if (isComputed(prop)) {
|
|
1329
|
-
_hmrPayload.getters[key] = isOptionsStore ? (
|
|
1330
|
-
// @ts-expect-error
|
|
1331
|
-
options.getters[key]
|
|
1332
|
-
) : prop;
|
|
1333
|
-
if (IS_CLIENT) {
|
|
1334
|
-
const getters = setupStore._getters || // @ts-expect-error: same
|
|
1335
|
-
(setupStore._getters = markRaw([]));
|
|
1336
|
-
getters.push(key);
|
|
1337
|
-
}
|
|
1338
|
-
}
|
|
1339
|
-
}
|
|
1340
|
-
}
|
|
1341
|
-
if (isVue2) {
|
|
1342
|
-
Object.keys(setupStore).forEach((key) => {
|
|
1343
|
-
set(store, key, setupStore[key]);
|
|
1344
|
-
});
|
|
1345
|
-
} else {
|
|
1346
|
-
assign(store, setupStore);
|
|
1347
|
-
assign(toRaw(store), setupStore);
|
|
1348
|
-
}
|
|
1349
|
-
Object.defineProperty(store, "$state", {
|
|
1350
|
-
get: () => false ? hotState.value : pinia.state.value[$id],
|
|
1351
|
-
set: (state) => {
|
|
1352
|
-
if (false) {
|
|
1353
|
-
throw new Error("cannot set hotState");
|
|
1354
|
-
}
|
|
1355
|
-
$patch(($state) => {
|
|
1356
|
-
assign($state, state);
|
|
1357
|
-
});
|
|
1358
|
-
}
|
|
1359
|
-
});
|
|
1360
|
-
if (false) {
|
|
1361
|
-
store._hotUpdate = markRaw((newStore) => {
|
|
1362
|
-
store._hotUpdating = true;
|
|
1363
|
-
newStore._hmrPayload.state.forEach((stateKey) => {
|
|
1364
|
-
if (stateKey in store.$state) {
|
|
1365
|
-
const newStateTarget = newStore.$state[stateKey];
|
|
1366
|
-
const oldStateSource = store.$state[stateKey];
|
|
1367
|
-
if (typeof newStateTarget === "object" && isPlainObject(newStateTarget) && isPlainObject(oldStateSource)) {
|
|
1368
|
-
patchObject(newStateTarget, oldStateSource);
|
|
1369
|
-
} else {
|
|
1370
|
-
newStore.$state[stateKey] = oldStateSource;
|
|
1371
|
-
}
|
|
1372
|
-
}
|
|
1373
|
-
set(store, stateKey, toRef(newStore.$state, stateKey));
|
|
1374
|
-
});
|
|
1375
|
-
Object.keys(store.$state).forEach((stateKey) => {
|
|
1376
|
-
if (!(stateKey in newStore.$state)) {
|
|
1377
|
-
del(store, stateKey);
|
|
1378
|
-
}
|
|
1379
|
-
});
|
|
1380
|
-
isListening = false;
|
|
1381
|
-
isSyncListening = false;
|
|
1382
|
-
pinia.state.value[$id] = toRef(newStore._hmrPayload, "hotState");
|
|
1383
|
-
isSyncListening = true;
|
|
1384
|
-
nextTick().then(() => {
|
|
1385
|
-
isListening = true;
|
|
1386
|
-
});
|
|
1387
|
-
for (const actionName in newStore._hmrPayload.actions) {
|
|
1388
|
-
const action = newStore[actionName];
|
|
1389
|
-
set(store, actionName, wrapAction(actionName, action));
|
|
1390
|
-
}
|
|
1391
|
-
for (const getterName in newStore._hmrPayload.getters) {
|
|
1392
|
-
const getter = newStore._hmrPayload.getters[getterName];
|
|
1393
|
-
const getterValue = isOptionsStore ? (
|
|
1394
|
-
// special handling of options api
|
|
1395
|
-
computed(() => {
|
|
1396
|
-
setActivePinia(pinia);
|
|
1397
|
-
return getter.call(store, store);
|
|
1398
|
-
})
|
|
1399
|
-
) : getter;
|
|
1400
|
-
set(store, getterName, getterValue);
|
|
1401
|
-
}
|
|
1402
|
-
Object.keys(store._hmrPayload.getters).forEach((key) => {
|
|
1403
|
-
if (!(key in newStore._hmrPayload.getters)) {
|
|
1404
|
-
del(store, key);
|
|
1405
|
-
}
|
|
1406
|
-
});
|
|
1407
|
-
Object.keys(store._hmrPayload.actions).forEach((key) => {
|
|
1408
|
-
if (!(key in newStore._hmrPayload.actions)) {
|
|
1409
|
-
del(store, key);
|
|
1410
|
-
}
|
|
1411
|
-
});
|
|
1412
|
-
store._hmrPayload = newStore._hmrPayload;
|
|
1413
|
-
store._getters = newStore._getters;
|
|
1414
|
-
store._hotUpdating = false;
|
|
1415
|
-
});
|
|
1416
|
-
}
|
|
1417
|
-
if (USE_DEVTOOLS) {
|
|
1418
|
-
const nonEnumerable = {
|
|
1419
|
-
writable: true,
|
|
1420
|
-
configurable: true,
|
|
1421
|
-
// avoid warning on devtools trying to display this property
|
|
1422
|
-
enumerable: false
|
|
1423
|
-
};
|
|
1424
|
-
["_p", "_hmrPayload", "_getters", "_customProperties"].forEach((p) => {
|
|
1425
|
-
Object.defineProperty(store, p, assign({ value: store[p] }, nonEnumerable));
|
|
1426
|
-
});
|
|
1427
|
-
}
|
|
1428
|
-
if (isVue2) {
|
|
1429
|
-
store._r = true;
|
|
1430
|
-
}
|
|
1431
|
-
pinia._p.forEach((extender) => {
|
|
1432
|
-
if (USE_DEVTOOLS) {
|
|
1433
|
-
const extensions = scope.run(() => extender({
|
|
1434
|
-
store,
|
|
1435
|
-
app: pinia._a,
|
|
1436
|
-
pinia,
|
|
1437
|
-
options: optionsForPlugin
|
|
1438
|
-
}));
|
|
1439
|
-
Object.keys(extensions || {}).forEach((key) => store._customProperties.add(key));
|
|
1440
|
-
assign(store, extensions);
|
|
1441
|
-
} else {
|
|
1442
|
-
assign(store, scope.run(() => extender({
|
|
1443
|
-
store,
|
|
1444
|
-
app: pinia._a,
|
|
1445
|
-
pinia,
|
|
1446
|
-
options: optionsForPlugin
|
|
1447
|
-
})));
|
|
1448
|
-
}
|
|
1449
|
-
});
|
|
1450
|
-
if (false) {
|
|
1451
|
-
console.warn(`[🍍]: The "state" must be a plain object. It cannot be
|
|
1452
|
-
state: () => new MyClass()
|
|
1453
|
-
Found in store "${store.$id}".`);
|
|
1454
|
-
}
|
|
1455
|
-
if (initialState && isOptionsStore && options.hydrate) {
|
|
1456
|
-
options.hydrate(store.$state, initialState);
|
|
1457
|
-
}
|
|
1458
|
-
isListening = true;
|
|
1459
|
-
isSyncListening = true;
|
|
1460
|
-
return store;
|
|
1461
|
-
}
|
|
1462
|
-
function defineStore(idOrOptions, setup, setupOptions) {
|
|
1463
|
-
let id;
|
|
1464
|
-
let options;
|
|
1465
|
-
const isSetupStore = typeof setup === "function";
|
|
1466
|
-
if (typeof idOrOptions === "string") {
|
|
1467
|
-
id = idOrOptions;
|
|
1468
|
-
options = isSetupStore ? setupOptions : setup;
|
|
1469
|
-
} else {
|
|
1470
|
-
options = idOrOptions;
|
|
1471
|
-
id = idOrOptions.id;
|
|
1472
|
-
if (false) {
|
|
1473
|
-
throw new Error(`[🍍]: "defineStore()" must be passed a store id as its first argument.`);
|
|
1474
|
-
}
|
|
1475
|
-
}
|
|
1476
|
-
function useStore(pinia, hot) {
|
|
1477
|
-
const hasContext = hasInjectionContext();
|
|
1478
|
-
pinia = // in test mode, ignore the argument provided as we can always retrieve a
|
|
1479
|
-
// pinia instance with getActivePinia()
|
|
1480
|
-
(false ? null : pinia) || (hasContext ? inject(piniaSymbol, null) : null);
|
|
1481
|
-
if (pinia)
|
|
1482
|
-
setActivePinia(pinia);
|
|
1483
|
-
if (false) {
|
|
1484
|
-
throw new Error(`[🍍]: "getActivePinia()" was called but there was no active Pinia. Did you forget to install pinia?
|
|
1485
|
-
const pinia = createPinia()
|
|
1486
|
-
app.use(pinia)
|
|
1487
|
-
This will fail in production.`);
|
|
1488
|
-
}
|
|
1489
|
-
pinia = activePinia;
|
|
1490
|
-
if (!pinia._s.has(id)) {
|
|
1491
|
-
if (isSetupStore) {
|
|
1492
|
-
createSetupStore(id, setup, options, pinia);
|
|
1493
|
-
} else {
|
|
1494
|
-
createOptionsStore(id, options, pinia);
|
|
1495
|
-
}
|
|
1496
|
-
if (false) {
|
|
1497
|
-
useStore._pinia = pinia;
|
|
1498
|
-
}
|
|
1499
|
-
}
|
|
1500
|
-
const store = pinia._s.get(id);
|
|
1501
|
-
if (false) {
|
|
1502
|
-
const hotId = "__hot:" + id;
|
|
1503
|
-
const newStore = isSetupStore ? createSetupStore(hotId, setup, options, pinia, true) : createOptionsStore(hotId, assign({}, options), pinia, true);
|
|
1504
|
-
hot._hotUpdate(newStore);
|
|
1505
|
-
delete pinia.state.value[hotId];
|
|
1506
|
-
pinia._s.delete(hotId);
|
|
1507
|
-
}
|
|
1508
|
-
if (false) {
|
|
1509
|
-
const currentInstance = getCurrentInstance();
|
|
1510
|
-
if (currentInstance && currentInstance.proxy && // avoid adding stores that are just built for hot module replacement
|
|
1511
|
-
!hot) {
|
|
1512
|
-
const vm = currentInstance.proxy;
|
|
1513
|
-
const cache = "_pStores" in vm ? vm._pStores : vm._pStores = {};
|
|
1514
|
-
cache[id] = store;
|
|
1515
|
-
}
|
|
1516
|
-
}
|
|
1517
|
-
return store;
|
|
1518
|
-
}
|
|
1519
|
-
useStore.$id = id;
|
|
1520
|
-
return useStore;
|
|
1521
|
-
}
|
|
1522
|
-
let mapStoreSuffix = "Store";
|
|
1523
|
-
function setMapStoreSuffix(suffix) {
|
|
1524
|
-
mapStoreSuffix = suffix;
|
|
1525
|
-
}
|
|
1526
|
-
function mapStores(...stores) {
|
|
1527
|
-
if (false) {
|
|
1528
|
-
console.warn(`[🍍]: Directly pass all stores to "mapStores()" without putting them in an array:
|
|
1529
|
-
Replace
|
|
1530
|
-
mapStores([useAuthStore, useCartStore])
|
|
1531
|
-
with
|
|
1532
|
-
mapStores(useAuthStore, useCartStore)
|
|
1533
|
-
This will fail in production if not fixed.`);
|
|
1534
|
-
stores = stores[0];
|
|
1535
|
-
}
|
|
1536
|
-
return stores.reduce((reduced, useStore) => {
|
|
1537
|
-
reduced[useStore.$id + mapStoreSuffix] = function() {
|
|
1538
|
-
return useStore(this.$pinia);
|
|
1539
|
-
};
|
|
1540
|
-
return reduced;
|
|
1541
|
-
}, {});
|
|
1542
|
-
}
|
|
1543
|
-
function mapState(useStore, keysOrMapper) {
|
|
1544
|
-
return Array.isArray(keysOrMapper) ? keysOrMapper.reduce((reduced, key) => {
|
|
1545
|
-
reduced[key] = function() {
|
|
1546
|
-
return useStore(this.$pinia)[key];
|
|
1547
|
-
};
|
|
1548
|
-
return reduced;
|
|
1549
|
-
}, {}) : Object.keys(keysOrMapper).reduce((reduced, key) => {
|
|
1550
|
-
reduced[key] = function() {
|
|
1551
|
-
const store = useStore(this.$pinia);
|
|
1552
|
-
const storeKey = keysOrMapper[key];
|
|
1553
|
-
return typeof storeKey === "function" ? storeKey.call(this, store) : store[storeKey];
|
|
1554
|
-
};
|
|
1555
|
-
return reduced;
|
|
1556
|
-
}, {});
|
|
1557
|
-
}
|
|
1558
|
-
const mapGetters = mapState;
|
|
1559
|
-
function mapActions(useStore, keysOrMapper) {
|
|
1560
|
-
return Array.isArray(keysOrMapper) ? keysOrMapper.reduce((reduced, key) => {
|
|
1561
|
-
reduced[key] = function(...args) {
|
|
1562
|
-
return useStore(this.$pinia)[key](...args);
|
|
1563
|
-
};
|
|
1564
|
-
return reduced;
|
|
1565
|
-
}, {}) : Object.keys(keysOrMapper).reduce((reduced, key) => {
|
|
1566
|
-
reduced[key] = function(...args) {
|
|
1567
|
-
return useStore(this.$pinia)[keysOrMapper[key]](...args);
|
|
1568
|
-
};
|
|
1569
|
-
return reduced;
|
|
1570
|
-
}, {});
|
|
1571
|
-
}
|
|
1572
|
-
function mapWritableState(useStore, keysOrMapper) {
|
|
1573
|
-
return Array.isArray(keysOrMapper) ? keysOrMapper.reduce((reduced, key) => {
|
|
1574
|
-
reduced[key] = {
|
|
1575
|
-
get() {
|
|
1576
|
-
return useStore(this.$pinia)[key];
|
|
1577
|
-
},
|
|
1578
|
-
set(value) {
|
|
1579
|
-
return useStore(this.$pinia)[key] = value;
|
|
1580
|
-
}
|
|
1581
|
-
};
|
|
1582
|
-
return reduced;
|
|
1583
|
-
}, {}) : Object.keys(keysOrMapper).reduce((reduced, key) => {
|
|
1584
|
-
reduced[key] = {
|
|
1585
|
-
get() {
|
|
1586
|
-
return useStore(this.$pinia)[keysOrMapper[key]];
|
|
1587
|
-
},
|
|
1588
|
-
set(value) {
|
|
1589
|
-
return useStore(this.$pinia)[keysOrMapper[key]] = value;
|
|
1590
|
-
}
|
|
1591
|
-
};
|
|
1592
|
-
return reduced;
|
|
1593
|
-
}, {});
|
|
1594
|
-
}
|
|
1595
|
-
function storeToRefs(store) {
|
|
1596
|
-
if (isVue2) {
|
|
1597
|
-
return toRefs(store);
|
|
1598
|
-
} else {
|
|
1599
|
-
store = toRaw(store);
|
|
1600
|
-
const refs = {};
|
|
1601
|
-
for (const key in store) {
|
|
1602
|
-
const value = store[key];
|
|
1603
|
-
if (isRef(value) || isReactive(value)) {
|
|
1604
|
-
refs[key] = // ---
|
|
1605
|
-
toRef(store, key);
|
|
1606
|
-
}
|
|
1607
|
-
}
|
|
1608
|
-
return refs;
|
|
1609
|
-
}
|
|
1610
|
-
}
|
|
1611
|
-
const PiniaVuePlugin = function(_Vue) {
|
|
1612
|
-
_Vue.mixin({
|
|
1613
|
-
beforeCreate() {
|
|
1614
|
-
const options = this.$options;
|
|
1615
|
-
if (options.pinia) {
|
|
1616
|
-
const pinia = options.pinia;
|
|
1617
|
-
if (!this._provided) {
|
|
1618
|
-
const provideCache = {};
|
|
1619
|
-
Object.defineProperty(this, "_provided", {
|
|
1620
|
-
get: () => provideCache,
|
|
1621
|
-
set: (v) => Object.assign(provideCache, v)
|
|
1622
|
-
});
|
|
1623
|
-
}
|
|
1624
|
-
this._provided[piniaSymbol] = pinia;
|
|
1625
|
-
if (!this.$pinia) {
|
|
1626
|
-
this.$pinia = pinia;
|
|
1627
|
-
}
|
|
1628
|
-
pinia._a = this;
|
|
1629
|
-
if (IS_CLIENT) {
|
|
1630
|
-
setActivePinia(pinia);
|
|
1631
|
-
}
|
|
1632
|
-
if (USE_DEVTOOLS) {
|
|
1633
|
-
registerPiniaDevtools(pinia._a, pinia);
|
|
1634
|
-
}
|
|
1635
|
-
} else if (!this.$pinia && options.parent && options.parent.$pinia) {
|
|
1636
|
-
this.$pinia = options.parent.$pinia;
|
|
1637
|
-
}
|
|
1638
|
-
},
|
|
1639
|
-
destroyed() {
|
|
1640
|
-
delete this._pStores;
|
|
1641
|
-
}
|
|
1642
|
-
});
|
|
1643
|
-
};
|
|
1644
|
-
export {
|
|
1645
|
-
PiniaVuePlugin as P,
|
|
1646
|
-
createPinia as c,
|
|
1647
|
-
defineStore as d,
|
|
1648
|
-
mapStores as m,
|
|
1649
|
-
storeToRefs as s
|
|
1650
|
-
};
|