sculpted 0.0.0 → 0.1.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/LICENSE +105 -0
- package/README.md +233 -0
- package/dist/index.d.mts +129 -0
- package/dist/index.mjs +3 -0
- package/dist/patcher-BAw2kF1Q.mjs +2594 -0
- package/dist/protocol-BJm-xGHP.mjs +54 -0
- package/dist/runtime-DwE3PVhB.d.mts +64 -0
- package/dist/runtime.d.mts +2 -0
- package/dist/runtime.mjs +613 -0
- package/dist/sourceSyntax-DanNzS7Y.d.mts +103 -0
- package/dist/types-CdByW0ji.d.mts +381 -0
- package/dist/ui.d.mts +54 -0
- package/dist/ui.mjs +11125 -0
- package/dist/vite.d.mts +85 -0
- package/dist/vite.mjs +2325 -0
- package/examples/manual-vite-preact-pandacss/README.md +75 -0
- package/examples/manual-vite-preact-pandacss/index.html +12 -0
- package/examples/manual-vite-preact-pandacss/package.json +23 -0
- package/examples/manual-vite-preact-pandacss/panda.config.ts +43 -0
- package/examples/manual-vite-preact-pandacss/pnpm-lock.yaml +3359 -0
- package/examples/manual-vite-preact-pandacss/pnpm-workspace.yaml +2 -0
- package/examples/manual-vite-preact-pandacss/postcss.config.cjs +5 -0
- package/examples/manual-vite-preact-pandacss/src/TsrxManualPanel.tsrx +47 -0
- package/examples/manual-vite-preact-pandacss/src/index.css +8 -0
- package/examples/manual-vite-preact-pandacss/src/main.style.ts +33 -0
- package/examples/manual-vite-preact-pandacss/src/main.tsx +484 -0
- package/examples/manual-vite-preact-pandacss/src/tsrx.d.ts +5 -0
- package/examples/manual-vite-preact-pandacss/tsconfig.json +21 -0
- package/examples/manual-vite-preact-pandacss/vite.config.ts +20 -0
- package/package.json +66 -8
- package/readme.md +0 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
//#region src/shared/protocol.ts
|
|
2
|
+
const PANDA_INSPECTOR_PROTOCOL_VERSION = 1;
|
|
3
|
+
const DEFAULT_MANIFEST_ENDPOINT = "/@panda-inspector/manifest";
|
|
4
|
+
const DEFAULT_EDITOR_METADATA_ENDPOINT = "/@panda-inspector/editor-metadata";
|
|
5
|
+
const DEFAULT_STYLE_MODULE_ENDPOINT = "/@panda-inspector/style-module";
|
|
6
|
+
const DEFAULT_WRITEBACK_ENDPOINT = "/@panda-inspector/writeback";
|
|
7
|
+
const DEFAULT_TOKEN_WRITEBACK_ENDPOINT = "/@panda-inspector/token-writeback";
|
|
8
|
+
const DEFAULT_OPEN_SOURCE_ENDPOINT = "/@panda-inspector/open-source";
|
|
9
|
+
const DEFAULT_EDIT_ID_ATTRIBUTE = "data-panda-edit-id";
|
|
10
|
+
const DEFAULT_SOURCE_ATTRIBUTE = "data-panda-source";
|
|
11
|
+
const DEFAULT_JSX_SOURCE_ATTRIBUTE = "data-panda-jsx-source";
|
|
12
|
+
const DEFAULT_COMPONENT_ATTRIBUTE = "data-preact-component";
|
|
13
|
+
const DEFAULT_FORCED_STATE_ATTRIBUTE = "data-panda-forced-state";
|
|
14
|
+
const DEFAULT_MARKER_CLASS_PREFIX = "__panda_i_";
|
|
15
|
+
function markerClassForEditId(editId) {
|
|
16
|
+
return `${DEFAULT_MARKER_CLASS_PREFIX}${hexEncodeURIComponent(editId)}`;
|
|
17
|
+
}
|
|
18
|
+
function editIdFromMarkerClass(className) {
|
|
19
|
+
if (!className.startsWith("__panda_i_")) return void 0;
|
|
20
|
+
const encoded = className.slice(10);
|
|
21
|
+
if (!encoded || encoded.length % 2 !== 0 || !/^[0-9a-f]+$/i.test(encoded)) return void 0;
|
|
22
|
+
try {
|
|
23
|
+
return decodeURIComponent(hexDecodeToString(encoded));
|
|
24
|
+
} catch {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function editIdsFromMarkerClassList(className) {
|
|
29
|
+
const editIds = [];
|
|
30
|
+
for (const part of className.split(/\s+/)) {
|
|
31
|
+
const editId = editIdFromMarkerClass(part);
|
|
32
|
+
if (editId) editIds.push(editId);
|
|
33
|
+
}
|
|
34
|
+
return editIds;
|
|
35
|
+
}
|
|
36
|
+
const PANDA_INSPECTOR_EVENTS = {
|
|
37
|
+
manifestUpdate: "panda-inspector:manifest-update",
|
|
38
|
+
metadataUpdate: "panda-inspector:metadata-update",
|
|
39
|
+
previewCleared: "panda-inspector:preview-cleared",
|
|
40
|
+
writebackResult: "panda-inspector:writeback-result"
|
|
41
|
+
};
|
|
42
|
+
function hexEncodeURIComponent(value) {
|
|
43
|
+
const escaped = encodeURIComponent(value);
|
|
44
|
+
let encoded = "";
|
|
45
|
+
for (let index = 0; index < escaped.length; index += 1) encoded += escaped.charCodeAt(index).toString(16).padStart(2, "0");
|
|
46
|
+
return encoded;
|
|
47
|
+
}
|
|
48
|
+
function hexDecodeToString(value) {
|
|
49
|
+
let decoded = "";
|
|
50
|
+
for (let index = 0; index < value.length; index += 2) decoded += String.fromCharCode(Number.parseInt(value.slice(index, index + 2), 16));
|
|
51
|
+
return decoded;
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { markerClassForEditId as _, DEFAULT_JSX_SOURCE_ATTRIBUTE as a, DEFAULT_OPEN_SOURCE_ENDPOINT as c, DEFAULT_TOKEN_WRITEBACK_ENDPOINT as d, DEFAULT_WRITEBACK_ENDPOINT as f, editIdsFromMarkerClassList as g, editIdFromMarkerClass as h, DEFAULT_FORCED_STATE_ATTRIBUTE as i, DEFAULT_SOURCE_ATTRIBUTE as l, PANDA_INSPECTOR_PROTOCOL_VERSION as m, DEFAULT_EDITOR_METADATA_ENDPOINT as n, DEFAULT_MANIFEST_ENDPOINT as o, PANDA_INSPECTOR_EVENTS as p, DEFAULT_EDIT_ID_ATTRIBUTE as r, DEFAULT_MARKER_CLASS_PREFIX as s, DEFAULT_COMPONENT_ATTRIBUTE as t, DEFAULT_STYLE_MODULE_ENDPOINT as u };
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { $ as StyleModuleEditRequest, C as OpenSourceLocationRequest, L as SelectedElementInfo, Q as StyleEditResponse, Z as StyleEditRequest, _ as InspectorManifest, at as TokenConfigEditResponse, g as InspectorEditorMetadata, h as InlineCssSourceCreateRequest, it as TokenConfigEditRequest, k as PreviewStyleSheet, t as ComponentStyleModuleResponse, v as InspectorManifestEntry, w as OpenSourceLocationResponse } from "./types-CdByW0ji.mjs";
|
|
2
|
+
|
|
3
|
+
//#region src/runtime.d.ts
|
|
4
|
+
type RuntimeInspectorOptions = {
|
|
5
|
+
readonly globalName?: string;
|
|
6
|
+
readonly manifestEndpoint?: string;
|
|
7
|
+
readonly editorMetadataEndpoint?: string;
|
|
8
|
+
readonly writebackEndpoint?: string;
|
|
9
|
+
readonly tokenWritebackEndpoint?: string;
|
|
10
|
+
readonly openSourceEndpoint?: string;
|
|
11
|
+
readonly styleModuleEndpoint?: string;
|
|
12
|
+
readonly attributes?: {
|
|
13
|
+
readonly editId?: string;
|
|
14
|
+
readonly source?: string;
|
|
15
|
+
readonly jsxSource?: string;
|
|
16
|
+
readonly component?: string;
|
|
17
|
+
readonly forcedState?: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
type RuntimeEnvironment = {
|
|
21
|
+
readonly window: Window;
|
|
22
|
+
readonly document: Document;
|
|
23
|
+
readonly fetch: typeof fetch;
|
|
24
|
+
};
|
|
25
|
+
declare class PandaRuntimeInspector {
|
|
26
|
+
#private;
|
|
27
|
+
readonly version = 1;
|
|
28
|
+
readonly manifestEndpoint: string;
|
|
29
|
+
readonly editorMetadataEndpoint: string;
|
|
30
|
+
readonly writebackEndpoint: string;
|
|
31
|
+
readonly tokenWritebackEndpoint: string;
|
|
32
|
+
readonly openSourceEndpoint: string;
|
|
33
|
+
readonly styleModuleEndpoint: string;
|
|
34
|
+
constructor(options?: RuntimeInspectorOptions, environment?: RuntimeEnvironment);
|
|
35
|
+
loadManifest(): Promise<InspectorManifest>;
|
|
36
|
+
getManifest(): Promise<InspectorManifest>;
|
|
37
|
+
loadEditorMetadata(): Promise<InspectorEditorMetadata>;
|
|
38
|
+
getEditorMetadata(): Promise<InspectorEditorMetadata>;
|
|
39
|
+
getEntry(id: string): InspectorManifestEntry | undefined;
|
|
40
|
+
requestStyleEdit(request: StyleEditRequest, write: boolean): Promise<StyleEditResponse>;
|
|
41
|
+
requestStyleEditBatch(requests: readonly StyleEditRequest[], write: boolean): Promise<readonly StyleEditResponse[]>;
|
|
42
|
+
requestInlineCssSource(request: InlineCssSourceCreateRequest, write: boolean): Promise<StyleEditResponse>;
|
|
43
|
+
getComponentStyleModule(componentSource: string): Promise<ComponentStyleModuleResponse>;
|
|
44
|
+
requestStyleModuleEdit(request: StyleModuleEditRequest, write: boolean): Promise<StyleEditResponse>;
|
|
45
|
+
requestTokenConfigEdit(request: TokenConfigEditRequest, write: boolean): Promise<TokenConfigEditResponse>;
|
|
46
|
+
openSourceLocation(request: OpenSourceLocationRequest): Promise<OpenSourceLocationResponse>;
|
|
47
|
+
selectElement(element: Element): Promise<SelectedElementInfo>;
|
|
48
|
+
startInspecting(onSelect?: (info: SelectedElementInfo, element: Element) => void, onStop?: () => void): () => void;
|
|
49
|
+
stopInspecting(): void;
|
|
50
|
+
highlightElement(element: Element): void;
|
|
51
|
+
highlightElements(elements: readonly Element[]): void;
|
|
52
|
+
highlightSourceTarget(editId: string): void;
|
|
53
|
+
sourceTargetElements(editId: string): readonly Element[];
|
|
54
|
+
clearHighlight(): void;
|
|
55
|
+
applyForcedStates(element: Element | undefined, states: readonly string[]): void;
|
|
56
|
+
clearForcedStates(): void;
|
|
57
|
+
metadataBackedElementFromPoint(x: number, y: number): Element | undefined;
|
|
58
|
+
inspectableElementFromPoint(x: number, y: number): Element | undefined;
|
|
59
|
+
applyPreview(preview: PreviewStyleSheet): void;
|
|
60
|
+
clearPreview(): void;
|
|
61
|
+
}
|
|
62
|
+
declare function installPandaInspectorRuntime(options?: RuntimeInspectorOptions): PandaRuntimeInspector;
|
|
63
|
+
//#endregion
|
|
64
|
+
export { installPandaInspectorRuntime as i, RuntimeEnvironment as n, RuntimeInspectorOptions as r, PandaRuntimeInspector as t };
|