@archie/devtools 0.0.17 → 0.0.19
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/client/client.d.mts +7 -2
- package/dist/client/client.d.ts +7 -2
- package/dist/client/client.js +73 -6
- package/dist/client/client.mjs +71 -5
- package/dist/index.d.mts +28 -1
- package/dist/index.d.ts +28 -1
- package/dist/index.js +4 -2
- package/dist/index.mjs +2 -1
- package/dist/inspector.standalone.js +3567 -0
- package/package.json +3 -2
package/dist/client/client.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
/** Only configured domains (Archie host origins) and optionally localhost in dev. "*" is never used. */
|
|
5
5
|
type InjectOptions = {
|
|
@@ -82,4 +82,9 @@ interface ArchieDevToolProviderProps extends ArchieDevToolsRuntimeOptions {
|
|
|
82
82
|
}
|
|
83
83
|
declare function ArchieDevToolProvider({ children, router, inspector, inspectorOptions, }: ArchieDevToolProviderProps): react_jsx_runtime.JSX.Element;
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
interface DndProviderProps {
|
|
86
|
+
children: React.ReactNode;
|
|
87
|
+
}
|
|
88
|
+
declare function DndProvider({ children }: DndProviderProps): react_jsx_runtime.JSX.Element;
|
|
89
|
+
|
|
90
|
+
export { ArchieDevToolProvider, type ArchieDevToolProviderProps, DndProvider };
|
package/dist/client/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { ReactNode } from 'react';
|
|
2
|
+
import React, { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
/** Only configured domains (Archie host origins) and optionally localhost in dev. "*" is never used. */
|
|
5
5
|
type InjectOptions = {
|
|
@@ -82,4 +82,9 @@ interface ArchieDevToolProviderProps extends ArchieDevToolsRuntimeOptions {
|
|
|
82
82
|
}
|
|
83
83
|
declare function ArchieDevToolProvider({ children, router, inspector, inspectorOptions, }: ArchieDevToolProviderProps): react_jsx_runtime.JSX.Element;
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
interface DndProviderProps {
|
|
86
|
+
children: React.ReactNode;
|
|
87
|
+
}
|
|
88
|
+
declare function DndProvider({ children }: DndProviderProps): react_jsx_runtime.JSX.Element;
|
|
89
|
+
|
|
90
|
+
export { ArchieDevToolProvider, type ArchieDevToolProviderProps, DndProvider };
|
package/dist/client/client.js
CHANGED
|
@@ -32,7 +32,8 @@ var __publicField = (obj, key2, value) => __defNormalProp(obj, typeof key2 !== "
|
|
|
32
32
|
// src/client/client.ts
|
|
33
33
|
var client_exports = {};
|
|
34
34
|
__export(client_exports, {
|
|
35
|
-
ArchieDevToolProvider: () => ArchieDevToolProvider
|
|
35
|
+
ArchieDevToolProvider: () => ArchieDevToolProvider,
|
|
36
|
+
DndProvider: () => DndProvider
|
|
36
37
|
});
|
|
37
38
|
module.exports = __toCommonJS(client_exports);
|
|
38
39
|
|
|
@@ -4278,6 +4279,32 @@ function getEditorMeta(el) {
|
|
|
4278
4279
|
}
|
|
4279
4280
|
return writeFiberAwareCache(metaCache, el, selection, null);
|
|
4280
4281
|
}
|
|
4282
|
+
function getEditorMetaOwnerFiber(el) {
|
|
4283
|
+
const selection = getFiberSelectionFromElement(el);
|
|
4284
|
+
let fiber = selection.fiber;
|
|
4285
|
+
while (fiber) {
|
|
4286
|
+
if (fiber.memoizedProps?.__editorMeta) return fiber;
|
|
4287
|
+
fiber = fiber.return;
|
|
4288
|
+
}
|
|
4289
|
+
return null;
|
|
4290
|
+
}
|
|
4291
|
+
function getSingleHostElement(owner) {
|
|
4292
|
+
const hosts = [];
|
|
4293
|
+
const stack = owner?.child ? [owner.child] : [];
|
|
4294
|
+
while (stack.length > 0) {
|
|
4295
|
+
const fiber = stack.pop();
|
|
4296
|
+
if (!fiber) continue;
|
|
4297
|
+
if (fiber.tag === 4) return null;
|
|
4298
|
+
if (typeof fiber.type === "string" && fiber.stateNode instanceof HTMLElement) {
|
|
4299
|
+
hosts.push(fiber.stateNode);
|
|
4300
|
+
if (hosts.length > 1) return null;
|
|
4301
|
+
} else if (fiber.child) {
|
|
4302
|
+
stack.push(fiber.child);
|
|
4303
|
+
}
|
|
4304
|
+
if (fiber.sibling) stack.push(fiber.sibling);
|
|
4305
|
+
}
|
|
4306
|
+
return hosts.length === 1 ? hosts[0] : null;
|
|
4307
|
+
}
|
|
4281
4308
|
function findMetaOwnerElement(el) {
|
|
4282
4309
|
let current = el;
|
|
4283
4310
|
while (current) {
|
|
@@ -4901,8 +4928,11 @@ var LARGE_NODE_NEST_BLOCK_MIN_WIDTH = 520;
|
|
|
4901
4928
|
var LARGE_NODE_NEST_BLOCK_MIN_HEIGHT = 260;
|
|
4902
4929
|
var LARGE_NODE_NEST_BLOCK_MIN_AREA = 18e4;
|
|
4903
4930
|
function isEligibleForDrag(sc) {
|
|
4931
|
+
if (sc.draggable === false) return false;
|
|
4904
4932
|
const source = sc.eligibilitySource ?? "editor-meta";
|
|
4905
|
-
return source === "editor-meta" || source === "force-allow" || source === "inferred-sortable-descendant"
|
|
4933
|
+
return source === "editor-meta" || source === "force-allow" || source === "inferred-sortable-descendant" || // RFC E2.4 P1: single host root of a kit-component usage (MetricCard,
|
|
4934
|
+
// Section, …) carrying the usage's projected meta.
|
|
4935
|
+
source === "projected-usage";
|
|
4906
4936
|
}
|
|
4907
4937
|
function isPointerInEdgeZone(px, py, guard) {
|
|
4908
4938
|
return px <= guard || py <= guard || px >= window.innerWidth - guard || py >= window.innerHeight - guard;
|
|
@@ -5024,6 +5054,13 @@ function isInspectorEligible(el) {
|
|
|
5024
5054
|
if (el.hasAttribute("data-dnd-force-allow")) return "force-allow";
|
|
5025
5055
|
return null;
|
|
5026
5056
|
}
|
|
5057
|
+
function projectUsageMeta(el) {
|
|
5058
|
+
if (getDirectEditorMeta(el)) return null;
|
|
5059
|
+
const owner = getEditorMetaOwnerFiber(el);
|
|
5060
|
+
if (!owner) return null;
|
|
5061
|
+
if (getSingleHostElement(owner) !== el) return null;
|
|
5062
|
+
return owner.memoizedProps?.__editorMeta ?? null;
|
|
5063
|
+
}
|
|
5027
5064
|
function isRuntimeVisualInternal(el) {
|
|
5028
5065
|
if (shouldIgnoreAsVirtualRuntime(el)) return true;
|
|
5029
5066
|
const tag = el.tagName.toLowerCase();
|
|
@@ -5055,6 +5092,8 @@ function resolveStableNodeId(el, used) {
|
|
|
5055
5092
|
if (persisted && !used.has(persisted)) return persisted;
|
|
5056
5093
|
const metaId = getEditorMetaNodeId(el);
|
|
5057
5094
|
if (metaId) return ensureUniqueNodeId(metaId, used);
|
|
5095
|
+
const projected = projectUsageMeta(el);
|
|
5096
|
+
if (projected) return ensureUniqueNodeId(projected.nodeId, used);
|
|
5058
5097
|
return ensureUniqueNodeId(getRuntimeNodeId(el), used);
|
|
5059
5098
|
}
|
|
5060
5099
|
function getUniqueSelector(el) {
|
|
@@ -5146,9 +5185,31 @@ function scanElements(root, depth = 0, usedNodeIds = /* @__PURE__ */ new Set(),
|
|
|
5146
5185
|
continue;
|
|
5147
5186
|
}
|
|
5148
5187
|
const eligibilitySource = isInspectorEligible(el);
|
|
5149
|
-
const inferredEligibility = eligibilitySource ?? inferEligibilityFromSortableParent(el);
|
|
5188
|
+
const inferredEligibility = eligibilitySource ?? inferEligibilityFromSortableParent(el) ?? (projectUsageMeta(el) ? "projected-usage" : null);
|
|
5150
5189
|
if (inferredEligibility === null) {
|
|
5151
|
-
|
|
5190
|
+
const childResults = scanElements(el, depth + 1, usedNodeIds, seenResolvedHosts);
|
|
5191
|
+
results.push(...childResults);
|
|
5192
|
+
if (isFlexOrGridParent(el) && !seenResolvedHosts.has(el) && childResults.some((r) => r.draggable && r.element.parentElement === el)) {
|
|
5193
|
+
const nodeId2 = resolveStableNodeId(el, usedNodeIds);
|
|
5194
|
+
seenResolvedHosts.add(el);
|
|
5195
|
+
usedNodeIds.add(nodeId2);
|
|
5196
|
+
el.setAttribute(DND_NODE_ID_ATTR, nodeId2);
|
|
5197
|
+
const selector = getUniqueSelector(el);
|
|
5198
|
+
results.push({
|
|
5199
|
+
nodeId: nodeId2,
|
|
5200
|
+
element: el,
|
|
5201
|
+
selector,
|
|
5202
|
+
sourceMetaNodeId: null,
|
|
5203
|
+
resolvedHostNodeId: nodeId2,
|
|
5204
|
+
resolvedHostSelector: selector,
|
|
5205
|
+
resolutionKind: "direct-host",
|
|
5206
|
+
label: getLabel(el),
|
|
5207
|
+
rect: el.getBoundingClientRect(),
|
|
5208
|
+
containerStrategy: resolveContainerStrategy(el),
|
|
5209
|
+
eligibilitySource: "container-of-eligible",
|
|
5210
|
+
draggable: false
|
|
5211
|
+
});
|
|
5212
|
+
}
|
|
5152
5213
|
continue;
|
|
5153
5214
|
}
|
|
5154
5215
|
const dragSurface = resolveDragSurface(el);
|
|
@@ -5171,10 +5232,12 @@ function scanElements(root, depth = 0, usedNodeIds = /* @__PURE__ */ new Set(),
|
|
|
5171
5232
|
const surfaceMeta = hostEl instanceof HTMLElement ? getDirectEditorMeta(hostEl) ?? void 0 : void 0;
|
|
5172
5233
|
const ownerMeta = dragSurface.metaOwner && dragSurface.metaOwner instanceof HTMLElement ? getEditorMeta(dragSurface.metaOwner) : null;
|
|
5173
5234
|
const resolvedSelector = getUniqueSelector(hostEl);
|
|
5235
|
+
const draggable = inferredEligibility === "force-allow" || !nodeId.startsWith("runtime:");
|
|
5174
5236
|
results.push({
|
|
5175
5237
|
nodeId,
|
|
5176
5238
|
element: hostEl,
|
|
5177
5239
|
selector: resolvedSelector,
|
|
5240
|
+
draggable,
|
|
5178
5241
|
sourceMetaNodeId: ownerMeta?.nodeId ?? surfaceMeta?.nodeId ?? null,
|
|
5179
5242
|
resolvedHostNodeId: nodeId,
|
|
5180
5243
|
resolvedHostSelector: resolvedSelector,
|
|
@@ -5221,6 +5284,7 @@ function useElementScanner(enabled) {
|
|
|
5221
5284
|
nodeId,
|
|
5222
5285
|
element: el,
|
|
5223
5286
|
selector,
|
|
5287
|
+
draggable: !nodeId.startsWith("runtime:"),
|
|
5224
5288
|
sourceMetaNodeId: ownerMeta?.nodeId ?? surfaceMeta?.nodeId ?? null,
|
|
5225
5289
|
resolvedHostNodeId: nodeId,
|
|
5226
5290
|
resolvedHostSelector: selector,
|
|
@@ -8660,7 +8724,9 @@ function DesignModeOverlay() {
|
|
|
8660
8724
|
const draggableElements = (0, import_react17.useMemo)(() => {
|
|
8661
8725
|
if (elements.length === 0) return [];
|
|
8662
8726
|
const projection = buildProjection(elements);
|
|
8663
|
-
return collectDraggableAnchors(elements, projection, nodeMap)
|
|
8727
|
+
return collectDraggableAnchors(elements, projection, nodeMap).filter(
|
|
8728
|
+
(el) => el.draggable !== false
|
|
8729
|
+
);
|
|
8664
8730
|
}, [elements, nodeMap]);
|
|
8665
8731
|
const refs = useOverlayRefs(undoRequestId, redoRequestId);
|
|
8666
8732
|
refs.elementsRef.current = elements;
|
|
@@ -9368,5 +9434,6 @@ function ArchieDevToolProvider({
|
|
|
9368
9434
|
}
|
|
9369
9435
|
// Annotate the CommonJS export names for ESM import in node:
|
|
9370
9436
|
0 && (module.exports = {
|
|
9371
|
-
ArchieDevToolProvider
|
|
9437
|
+
ArchieDevToolProvider,
|
|
9438
|
+
DndProvider
|
|
9372
9439
|
});
|
package/dist/client/client.mjs
CHANGED
|
@@ -4244,6 +4244,32 @@ function getEditorMeta(el) {
|
|
|
4244
4244
|
}
|
|
4245
4245
|
return writeFiberAwareCache(metaCache, el, selection, null);
|
|
4246
4246
|
}
|
|
4247
|
+
function getEditorMetaOwnerFiber(el) {
|
|
4248
|
+
const selection = getFiberSelectionFromElement(el);
|
|
4249
|
+
let fiber = selection.fiber;
|
|
4250
|
+
while (fiber) {
|
|
4251
|
+
if (fiber.memoizedProps?.__editorMeta) return fiber;
|
|
4252
|
+
fiber = fiber.return;
|
|
4253
|
+
}
|
|
4254
|
+
return null;
|
|
4255
|
+
}
|
|
4256
|
+
function getSingleHostElement(owner) {
|
|
4257
|
+
const hosts = [];
|
|
4258
|
+
const stack = owner?.child ? [owner.child] : [];
|
|
4259
|
+
while (stack.length > 0) {
|
|
4260
|
+
const fiber = stack.pop();
|
|
4261
|
+
if (!fiber) continue;
|
|
4262
|
+
if (fiber.tag === 4) return null;
|
|
4263
|
+
if (typeof fiber.type === "string" && fiber.stateNode instanceof HTMLElement) {
|
|
4264
|
+
hosts.push(fiber.stateNode);
|
|
4265
|
+
if (hosts.length > 1) return null;
|
|
4266
|
+
} else if (fiber.child) {
|
|
4267
|
+
stack.push(fiber.child);
|
|
4268
|
+
}
|
|
4269
|
+
if (fiber.sibling) stack.push(fiber.sibling);
|
|
4270
|
+
}
|
|
4271
|
+
return hosts.length === 1 ? hosts[0] : null;
|
|
4272
|
+
}
|
|
4247
4273
|
function findMetaOwnerElement(el) {
|
|
4248
4274
|
let current = el;
|
|
4249
4275
|
while (current) {
|
|
@@ -4867,8 +4893,11 @@ var LARGE_NODE_NEST_BLOCK_MIN_WIDTH = 520;
|
|
|
4867
4893
|
var LARGE_NODE_NEST_BLOCK_MIN_HEIGHT = 260;
|
|
4868
4894
|
var LARGE_NODE_NEST_BLOCK_MIN_AREA = 18e4;
|
|
4869
4895
|
function isEligibleForDrag(sc) {
|
|
4896
|
+
if (sc.draggable === false) return false;
|
|
4870
4897
|
const source = sc.eligibilitySource ?? "editor-meta";
|
|
4871
|
-
return source === "editor-meta" || source === "force-allow" || source === "inferred-sortable-descendant"
|
|
4898
|
+
return source === "editor-meta" || source === "force-allow" || source === "inferred-sortable-descendant" || // RFC E2.4 P1: single host root of a kit-component usage (MetricCard,
|
|
4899
|
+
// Section, …) carrying the usage's projected meta.
|
|
4900
|
+
source === "projected-usage";
|
|
4872
4901
|
}
|
|
4873
4902
|
function isPointerInEdgeZone(px, py, guard) {
|
|
4874
4903
|
return px <= guard || py <= guard || px >= window.innerWidth - guard || py >= window.innerHeight - guard;
|
|
@@ -4990,6 +5019,13 @@ function isInspectorEligible(el) {
|
|
|
4990
5019
|
if (el.hasAttribute("data-dnd-force-allow")) return "force-allow";
|
|
4991
5020
|
return null;
|
|
4992
5021
|
}
|
|
5022
|
+
function projectUsageMeta(el) {
|
|
5023
|
+
if (getDirectEditorMeta(el)) return null;
|
|
5024
|
+
const owner = getEditorMetaOwnerFiber(el);
|
|
5025
|
+
if (!owner) return null;
|
|
5026
|
+
if (getSingleHostElement(owner) !== el) return null;
|
|
5027
|
+
return owner.memoizedProps?.__editorMeta ?? null;
|
|
5028
|
+
}
|
|
4993
5029
|
function isRuntimeVisualInternal(el) {
|
|
4994
5030
|
if (shouldIgnoreAsVirtualRuntime(el)) return true;
|
|
4995
5031
|
const tag = el.tagName.toLowerCase();
|
|
@@ -5021,6 +5057,8 @@ function resolveStableNodeId(el, used) {
|
|
|
5021
5057
|
if (persisted && !used.has(persisted)) return persisted;
|
|
5022
5058
|
const metaId = getEditorMetaNodeId(el);
|
|
5023
5059
|
if (metaId) return ensureUniqueNodeId(metaId, used);
|
|
5060
|
+
const projected = projectUsageMeta(el);
|
|
5061
|
+
if (projected) return ensureUniqueNodeId(projected.nodeId, used);
|
|
5024
5062
|
return ensureUniqueNodeId(getRuntimeNodeId(el), used);
|
|
5025
5063
|
}
|
|
5026
5064
|
function getUniqueSelector(el) {
|
|
@@ -5112,9 +5150,31 @@ function scanElements(root, depth = 0, usedNodeIds = /* @__PURE__ */ new Set(),
|
|
|
5112
5150
|
continue;
|
|
5113
5151
|
}
|
|
5114
5152
|
const eligibilitySource = isInspectorEligible(el);
|
|
5115
|
-
const inferredEligibility = eligibilitySource ?? inferEligibilityFromSortableParent(el);
|
|
5153
|
+
const inferredEligibility = eligibilitySource ?? inferEligibilityFromSortableParent(el) ?? (projectUsageMeta(el) ? "projected-usage" : null);
|
|
5116
5154
|
if (inferredEligibility === null) {
|
|
5117
|
-
|
|
5155
|
+
const childResults = scanElements(el, depth + 1, usedNodeIds, seenResolvedHosts);
|
|
5156
|
+
results.push(...childResults);
|
|
5157
|
+
if (isFlexOrGridParent(el) && !seenResolvedHosts.has(el) && childResults.some((r) => r.draggable && r.element.parentElement === el)) {
|
|
5158
|
+
const nodeId2 = resolveStableNodeId(el, usedNodeIds);
|
|
5159
|
+
seenResolvedHosts.add(el);
|
|
5160
|
+
usedNodeIds.add(nodeId2);
|
|
5161
|
+
el.setAttribute(DND_NODE_ID_ATTR, nodeId2);
|
|
5162
|
+
const selector = getUniqueSelector(el);
|
|
5163
|
+
results.push({
|
|
5164
|
+
nodeId: nodeId2,
|
|
5165
|
+
element: el,
|
|
5166
|
+
selector,
|
|
5167
|
+
sourceMetaNodeId: null,
|
|
5168
|
+
resolvedHostNodeId: nodeId2,
|
|
5169
|
+
resolvedHostSelector: selector,
|
|
5170
|
+
resolutionKind: "direct-host",
|
|
5171
|
+
label: getLabel(el),
|
|
5172
|
+
rect: el.getBoundingClientRect(),
|
|
5173
|
+
containerStrategy: resolveContainerStrategy(el),
|
|
5174
|
+
eligibilitySource: "container-of-eligible",
|
|
5175
|
+
draggable: false
|
|
5176
|
+
});
|
|
5177
|
+
}
|
|
5118
5178
|
continue;
|
|
5119
5179
|
}
|
|
5120
5180
|
const dragSurface = resolveDragSurface(el);
|
|
@@ -5137,10 +5197,12 @@ function scanElements(root, depth = 0, usedNodeIds = /* @__PURE__ */ new Set(),
|
|
|
5137
5197
|
const surfaceMeta = hostEl instanceof HTMLElement ? getDirectEditorMeta(hostEl) ?? void 0 : void 0;
|
|
5138
5198
|
const ownerMeta = dragSurface.metaOwner && dragSurface.metaOwner instanceof HTMLElement ? getEditorMeta(dragSurface.metaOwner) : null;
|
|
5139
5199
|
const resolvedSelector = getUniqueSelector(hostEl);
|
|
5200
|
+
const draggable = inferredEligibility === "force-allow" || !nodeId.startsWith("runtime:");
|
|
5140
5201
|
results.push({
|
|
5141
5202
|
nodeId,
|
|
5142
5203
|
element: hostEl,
|
|
5143
5204
|
selector: resolvedSelector,
|
|
5205
|
+
draggable,
|
|
5144
5206
|
sourceMetaNodeId: ownerMeta?.nodeId ?? surfaceMeta?.nodeId ?? null,
|
|
5145
5207
|
resolvedHostNodeId: nodeId,
|
|
5146
5208
|
resolvedHostSelector: resolvedSelector,
|
|
@@ -5187,6 +5249,7 @@ function useElementScanner(enabled) {
|
|
|
5187
5249
|
nodeId,
|
|
5188
5250
|
element: el,
|
|
5189
5251
|
selector,
|
|
5252
|
+
draggable: !nodeId.startsWith("runtime:"),
|
|
5190
5253
|
sourceMetaNodeId: ownerMeta?.nodeId ?? surfaceMeta?.nodeId ?? null,
|
|
5191
5254
|
resolvedHostNodeId: nodeId,
|
|
5192
5255
|
resolvedHostSelector: selector,
|
|
@@ -8626,7 +8689,9 @@ function DesignModeOverlay() {
|
|
|
8626
8689
|
const draggableElements = useMemo6(() => {
|
|
8627
8690
|
if (elements.length === 0) return [];
|
|
8628
8691
|
const projection = buildProjection(elements);
|
|
8629
|
-
return collectDraggableAnchors(elements, projection, nodeMap)
|
|
8692
|
+
return collectDraggableAnchors(elements, projection, nodeMap).filter(
|
|
8693
|
+
(el) => el.draggable !== false
|
|
8694
|
+
);
|
|
8630
8695
|
}, [elements, nodeMap]);
|
|
8631
8696
|
const refs = useOverlayRefs(undoRequestId, redoRequestId);
|
|
8632
8697
|
refs.elementsRef.current = elements;
|
|
@@ -9332,5 +9397,6 @@ function ArchieDevToolProvider({
|
|
|
9332
9397
|
return /* @__PURE__ */ jsx6(DndProvider, { children });
|
|
9333
9398
|
}
|
|
9334
9399
|
export {
|
|
9335
|
-
ArchieDevToolProvider
|
|
9400
|
+
ArchieDevToolProvider,
|
|
9401
|
+
DndProvider
|
|
9336
9402
|
};
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,31 @@
|
|
|
1
1
|
import { ResolvedConfig, ViteDevServer } from 'vite';
|
|
2
|
+
import { types, PluginObj } from '@babel/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* babel-plugin-editor-meta
|
|
6
|
+
*
|
|
7
|
+
* Injects `__editorMeta` prop into every JSX element at compile time.
|
|
8
|
+
* This replaces the external `@react-dev-inspector/babel-plugin` — metadata
|
|
9
|
+
* lives in React Fiber `memoizedProps` rather than DOM `data-inspector-*` attrs.
|
|
10
|
+
*
|
|
11
|
+
* The injected prop contains:
|
|
12
|
+
* nodeId, file, line, col, componentName, staticProps, movable, parentNodeId
|
|
13
|
+
*
|
|
14
|
+
* At runtime the Fiber bridge reads `memoizedProps.__editorMeta` to resolve
|
|
15
|
+
* element identity without any DOM attributes.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
interface EditorMetaPluginOptions {
|
|
19
|
+
/** Skip files matching this pattern. @default /node_modules/ */
|
|
20
|
+
fileExclude?: RegExp;
|
|
21
|
+
/** Allow instrumentation for imported components. Defaults to true for local imports. */
|
|
22
|
+
instrumentImported?: boolean;
|
|
23
|
+
/** Include exact host source refs for runtime DOM lookup. */
|
|
24
|
+
includeHostSourceRef?: boolean;
|
|
25
|
+
}
|
|
26
|
+
declare function babelPluginEditorMeta({ types: t }: {
|
|
27
|
+
types: typeof types;
|
|
28
|
+
}, opts?: EditorMetaPluginOptions): PluginObj;
|
|
2
29
|
|
|
3
30
|
interface ArchieDevToolsOptions {
|
|
4
31
|
/**
|
|
@@ -34,4 +61,4 @@ interface ArchieDevToolsPlugin {
|
|
|
34
61
|
}
|
|
35
62
|
declare function archieDevTools(options?: ArchieDevToolsOptions): ArchieDevToolsPlugin;
|
|
36
63
|
|
|
37
|
-
export { archieDevTools };
|
|
64
|
+
export { type EditorMetaPluginOptions, archieDevTools, babelPluginEditorMeta };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,31 @@
|
|
|
1
1
|
import { ResolvedConfig, ViteDevServer } from 'vite';
|
|
2
|
+
import { types, PluginObj } from '@babel/core';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* babel-plugin-editor-meta
|
|
6
|
+
*
|
|
7
|
+
* Injects `__editorMeta` prop into every JSX element at compile time.
|
|
8
|
+
* This replaces the external `@react-dev-inspector/babel-plugin` — metadata
|
|
9
|
+
* lives in React Fiber `memoizedProps` rather than DOM `data-inspector-*` attrs.
|
|
10
|
+
*
|
|
11
|
+
* The injected prop contains:
|
|
12
|
+
* nodeId, file, line, col, componentName, staticProps, movable, parentNodeId
|
|
13
|
+
*
|
|
14
|
+
* At runtime the Fiber bridge reads `memoizedProps.__editorMeta` to resolve
|
|
15
|
+
* element identity without any DOM attributes.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
interface EditorMetaPluginOptions {
|
|
19
|
+
/** Skip files matching this pattern. @default /node_modules/ */
|
|
20
|
+
fileExclude?: RegExp;
|
|
21
|
+
/** Allow instrumentation for imported components. Defaults to true for local imports. */
|
|
22
|
+
instrumentImported?: boolean;
|
|
23
|
+
/** Include exact host source refs for runtime DOM lookup. */
|
|
24
|
+
includeHostSourceRef?: boolean;
|
|
25
|
+
}
|
|
26
|
+
declare function babelPluginEditorMeta({ types: t }: {
|
|
27
|
+
types: typeof types;
|
|
28
|
+
}, opts?: EditorMetaPluginOptions): PluginObj;
|
|
2
29
|
|
|
3
30
|
interface ArchieDevToolsOptions {
|
|
4
31
|
/**
|
|
@@ -34,4 +61,4 @@ interface ArchieDevToolsPlugin {
|
|
|
34
61
|
}
|
|
35
62
|
declare function archieDevTools(options?: ArchieDevToolsOptions): ArchieDevToolsPlugin;
|
|
36
63
|
|
|
37
|
-
export { archieDevTools };
|
|
64
|
+
export { type EditorMetaPluginOptions, archieDevTools, babelPluginEditorMeta };
|
package/dist/index.js
CHANGED
|
@@ -30,7 +30,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var src_exports = {};
|
|
32
32
|
__export(src_exports, {
|
|
33
|
-
archieDevTools: () => archieDevTools
|
|
33
|
+
archieDevTools: () => archieDevTools,
|
|
34
|
+
babelPluginEditorMeta: () => babelPluginEditorMeta
|
|
34
35
|
});
|
|
35
36
|
module.exports = __toCommonJS(src_exports);
|
|
36
37
|
var import_node_fs = require("fs");
|
|
@@ -591,5 +592,6 @@ function archieDevTools(options = {}) {
|
|
|
591
592
|
}
|
|
592
593
|
// Annotate the CommonJS export names for ESM import in node:
|
|
593
594
|
0 && (module.exports = {
|
|
594
|
-
archieDevTools
|
|
595
|
+
archieDevTools,
|
|
596
|
+
babelPluginEditorMeta
|
|
595
597
|
});
|