@harlem/plugin-devtools
Advanced tools
Comparing version 2.4.0-beta.7 to 2.4.0-beta.8
@@ -6,2 +6,10 @@ # Change Log | ||
# [2.4.0-beta.8](https://github.com/andrewcourtice/harlem/compare/v2.4.0-beta.7...v2.4.0-beta.8) (2022-11-21) | ||
**Note:** Version bump only for package @harlem/plugin-devtools | ||
# [2.4.0-beta.7](https://github.com/andrewcourtice/harlem/compare/v2.4.0-beta.6...v2.4.0-beta.7) (2022-11-18) | ||
@@ -8,0 +16,0 @@ |
@@ -41,3 +41,2 @@ "use strict"; | ||
var import_core = require("@harlem/core"); | ||
var import_utilities = require("@harlem/utilities"); | ||
var import_devtools_api = require("@vue/devtools-api"); | ||
@@ -89,3 +88,3 @@ function stringComparitor(valueA, valueB) { | ||
key: store.name, | ||
value: (0, import_utilities.objectOmit)(store.state, import_core.INTERNAL.pattern), | ||
value: store.state, | ||
editable: true, | ||
@@ -175,3 +174,3 @@ objectType: "reactive" | ||
} | ||
function createDevtoolsPlugin(options = OPTIONS) { | ||
function createDevtoolsPlugin(options) { | ||
const { | ||
@@ -184,54 +183,51 @@ label, | ||
}; | ||
return { | ||
name: "devtools", | ||
install(app, eventEmitter, stores) { | ||
const inspectorTreeHook = getInspectorTreeHook(app, stores); | ||
const inspectorStateHook = getInspectorStateHook(app, stores); | ||
const inspectorEditHook = getInspectorEditHook(app, stores); | ||
const descriptor = { | ||
app, | ||
return (app, eventBus, stores) => { | ||
const inspectorTreeHook = getInspectorTreeHook(app, stores); | ||
const inspectorStateHook = getInspectorStateHook(app, stores); | ||
const inspectorEditHook = getInspectorEditHook(app, stores); | ||
const descriptor = { | ||
app, | ||
label, | ||
id: DEVTOOLS_ID, | ||
logo: "https://harlemjs.com/assets/images/favicon.png", | ||
homepage: "https://harlemjs.com", | ||
packageName: "@harlem/plugin-devtools" | ||
}; | ||
(0, import_devtools_api.setupDevtoolsPlugin)(descriptor, (api) => { | ||
const successMutationHook = getMutationHook(api); | ||
const errorMutationHook = getMutationHook(api, "error"); | ||
api.addInspector({ | ||
label, | ||
id: DEVTOOLS_ID, | ||
logo: "https://harlemjs.com/assets/images/favicon.png", | ||
homepage: "https://harlemjs.com", | ||
packageName: "@harlem/plugin-devtools" | ||
}; | ||
(0, import_devtools_api.setupDevtoolsPlugin)(descriptor, (api) => { | ||
const successMutationHook = getMutationHook(api); | ||
const errorMutationHook = getMutationHook(api, "error"); | ||
api.addInspector({ | ||
label, | ||
id: DEVTOOLS_ID, | ||
icon: "source", | ||
treeFilterPlaceholder: "Search stores", | ||
stateFilterPlaceholder: "Search state", | ||
nodeActions: [ | ||
{ | ||
icon: "replay", | ||
tooltip: "Reset store", | ||
action: (nodeId) => eventEmitter.emit(import_core.EVENTS.devtools.reset, { | ||
sender: SENDER, | ||
store: nodeId, | ||
data: nodeId | ||
}) | ||
} | ||
] | ||
}); | ||
api.addTimelineLayer({ | ||
label, | ||
color, | ||
id: DEVTOOLS_ID, | ||
skipScreenshots: true | ||
}); | ||
api.on.getInspectorTree(inspectorTreeHook); | ||
api.on.getInspectorState(inspectorStateHook); | ||
api.on.editInspectorState(inspectorEditHook); | ||
eventEmitter.on(import_core.EVENTS.mutation.success, successMutationHook); | ||
eventEmitter.on(import_core.EVENTS.mutation.error, errorMutationHook); | ||
eventEmitter.on(import_core.EVENTS.devtools.update, () => { | ||
api.sendInspectorTree(DEVTOOLS_ID); | ||
api.sendInspectorState(DEVTOOLS_ID); | ||
}); | ||
icon: "source", | ||
treeFilterPlaceholder: "Search stores", | ||
stateFilterPlaceholder: "Search state", | ||
nodeActions: [ | ||
{ | ||
icon: "replay", | ||
tooltip: "Reset store", | ||
action: (nodeId) => eventBus.emit(import_core.EVENTS.devtools.reset, { | ||
sender: SENDER, | ||
store: nodeId, | ||
data: nodeId | ||
}) | ||
} | ||
] | ||
}); | ||
} | ||
api.addTimelineLayer({ | ||
label, | ||
color, | ||
id: DEVTOOLS_ID, | ||
skipScreenshots: true | ||
}); | ||
api.on.getInspectorTree(inspectorTreeHook); | ||
api.on.getInspectorState(inspectorStateHook); | ||
api.on.editInspectorState(inspectorEditHook); | ||
eventBus.on(import_core.EVENTS.mutation.success, successMutationHook); | ||
eventBus.on(import_core.EVENTS.mutation.error, errorMutationHook); | ||
eventBus.on(import_core.EVENTS.devtools.update, () => { | ||
api.sendInspectorTree(DEVTOOLS_ID); | ||
api.sendInspectorState(DEVTOOLS_ID); | ||
}); | ||
}); | ||
}; | ||
@@ -238,0 +234,0 @@ } |
{ | ||
"name": "@harlem/plugin-devtools", | ||
"amdName": "harlemDevtools", | ||
"version": "2.4.0-beta.7", | ||
"version": "2.4.0-beta.8", | ||
"license": "MIT", | ||
@@ -47,9 +47,9 @@ "author": "Andrew Courtice <andrewcourtice@users.noreply.github.com>", | ||
"dependencies": { | ||
"@harlem/utilities": "^2.4.0-beta.7", | ||
"@harlem/utilities": "^2.4.0-beta.8", | ||
"@vue/devtools-api": "^6.4.5" | ||
}, | ||
"devDependencies": { | ||
"@harlem/core": "^2.4.0-beta.7" | ||
"@harlem/core": "^2.4.0-beta.8" | ||
}, | ||
"gitHead": "f14a7a90cc1fd3c9158030b74fdc44e0ae2ea94f" | ||
"gitHead": "1dcd57c16cb6561cfcf11729d614eeae17d00c26" | ||
} |
107
src/index.ts
@@ -11,3 +11,2 @@ import { | ||
EVENTS, | ||
INTERNAL, | ||
RegistrationValueProducer, | ||
@@ -18,6 +17,2 @@ TriggerEventData, | ||
import { | ||
objectOmit, | ||
} from '@harlem/utilities'; | ||
import { | ||
PluginDescriptor, | ||
@@ -105,3 +100,3 @@ setupDevtoolsPlugin, | ||
key: store.name, | ||
value: objectOmit(store.state, INTERNAL.pattern), | ||
value: store.state, | ||
editable: true, | ||
@@ -213,3 +208,3 @@ objectType: 'reactive', | ||
export default function createDevtoolsPlugin(options: Partial<Options> = OPTIONS): HarlemPlugin { | ||
export default function createDevtoolsPlugin(options?: Partial<Options>): HarlemPlugin { | ||
const { | ||
@@ -223,65 +218,59 @@ label, | ||
return { | ||
return (app, eventBus, stores) => { | ||
const inspectorTreeHook = getInspectorTreeHook(app, stores); | ||
const inspectorStateHook = getInspectorStateHook(app, stores); | ||
const inspectorEditHook = getInspectorEditHook(app, stores); | ||
name: 'devtools', | ||
const descriptor = { | ||
app, | ||
label, | ||
id: DEVTOOLS_ID, | ||
logo: 'https://harlemjs.com/assets/images/favicon.png', | ||
homepage: 'https://harlemjs.com', | ||
packageName: '@harlem/plugin-devtools', | ||
} as PluginDescriptor; | ||
install(app, eventEmitter, stores) { | ||
const inspectorTreeHook = getInspectorTreeHook(app, stores); | ||
const inspectorStateHook = getInspectorStateHook(app, stores); | ||
const inspectorEditHook = getInspectorEditHook(app, stores); | ||
setupDevtoolsPlugin(descriptor, api => { | ||
const successMutationHook = getMutationHook(api); | ||
const errorMutationHook = getMutationHook(api, 'error'); | ||
const descriptor = { | ||
app, | ||
api.addInspector({ | ||
label, | ||
id: DEVTOOLS_ID, | ||
logo: 'https://harlemjs.com/assets/images/favicon.png', | ||
homepage: 'https://harlemjs.com', | ||
packageName: '@harlem/plugin-devtools', | ||
} as PluginDescriptor; | ||
icon: 'source', | ||
treeFilterPlaceholder: 'Search stores', | ||
stateFilterPlaceholder: 'Search state', | ||
nodeActions: [ | ||
{ | ||
icon: 'replay', | ||
tooltip: 'Reset store', | ||
action: nodeId => eventBus.emit(EVENTS.devtools.reset, { | ||
sender: SENDER, | ||
store: nodeId, | ||
data: nodeId, | ||
}), | ||
}, | ||
], | ||
}); | ||
setupDevtoolsPlugin(descriptor, api => { | ||
const successMutationHook = getMutationHook(api); | ||
const errorMutationHook = getMutationHook(api, 'error'); | ||
api.addTimelineLayer({ | ||
label, | ||
color, | ||
id: DEVTOOLS_ID, | ||
skipScreenshots: true, | ||
}); | ||
api.addInspector({ | ||
label, | ||
id: DEVTOOLS_ID, | ||
icon: 'source', | ||
treeFilterPlaceholder: 'Search stores', | ||
stateFilterPlaceholder: 'Search state', | ||
nodeActions: [ | ||
{ | ||
icon: 'replay', | ||
tooltip: 'Reset store', | ||
action: nodeId => eventEmitter.emit(EVENTS.devtools.reset, { | ||
sender: SENDER, | ||
store: nodeId, | ||
data: nodeId, | ||
}), | ||
}, | ||
], | ||
}); | ||
api.on.getInspectorTree(inspectorTreeHook); | ||
api.on.getInspectorState(inspectorStateHook); | ||
api.on.editInspectorState(inspectorEditHook); | ||
api.addTimelineLayer({ | ||
label, | ||
color, | ||
id: DEVTOOLS_ID, | ||
skipScreenshots: true, | ||
}); | ||
eventBus.on(EVENTS.mutation.success, successMutationHook); | ||
eventBus.on(EVENTS.mutation.error, errorMutationHook); | ||
api.on.getInspectorTree(inspectorTreeHook); | ||
api.on.getInspectorState(inspectorStateHook); | ||
api.on.editInspectorState(inspectorEditHook); | ||
eventEmitter.on(EVENTS.mutation.success, successMutationHook); | ||
eventEmitter.on(EVENTS.mutation.error, errorMutationHook); | ||
eventEmitter.on(EVENTS.devtools.update, () => { | ||
api.sendInspectorTree(DEVTOOLS_ID); | ||
api.sendInspectorState(DEVTOOLS_ID); | ||
}); | ||
eventBus.on(EVENTS.devtools.update, () => { | ||
api.sendInspectorTree(DEVTOOLS_ID); | ||
api.sendInspectorState(DEVTOOLS_ID); | ||
}); | ||
}, | ||
}); | ||
}; | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1643156
15519