sculpted 0.2.3 → 0.3.1

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/README.md CHANGED
@@ -76,6 +76,10 @@ routes for supported saves.
76
76
  In production builds, the plugin is dark: no runtime script is injected, no inspector metadata is
77
77
  added, and no manifest or writeback route is registered.
78
78
 
79
+ React Router 7 framework-mode apps need one extra development-only runtime script in the root
80
+ document because React Router renders HTML outside Vite's `index.html` transform. See
81
+ [React Router 7 framework mode](docs/vite-plugin.md#react-router-7-framework-mode).
82
+
79
83
  See [Vite plugin options](docs/vite-plugin.md) for the full option surface, defaults, and endpoint
80
84
  configuration.
81
85
 
@@ -113,13 +117,10 @@ instead of pretending the full cascade can be edited safely.
113
117
 
114
118
  ## Documentation
115
119
 
116
- - [Vite plugin options](docs/vite-plugin.md) covers setup, defaults, endpoint configuration, and
117
- dev/prod behavior.
120
+ - [Vite plugin options](docs/vite-plugin.md) covers setup, defaults, and dev/prod behavior.
118
121
  - [Source writeback](docs/source-writeback.md) covers the safety model, supported edit shapes, and
119
122
  common failure modes.
120
- - [Source syntax adapters](docs/source-syntax-adapters.md) covers TSRX and custom parser adapters.
121
- - [Example apps](docs/examples.md) covers the React and Preact Panda CSS examples used for manual
122
- verification.
123
+ - [Source syntax adapters](docs/source-syntax-adapters.md) covers opt-in TSRX support.
123
124
 
124
125
  ## Troubleshooting
125
126
 
@@ -129,6 +130,8 @@ No editable entries appear:
129
130
  - Confirm the file is included by the plugin `include` patterns.
130
131
  - Confirm the element uses a local static `css({ ... })` object literal imported from your Panda
131
132
  `styled-system/css` path.
133
+ - In React Router 7 framework mode, confirm the root document includes the development-only
134
+ `/@sculpted/runtime` script.
132
135
  - Open `/@sculpted/manifest` while the dev server is running and check whether entries exist.
133
136
 
134
137
  The inspector shows a target as read-only:
@@ -136,7 +139,7 @@ The inspector shows a target as read-only:
136
139
  - Check for variable style objects, object spreads, computed keys, dynamic values, recipes, patterns,
137
140
  `cva()`, or JSX style props.
138
141
  - For TSRX, check that the file uses supported TSRX component syntax and that
139
- `tsrxSourceParserAdapter` is configured.
142
+ `sourceSyntax` from `sculpted/tsrx` is configured.
140
143
 
141
144
  Save fails:
142
145
 
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { $ as StyleModuleEditRequest, A as RuntimeAttribute, B as SourcePosition, C as OpenSourceLocationRequest, D as PreviewStyleCondition, E as PandaStyleObject, F as RuntimePropertyContext, G as StyleEdit, H as SourceTarget, I as RuntimeStyleEvidence, J as StyleEditError, K as StyleEditBatchRequest, L as SelectedElementInfo, M as RuntimeComponentLayerElement, N as RuntimeCssDeclaration, O as PreviewStyleRule, P as RuntimeElementBounds, Q as StyleEditResponse, R as SelectedElementState, S as OpenSourceLocationErrorCode, T as PandaCssSourceTarget, U as SourceTargetBase, V as SourceRange, W as SourceTargetKind, X as StyleEditOptions, Y as StyleEditErrorCode, Z as StyleEditRequest, _ as InspectorManifest, a as EditorColorTokenMetadata, at as TokenConfigEditResponse, b as JsonValue, c as EditorMetadataUnavailableReason, d as EditorPropertyMetadata, et as StyleModuleSourceAttachRequest, f as EditorTokenSourceSection, g as InspectorEditorMetadata, h as InlineCssSourceCreateRequest, i as DynamicSourceTarget, it as TokenConfigEditRequest, j as RuntimeComponentLayer, k as PreviewStyleSheet, l as EditorMetadataUpdateEvent, m as ExternalSourceTarget, n as ComponentStyleModuleSource, nt as StyleModuleSourceDetachRequest, o as EditorFontTokenMetadata, ot as UnsupportedReason, p as EditorTokenSourceTarget, q as StyleEditBatchResponse, r as Confidence, rt as StyleValueSource, s as EditorMetadataSection, st as UnsupportedSourceTarget, t as ComponentStyleModuleResponse, tt as StyleModuleSourceCreateRequest, u as EditorPropertyCategory, v as InspectorManifestEntry, w as OpenSourceLocationResponse, x as ManifestUpdateEvent, y as JsonPrimitive, z as SourceLocation } from "./types-CdByW0ji.mjs";
2
- import { _ as typescriptPandaAstAdapter, a as SourceAstKind, c as SourceSyntaxAdapter, d as parsePandaSource, f as parseWithSourceParserAdapter, g as tsxSourceSyntaxAdapter, h as tsxSourceParserAdapter, i as ParsedPandaSource, l as SourceSyntaxOption, m as tsrxSourceParserAdapter, n as PandaSourceAstAdapter, o as SourceParseResult, p as resolveSourceParserAdapter, r as ParseSourceSyntaxOptions, s as SourceParserAdapter, t as EstreeNode, u as createEstreePandaAstAdapter } from "./sourceSyntax-DanNzS7Y.mjs";
2
+ import { a as SourceAstKind, c as SourceSyntaxAdapter, d as parsePandaSource, f as parseWithSourceParserAdapter, g as typescriptPandaAstAdapter, h as tsxSourceSyntaxAdapter, i as ParsedPandaSource, l as SourceSyntaxOption, m as tsxSourceParserAdapter, n as PandaSourceAstAdapter, o as SourceParseResult, p as resolveSourceParserAdapter, r as ParseSourceSyntaxOptions, s as SourceParserAdapter, t as EstreeNode, u as createEstreePandaAstAdapter } from "./sourceSyntax-U2iybN9L.mjs";
3
3
 
4
4
  //#region src/analyzer/pandaCssAnalyzer.d.ts
5
5
  type AnalyzePandaCssSourceOptions = {
@@ -126,4 +126,4 @@ declare const SCULPTED_EVENTS: {
126
126
  };
127
127
  type SculptedEventName = (typeof SCULPTED_EVENTS)[keyof typeof SCULPTED_EVENTS];
128
128
  //#endregion
129
- export { AnalyzePandaCssSourceOptions, AnalyzePandaCssSourceResult, ComponentStyleModulePaths, ComponentStyleModuleResponse, ComponentStyleModuleSource, Confidence, CreateInlineCssSourcePatchOptions, CreateStaticCssPatchOptions, CreateTokenConfigPatchOptions, DEFAULT_COMPONENT_ATTRIBUTE, DEFAULT_EDITOR_METADATA_ENDPOINT, DEFAULT_EDIT_ID_ATTRIBUTE, DEFAULT_FORCED_STATE_ATTRIBUTE, DEFAULT_JSX_SOURCE_ATTRIBUTE, DEFAULT_MANIFEST_ENDPOINT, DEFAULT_MARKER_CLASS_PREFIX, DEFAULT_OPEN_SOURCE_ENDPOINT, DEFAULT_SOURCE_ATTRIBUTE, DEFAULT_STYLE_MODULE_ENDPOINT, DEFAULT_TOKEN_WRITEBACK_ENDPOINT, DEFAULT_WRITEBACK_ENDPOINT, DynamicSourceTarget, EditorColorTokenMetadata, EditorFontTokenMetadata, EditorMetadataSection, EditorMetadataUnavailableReason, EditorMetadataUpdateEvent, EditorPropertyCategory, EditorPropertyMetadata, EditorTokenSourceSection, EditorTokenSourceTarget, EstreeNode, ExternalSourceTarget, InlineCssSourceCreateRequest, InspectorEditorMetadata, InspectorManifest, InspectorManifestEntry, JsonPrimitive, JsonValue, ManifestUpdateEvent, OpenSourceLocationErrorCode, OpenSourceLocationRequest, OpenSourceLocationResponse, PandaCssSourceTarget, PandaSourceAstAdapter, PandaStyleObject, ParseSourceSyntaxOptions, ParsedPandaSource, PreviewStyleCondition, PreviewStyleRule, PreviewStyleSheet, RuntimeAttribute, RuntimeComponentLayer, RuntimeComponentLayerElement, RuntimeCssDeclaration, RuntimeElementBounds, RuntimePropertyContext, RuntimeStyleEvidence, SCULPTED_EVENTS, SCULPTED_PROTOCOL_VERSION, SculptedEventName, SelectedElementInfo, SelectedElementState, SourceAstKind, SourceLocation, SourceParseResult, SourceParserAdapter, SourcePosition, SourceRange, SourceSyntaxAdapter, SourceSyntaxOption, SourceTarget, SourceTargetBase, SourceTargetKind, StyleEdit, StyleEditBatchRequest, StyleEditBatchResponse, StyleEditError, StyleEditErrorCode, StyleEditOptions, StyleEditRequest, StyleEditResponse, StyleModuleEditRequest, StyleModuleSourceAttachRequest, StyleModuleSourceCreateRequest, StyleModuleSourceDetachRequest, StyleValueSource, TokenConfigEditRequest, TokenConfigEditResponse, UnsupportedReason, UnsupportedSourceTarget, analyzePandaCssSource, componentStyleModulePaths, createEstreePandaAstAdapter, createInlineCssSourcePatch, createStaticCssBatchPatch, createStaticCssPatch, createStyleModuleAttachPatch, createStyleModuleDetachPatch, createStyleModuleSourcePatch, createTokenConfigPatch, editIdFromMarkerClass, editIdsFromMarkerClassList, hashSource, markerClassForEditId, parsePandaSource, parseWithSourceParserAdapter, readComponentStyleModule, resolveSourceParserAdapter, tsrxSourceParserAdapter, tsxSourceParserAdapter, tsxSourceSyntaxAdapter, typescriptPandaAstAdapter };
129
+ export { AnalyzePandaCssSourceOptions, AnalyzePandaCssSourceResult, ComponentStyleModulePaths, ComponentStyleModuleResponse, ComponentStyleModuleSource, Confidence, CreateInlineCssSourcePatchOptions, CreateStaticCssPatchOptions, CreateTokenConfigPatchOptions, DEFAULT_COMPONENT_ATTRIBUTE, DEFAULT_EDITOR_METADATA_ENDPOINT, DEFAULT_EDIT_ID_ATTRIBUTE, DEFAULT_FORCED_STATE_ATTRIBUTE, DEFAULT_JSX_SOURCE_ATTRIBUTE, DEFAULT_MANIFEST_ENDPOINT, DEFAULT_MARKER_CLASS_PREFIX, DEFAULT_OPEN_SOURCE_ENDPOINT, DEFAULT_SOURCE_ATTRIBUTE, DEFAULT_STYLE_MODULE_ENDPOINT, DEFAULT_TOKEN_WRITEBACK_ENDPOINT, DEFAULT_WRITEBACK_ENDPOINT, DynamicSourceTarget, EditorColorTokenMetadata, EditorFontTokenMetadata, EditorMetadataSection, EditorMetadataUnavailableReason, EditorMetadataUpdateEvent, EditorPropertyCategory, EditorPropertyMetadata, EditorTokenSourceSection, EditorTokenSourceTarget, EstreeNode, ExternalSourceTarget, InlineCssSourceCreateRequest, InspectorEditorMetadata, InspectorManifest, InspectorManifestEntry, JsonPrimitive, JsonValue, ManifestUpdateEvent, OpenSourceLocationErrorCode, OpenSourceLocationRequest, OpenSourceLocationResponse, PandaCssSourceTarget, PandaSourceAstAdapter, PandaStyleObject, ParseSourceSyntaxOptions, ParsedPandaSource, PreviewStyleCondition, PreviewStyleRule, PreviewStyleSheet, RuntimeAttribute, RuntimeComponentLayer, RuntimeComponentLayerElement, RuntimeCssDeclaration, RuntimeElementBounds, RuntimePropertyContext, RuntimeStyleEvidence, SCULPTED_EVENTS, SCULPTED_PROTOCOL_VERSION, SculptedEventName, SelectedElementInfo, SelectedElementState, SourceAstKind, SourceLocation, SourceParseResult, SourceParserAdapter, SourcePosition, SourceRange, SourceSyntaxAdapter, SourceSyntaxOption, SourceTarget, SourceTargetBase, SourceTargetKind, StyleEdit, StyleEditBatchRequest, StyleEditBatchResponse, StyleEditError, StyleEditErrorCode, StyleEditOptions, StyleEditRequest, StyleEditResponse, StyleModuleEditRequest, StyleModuleSourceAttachRequest, StyleModuleSourceCreateRequest, StyleModuleSourceDetachRequest, StyleValueSource, TokenConfigEditRequest, TokenConfigEditResponse, UnsupportedReason, UnsupportedSourceTarget, analyzePandaCssSource, componentStyleModulePaths, createEstreePandaAstAdapter, createInlineCssSourcePatch, createStaticCssBatchPatch, createStaticCssPatch, createStyleModuleAttachPatch, createStyleModuleDetachPatch, createStyleModuleSourcePatch, createTokenConfigPatch, editIdFromMarkerClass, editIdsFromMarkerClassList, hashSource, markerClassForEditId, parsePandaSource, parseWithSourceParserAdapter, readComponentStyleModule, resolveSourceParserAdapter, tsxSourceParserAdapter, tsxSourceSyntaxAdapter, typescriptPandaAstAdapter };
package/dist/index.mjs CHANGED
@@ -1,3 +1,3 @@
1
1
  import { _ as markerClassForEditId, a as DEFAULT_JSX_SOURCE_ATTRIBUTE, c as DEFAULT_OPEN_SOURCE_ENDPOINT, d as DEFAULT_TOKEN_WRITEBACK_ENDPOINT, f as DEFAULT_WRITEBACK_ENDPOINT, g as editIdsFromMarkerClassList, h as editIdFromMarkerClass, i as DEFAULT_FORCED_STATE_ATTRIBUTE, l as DEFAULT_SOURCE_ATTRIBUTE, m as SCULPTED_PROTOCOL_VERSION, n as DEFAULT_EDITOR_METADATA_ENDPOINT, o as DEFAULT_MANIFEST_ENDPOINT, p as SCULPTED_EVENTS, r as DEFAULT_EDIT_ID_ATTRIBUTE, s as DEFAULT_MARKER_CLASS_PREFIX, t as DEFAULT_COMPONENT_ATTRIBUTE, u as DEFAULT_STYLE_MODULE_ENDPOINT } from "./protocol-D5heR2QM.mjs";
2
- import { C as tsrxSourceParserAdapter, E as typescriptPandaAstAdapter, S as resolveSourceParserAdapter, T as tsxSourceSyntaxAdapter, _ as analyzePandaCssSource, a as createStyleModuleSourcePatch, b as parsePandaSource, g as createInlineCssSourcePatch, h as createStaticCssPatch, i as createStyleModuleDetachPatch, m as createStaticCssBatchPatch, n as componentStyleModulePaths, o as readComponentStyleModule, r as createStyleModuleAttachPatch, t as createTokenConfigPatch, v as hashSource, w as tsxSourceParserAdapter, x as parseWithSourceParserAdapter, y as createEstreePandaAstAdapter } from "./patcher-BelI8KIj.mjs";
3
- export { DEFAULT_COMPONENT_ATTRIBUTE, DEFAULT_EDITOR_METADATA_ENDPOINT, DEFAULT_EDIT_ID_ATTRIBUTE, DEFAULT_FORCED_STATE_ATTRIBUTE, DEFAULT_JSX_SOURCE_ATTRIBUTE, DEFAULT_MANIFEST_ENDPOINT, DEFAULT_MARKER_CLASS_PREFIX, DEFAULT_OPEN_SOURCE_ENDPOINT, DEFAULT_SOURCE_ATTRIBUTE, DEFAULT_STYLE_MODULE_ENDPOINT, DEFAULT_TOKEN_WRITEBACK_ENDPOINT, DEFAULT_WRITEBACK_ENDPOINT, SCULPTED_EVENTS, SCULPTED_PROTOCOL_VERSION, analyzePandaCssSource, componentStyleModulePaths, createEstreePandaAstAdapter, createInlineCssSourcePatch, createStaticCssBatchPatch, createStaticCssPatch, createStyleModuleAttachPatch, createStyleModuleDetachPatch, createStyleModuleSourcePatch, createTokenConfigPatch, editIdFromMarkerClass, editIdsFromMarkerClassList, hashSource, markerClassForEditId, parsePandaSource, parseWithSourceParserAdapter, readComponentStyleModule, resolveSourceParserAdapter, tsrxSourceParserAdapter, tsxSourceParserAdapter, tsxSourceSyntaxAdapter, typescriptPandaAstAdapter };
2
+ import { C as tsxSourceParserAdapter, S as resolveSourceParserAdapter, T as typescriptPandaAstAdapter, _ as analyzePandaCssSource, a as createStyleModuleSourcePatch, b as parsePandaSource, g as createInlineCssSourcePatch, h as createStaticCssPatch, i as createStyleModuleDetachPatch, m as createStaticCssBatchPatch, n as componentStyleModulePaths, o as readComponentStyleModule, r as createStyleModuleAttachPatch, t as createTokenConfigPatch, v as hashSource, w as tsxSourceSyntaxAdapter, x as parseWithSourceParserAdapter, y as createEstreePandaAstAdapter } from "./patcher-DQgKdozw.mjs";
3
+ export { DEFAULT_COMPONENT_ATTRIBUTE, DEFAULT_EDITOR_METADATA_ENDPOINT, DEFAULT_EDIT_ID_ATTRIBUTE, DEFAULT_FORCED_STATE_ATTRIBUTE, DEFAULT_JSX_SOURCE_ATTRIBUTE, DEFAULT_MANIFEST_ENDPOINT, DEFAULT_MARKER_CLASS_PREFIX, DEFAULT_OPEN_SOURCE_ENDPOINT, DEFAULT_SOURCE_ATTRIBUTE, DEFAULT_STYLE_MODULE_ENDPOINT, DEFAULT_TOKEN_WRITEBACK_ENDPOINT, DEFAULT_WRITEBACK_ENDPOINT, SCULPTED_EVENTS, SCULPTED_PROTOCOL_VERSION, analyzePandaCssSource, componentStyleModulePaths, createEstreePandaAstAdapter, createInlineCssSourcePatch, createStaticCssBatchPatch, createStaticCssPatch, createStyleModuleAttachPatch, createStyleModuleDetachPatch, createStyleModuleSourcePatch, createTokenConfigPatch, editIdFromMarkerClass, editIdsFromMarkerClassList, hashSource, markerClassForEditId, parsePandaSource, parseWithSourceParserAdapter, readComponentStyleModule, resolveSourceParserAdapter, tsxSourceParserAdapter, tsxSourceSyntaxAdapter, typescriptPandaAstAdapter };
@@ -1,5 +1,4 @@
1
1
  import "./protocol-D5heR2QM.mjs";
2
- import { parseModule } from "@tsrx/core";
3
2
  import ts from "typescript";
4
3
  //#region src/sourceSyntax.ts
5
4
  function parseWithSourceParserAdapter(adapter, options) {
@@ -43,25 +42,6 @@ const tsxSourceParserAdapter = {
43
42
  }
44
43
  };
45
44
  const tsxSourceSyntaxAdapter = tsxSourceParserAdapter;
46
- const tsrxSourceParserAdapter = {
47
- languageId: "tsrx",
48
- kind: "estree",
49
- isSupportedFile(filePath) {
50
- return filePath.endsWith(".tsrx");
51
- },
52
- parse(options) {
53
- const comments = [];
54
- return {
55
- kind: "estree",
56
- languageId: "tsrx",
57
- program: parseModule(options.sourceText, options.filePath, {
58
- collect: true,
59
- comments
60
- }),
61
- comments
62
- };
63
- }
64
- };
65
45
  function scriptKindForFile(filePath) {
66
46
  if (/\.[cm]?tsx$/.test(filePath)) return ts.ScriptKind.TSX;
67
47
  if (/\.[cm]?jsx$/.test(filePath)) return ts.ScriptKind.JSX;
@@ -2611,4 +2591,4 @@ function failure(editId, code, message, details) {
2611
2591
  };
2612
2592
  }
2613
2593
  //#endregion
2614
- export { tsrxSourceParserAdapter as C, typescriptPandaAstAdapter as E, resolveSourceParserAdapter as S, tsxSourceSyntaxAdapter as T, analyzePandaCssSource as _, createStyleModuleSourcePatch as a, parsePandaSource as b, resolveProjectPath as c, toRelativeProjectPath as d, trustedManifestFilePath as f, createInlineCssSourcePatch as g, createStaticCssPatch as h, createStyleModuleDetachPatch as i, safeProjectSourcePath as l, createStaticCssBatchPatch as m, componentStyleModulePaths as n, readComponentStyleModule as o, trustedTokenSourceFilePath as p, createStyleModuleAttachPatch as r, normalizePath$2 as s, createTokenConfigPatch as t, stripViteQuery as u, hashSource as v, tsxSourceParserAdapter as w, parseWithSourceParserAdapter as x, createEstreePandaAstAdapter as y };
2594
+ export { tsxSourceParserAdapter as C, resolveSourceParserAdapter as S, typescriptPandaAstAdapter as T, analyzePandaCssSource as _, createStyleModuleSourcePatch as a, parsePandaSource as b, resolveProjectPath as c, toRelativeProjectPath as d, trustedManifestFilePath as f, createInlineCssSourcePatch as g, createStaticCssPatch as h, createStyleModuleDetachPatch as i, safeProjectSourcePath as l, createStaticCssBatchPatch as m, componentStyleModulePaths as n, readComponentStyleModule as o, trustedTokenSourceFilePath as p, createStyleModuleAttachPatch as r, normalizePath$2 as s, createTokenConfigPatch as t, stripViteQuery as u, hashSource as v, tsxSourceSyntaxAdapter as w, parseWithSourceParserAdapter as x, createEstreePandaAstAdapter as y };
@@ -96,8 +96,7 @@ declare function parsePandaSource(adapter: SourceSyntaxOption | undefined, optio
96
96
  declare function resolveSourceParserAdapter(filePath: string, adapter: SourceSyntaxOption | undefined): SourceParserAdapter;
97
97
  declare const tsxSourceParserAdapter: SourceParserAdapter;
98
98
  declare const tsxSourceSyntaxAdapter: SourceParserAdapter;
99
- declare const tsrxSourceParserAdapter: SourceParserAdapter;
100
99
  declare const typescriptPandaAstAdapter: PandaSourceAstAdapter<ts.SourceFile, ts.Node>;
101
100
  declare function createEstreePandaAstAdapter(root: EstreeNode): PandaSourceAstAdapter<EstreeNode, EstreeNode>;
102
101
  //#endregion
103
- export { typescriptPandaAstAdapter as _, SourceAstKind as a, SourceSyntaxAdapter as c, parsePandaSource as d, parseWithSourceParserAdapter as f, tsxSourceSyntaxAdapter as g, tsxSourceParserAdapter as h, ParsedPandaSource as i, SourceSyntaxOption as l, tsrxSourceParserAdapter as m, PandaSourceAstAdapter as n, SourceParseResult as o, resolveSourceParserAdapter as p, ParseSourceSyntaxOptions as r, SourceParserAdapter as s, EstreeNode as t, createEstreePandaAstAdapter as u };
102
+ export { SourceAstKind as a, SourceSyntaxAdapter as c, parsePandaSource as d, parseWithSourceParserAdapter as f, typescriptPandaAstAdapter as g, tsxSourceSyntaxAdapter as h, ParsedPandaSource as i, SourceSyntaxOption as l, tsxSourceParserAdapter as m, PandaSourceAstAdapter as n, SourceParseResult as o, resolveSourceParserAdapter as p, ParseSourceSyntaxOptions as r, SourceParserAdapter as s, EstreeNode as t, createEstreePandaAstAdapter as u };
@@ -0,0 +1,7 @@
1
+ import { s as SourceParserAdapter } from "./sourceSyntax-U2iybN9L.mjs";
2
+
3
+ //#region src/tsrx.d.ts
4
+ declare const sourceSyntax: SourceParserAdapter;
5
+ declare const tsrxSourceParserAdapter: SourceParserAdapter;
6
+ //#endregion
7
+ export { sourceSyntax, tsrxSourceParserAdapter };
package/dist/tsrx.mjs ADDED
@@ -0,0 +1,24 @@
1
+ import { parseModule } from "@tsrx/core";
2
+ //#region src/tsrx.ts
3
+ const sourceSyntax = {
4
+ languageId: "tsrx",
5
+ kind: "estree",
6
+ isSupportedFile(filePath) {
7
+ return filePath.endsWith(".tsrx");
8
+ },
9
+ parse(options) {
10
+ const comments = [];
11
+ return {
12
+ kind: "estree",
13
+ languageId: "tsrx",
14
+ program: parseModule(options.sourceText, options.filePath, {
15
+ collect: true,
16
+ comments
17
+ }),
18
+ comments
19
+ };
20
+ }
21
+ };
22
+ const tsrxSourceParserAdapter = sourceSyntax;
23
+ //#endregion
24
+ export { sourceSyntax, tsrxSourceParserAdapter };
package/dist/ui.mjs CHANGED
@@ -7935,10 +7935,6 @@ function InspectorPanel(props) {
7935
7935
  clearModifierPreview();
7936
7936
  return;
7937
7937
  }
7938
- if (isPanelEditableFocused()) {
7939
- clearModifierPreview();
7940
- return;
7941
- }
7942
7938
  setModifierPreviewCursor();
7943
7939
  hidePanelForModifierPreview();
7944
7940
  const element = inspectableElementFromPoint(runtime, event.clientX, event.clientY);
@@ -7950,6 +7946,7 @@ function InspectorPanel(props) {
7950
7946
  };
7951
7947
  const onModifierKeyDown = (event) => {
7952
7948
  if (!isOnlyShiftAlt(event)) return;
7949
+ if (event.key !== "Shift" && event.key !== "Alt") return;
7953
7950
  if (isPanelEditableFocused()) {
7954
7951
  clearModifierPreview();
7955
7952
  return;
package/dist/vite.d.mts CHANGED
@@ -1,4 +1,4 @@
1
- import { l as SourceSyntaxOption } from "./sourceSyntax-DanNzS7Y.mjs";
1
+ import { l as SourceSyntaxOption } from "./sourceSyntax-U2iybN9L.mjs";
2
2
 
3
3
  //#region src/vite/types.d.ts
4
4
  type InspectorVitePluginOptions = {
@@ -9,12 +9,8 @@ type InspectorVitePluginOptions = {
9
9
  readonly panda?: {
10
10
  readonly configPath?: string;
11
11
  readonly cssImportSources?: readonly string[];
12
- readonly recipeImportSources?: readonly string[];
13
- readonly cssFunctionNames?: readonly string[];
14
- readonly cxFunctionNames?: readonly string[];
15
12
  };
16
13
  readonly manifest?: {
17
- readonly outFile?: string;
18
14
  readonly virtualEndpoint?: string;
19
15
  };
20
16
  readonly metadata?: {
@@ -22,13 +18,6 @@ type InspectorVitePluginOptions = {
22
18
  };
23
19
  readonly runtime?: {
24
20
  readonly inject?: boolean;
25
- readonly globalName?: string;
26
- };
27
- readonly attributes?: {
28
- readonly editId?: string;
29
- readonly source?: string;
30
- readonly jsxSource?: string;
31
- readonly component?: string;
32
21
  };
33
22
  readonly sourceSyntax?: SourceSyntaxOption;
34
23
  };
package/dist/vite.mjs CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as markerClassForEditId, c as DEFAULT_OPEN_SOURCE_ENDPOINT, d as DEFAULT_TOKEN_WRITEBACK_ENDPOINT, f as DEFAULT_WRITEBACK_ENDPOINT, p as SCULPTED_EVENTS, u as DEFAULT_STYLE_MODULE_ENDPOINT } from "./protocol-D5heR2QM.mjs";
2
- import { S as resolveSourceParserAdapter, _ as analyzePandaCssSource, a as createStyleModuleSourcePatch, b as parsePandaSource, c as resolveProjectPath, d as toRelativeProjectPath$1, f as trustedManifestFilePath, g as createInlineCssSourcePatch, h as createStaticCssPatch, i as createStyleModuleDetachPatch, l as safeProjectSourcePath, m as createStaticCssBatchPatch, n as componentStyleModulePaths, o as readComponentStyleModule, p as trustedTokenSourceFilePath, r as createStyleModuleAttachPatch, s as normalizePath$1, t as createTokenConfigPatch, u as stripViteQuery, v as hashSource } from "./patcher-BelI8KIj.mjs";
1
+ import { _ as markerClassForEditId, a as DEFAULT_JSX_SOURCE_ATTRIBUTE, c as DEFAULT_OPEN_SOURCE_ENDPOINT, d as DEFAULT_TOKEN_WRITEBACK_ENDPOINT, f as DEFAULT_WRITEBACK_ENDPOINT, l as DEFAULT_SOURCE_ATTRIBUTE, p as SCULPTED_EVENTS, r as DEFAULT_EDIT_ID_ATTRIBUTE, t as DEFAULT_COMPONENT_ATTRIBUTE, u as DEFAULT_STYLE_MODULE_ENDPOINT } from "./protocol-D5heR2QM.mjs";
2
+ import { S as resolveSourceParserAdapter, _ as analyzePandaCssSource, a as createStyleModuleSourcePatch, b as parsePandaSource, c as resolveProjectPath, d as toRelativeProjectPath$1, f as trustedManifestFilePath, g as createInlineCssSourcePatch, h as createStaticCssPatch, i as createStyleModuleDetachPatch, l as safeProjectSourcePath, m as createStaticCssBatchPatch, n as componentStyleModulePaths, o as readComponentStyleModule, p as trustedTokenSourceFilePath, r as createStyleModuleAttachPatch, s as normalizePath$1, t as createTokenConfigPatch, u as stripViteQuery, v as hashSource } from "./patcher-DQgKdozw.mjs";
3
3
  import ts from "typescript";
4
4
  import { access, mkdir, readFile, writeFile } from "node:fs/promises";
5
5
  import { loadConfigAndCreateContext } from "@pandacss/node";
@@ -998,7 +998,6 @@ function registerRuntimeModuleRoutes(server, options) {
998
998
  response.end(runtimeBootstrapSource({
999
999
  manifestEndpoint: options.manifestEndpoint,
1000
1000
  editorMetadataEndpoint: options.editorMetadataEndpoint,
1001
- globalName: options.globalName,
1002
1001
  runtimeModuleEndpoint: options.runtimeModuleEndpoint,
1003
1002
  uiModuleEndpoint: options.uiModuleEndpoint
1004
1003
  }));
@@ -1084,7 +1083,6 @@ function registerRuntimeModuleRoutes(server, options) {
1084
1083
  }
1085
1084
  function runtimeBootstrapSource(options) {
1086
1085
  const runtimeOptions = JSON.stringify({
1087
- globalName: options.globalName,
1088
1086
  manifestEndpoint: options.manifestEndpoint,
1089
1087
  editorMetadataEndpoint: options.editorMetadataEndpoint
1090
1088
  });
@@ -2189,10 +2187,10 @@ function sculpted(options = {}) {
2189
2187
  const uiModuleEndpoint = DEFAULT_UI_MODULE_ENDPOINT;
2190
2188
  const runtimeChunkEndpoint = DEFAULT_RUNTIME_CHUNK_ENDPOINT;
2191
2189
  const attributes = {
2192
- editId: options.attributes?.editId ?? "data-sculpted-edit-id",
2193
- source: options.attributes?.source ?? "data-sculpted-source",
2194
- jsxSource: options.attributes?.jsxSource ?? "data-sculpted-jsx-source",
2195
- component: options.attributes?.component ?? "data-sculpted-component"
2190
+ editId: DEFAULT_EDIT_ID_ATTRIBUTE,
2191
+ source: DEFAULT_SOURCE_ATTRIBUTE,
2192
+ jsxSource: DEFAULT_JSX_SOURCE_ATTRIBUTE,
2193
+ component: DEFAULT_COMPONENT_ATTRIBUTE
2196
2194
  };
2197
2195
  let projectRoot = normalizePath$1(options.projectRoot ?? "");
2198
2196
  let devEnabled = options.enabled !== false;
@@ -2273,7 +2271,6 @@ function sculpted(options = {}) {
2273
2271
  registerRuntimeModuleRoutes(nextServer, {
2274
2272
  manifestEndpoint: endpoint,
2275
2273
  editorMetadataEndpoint,
2276
- globalName: options.runtime?.globalName,
2277
2274
  runtimeBootstrapEndpoint,
2278
2275
  runtimeModuleEndpoint,
2279
2276
  uiModuleEndpoint,
package/docs/examples.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # Example Apps
2
2
 
3
- Sculpted includes minimal Vite + Panda CSS apps for manually verifying inspector behavior and source
4
- writeback while the package is being built.
3
+ Sculpted includes minimal Vite + Panda CSS apps for contributors who need to manually verify
4
+ inspector behavior and source writeback while developing the package.
5
5
 
6
6
  ## React
7
7
 
@@ -26,5 +26,5 @@ pnpm install
26
26
  pnpm dev
27
27
  ```
28
28
 
29
- Use these apps to verify supported edits, unsupported read-only cases, token creation checks, React
30
- `className`, Preact `class`, TSRX parsing, and production-dark behavior while developing Sculpted.
29
+ These apps intentionally include edge cases and maintainer-focused checks. Most users should start
30
+ with the setup examples in the main README instead.
@@ -1,13 +1,8 @@
1
1
  # Source Syntax Adapters
2
2
 
3
- Sculpted can support non-standard source syntax when a parser adapter exposes stable ranges into
4
- the original authoring source. The patcher edits that original file directly after revalidating
5
- hashes, source containment, and AST shape.
6
-
7
- Sourcemaps are not the writeback authority. A future fallback may use sourcemaps to explain
8
- generated-code provenance, but safe writes still require an original-source parser and patchable
9
- target. If the adapter cannot provide stable original ranges for a source shape, Sculpted should
10
- report that target as read-only.
3
+ Sculpted can support non-standard source syntax when that syntax can be parsed back to stable
4
+ locations in the original authoring file. Unsupported source shapes are shown as read-only instead
5
+ of guessed.
11
6
 
12
7
  ## TSRX Support
13
8
 
@@ -17,14 +12,14 @@ TSRX support is opt-in because `.tsrx` files need the ESTree-backed parser adapt
17
12
  ```ts
18
13
  // vite.config.ts
19
14
  import { defineConfig } from 'vite'
20
- import { tsrxSourceParserAdapter } from 'sculpted'
15
+ import { sourceSyntax } from 'sculpted/tsrx'
21
16
  import { sculpted } from 'sculpted/vite'
22
17
 
23
18
  export default defineConfig({
24
19
  plugins: [
25
20
  sculpted({
26
21
  include: ['src/**/*.{ts,tsx,tsrx}'],
27
- sourceSyntax: [tsrxSourceParserAdapter],
22
+ sourceSyntax: [sourceSyntax],
28
23
  }),
29
24
  ],
30
25
  })
@@ -45,38 +40,11 @@ export function Card() {
45
40
  TSRX support covers:
46
41
 
47
42
  - static `css({ ... })` object literal analysis;
48
- - marker-class instrumentation for element selection;
49
- - existing literal `set` writeback after re-parsing the original `.tsrx` source.
43
+ - element selection in the inspector;
44
+ - saving edits to existing literal values in the original `.tsrx` source.
50
45
 
51
46
  TSRX support does not cover:
52
47
 
53
- - direct `data-panda-*` metadata insertion;
54
48
  - inline source creation;
55
49
  - add, delete, or rename operations;
56
- - generated TSX or sourcemap-based writeback authority.
57
-
58
- ## Custom Adapters
59
-
60
- Languages that can expose original source ranges can opt into the same writeback lane with a
61
- `sourceSyntax` parser adapter. The option accepts one adapter or an ordered adapter list.
62
-
63
- ```ts
64
- sculpted({
65
- include: ['src/**/*.view'],
66
- sourceSyntax: {
67
- languageId: 'my-tsx-superset',
68
- kind: 'typescript',
69
- isSupportedFile: (file) => file.endsWith('.view'),
70
- parse({ filePath, sourceText }) {
71
- return {
72
- kind: 'typescript',
73
- languageId: 'my-tsx-superset',
74
- sourceFile: parseToTypeScriptCompatibleSourceFile(filePath, sourceText),
75
- }
76
- },
77
- },
78
- })
79
- ```
80
-
81
- Parser adapters must expose node ranges as offsets into the original authoring source text. Use
82
- read-only failures for any syntax that cannot provide stable original ranges for a source shape.
50
+ - generated TSX or sourcemap-based writeback.
@@ -31,17 +31,12 @@ Sculpted does not edit:
31
31
 
32
32
  ## Safety Model
33
33
 
34
- Source writes are revalidated on the dev server before writing:
34
+ Source writes are revalidated on the dev server before writing. Sculpted only writes to files inside
35
+ the configured project root, re-checks the current source before saving, and rejects stale source,
36
+ unsupported shapes, duplicate keys, parser errors, and unsafe paths.
35
37
 
36
- - the browser sends manifest edit IDs, not trusted file paths;
37
- - the server resolves edit IDs through the trusted manifest;
38
- - the patcher re-reads source and validates project-root containment;
39
- - stale source hashes, unsupported source shapes, duplicate keys, parse errors, and path escapes are
40
- rejected;
41
- - batched saves apply same-file edits against one source snapshot before writing.
42
-
43
- The UI saves immediately after clicking Save. The writeback endpoint still supports dry-run patch
44
- responses with focused diffs for tests and tooling.
38
+ The UI saves immediately after clicking Save. If a save cannot be applied confidently, Sculpted
39
+ shows the failure instead of guessing at a source edit.
45
40
 
46
41
  ## Supported Edit Example
47
42
 
@@ -15,6 +15,32 @@ export default defineConfig({
15
15
  The plugin runs with `enforce: 'pre'` so it can instrument supported source before framework
16
16
  plugins transform JSX. Keep it before React, Preact, or other JSX-transforming plugins.
17
17
 
18
+ ## React Router 7 Framework Mode
19
+
20
+ React Router 7 framework mode renders the document from the app's root module instead of serving a
21
+ Vite `index.html` entry. Sculpted can still instrument route modules and serve its manifest,
22
+ runtime, metadata, and writeback endpoints, but Vite does not call `transformIndexHtml` for that
23
+ framework-rendered document. Add the runtime script explicitly in development:
24
+
25
+ ```tsx
26
+ // app/root.tsx
27
+ <Scripts />
28
+ {import.meta.env.DEV && <script src="/@sculpted/runtime" type="module" />}
29
+ ```
30
+
31
+ Keep `sculpted()` before `reactRouter()` in `vite.config.ts` so route modules are instrumented
32
+ before React Router transforms them:
33
+
34
+ ```ts
35
+ import { reactRouter } from '@react-router/dev/vite'
36
+ import { defineConfig } from 'vite'
37
+ import { sculpted } from 'sculpted/vite'
38
+
39
+ export default defineConfig({
40
+ plugins: [sculpted(), reactRouter()],
41
+ })
42
+ ```
43
+
18
44
  ## Development Behavior
19
45
 
20
46
  In development, the plugin:
@@ -42,12 +68,8 @@ type InspectorVitePluginOptions = {
42
68
  readonly panda?: {
43
69
  readonly configPath?: string
44
70
  readonly cssImportSources?: readonly string[]
45
- readonly recipeImportSources?: readonly string[]
46
- readonly cssFunctionNames?: readonly string[]
47
- readonly cxFunctionNames?: readonly string[]
48
71
  }
49
72
  readonly manifest?: {
50
- readonly outFile?: string
51
73
  readonly virtualEndpoint?: string
52
74
  }
53
75
  readonly metadata?: {
@@ -55,13 +77,6 @@ type InspectorVitePluginOptions = {
55
77
  }
56
78
  readonly runtime?: {
57
79
  readonly inject?: boolean
58
- readonly globalName?: string
59
- }
60
- readonly attributes?: {
61
- readonly editId?: string
62
- readonly source?: string
63
- readonly jsxSource?: string
64
- readonly component?: string
65
80
  }
66
81
  readonly sourceSyntax?: SourceSyntaxOption
67
82
  }
@@ -143,12 +158,6 @@ sculpted({
143
158
  })
144
159
  ```
145
160
 
146
- ### Reserved Panda Options
147
-
148
- `panda.recipeImportSources`, `panda.cssFunctionNames`, and `panda.cxFunctionNames` are part of the
149
- public option type but are not wired into the Vite plugin implementation. Recipes, patterns,
150
- `cva()`, and broader function-name customization are not supported.
151
-
152
161
  ### `manifest.virtualEndpoint`
153
162
 
154
163
  Defaults to `/@sculpted/manifest`.
@@ -164,10 +173,6 @@ sculpted({
164
173
  })
165
174
  ```
166
175
 
167
- ### `manifest.outFile`
168
-
169
- Reserved. The option is typed but not wired into the Vite plugin implementation.
170
-
171
176
  ### `metadata.virtualEndpoint`
172
177
 
173
178
  Defaults to `/@sculpted/editor-metadata`.
@@ -197,69 +202,22 @@ sculpted({
197
202
  })
198
203
  ```
199
204
 
200
- ### `runtime.globalName`
201
-
202
- Overrides the browser global name used by the installed runtime.
203
-
204
- ```ts
205
- sculpted({
206
- runtime: {
207
- globalName: '__mySculptedRuntime',
208
- },
209
- })
210
- ```
211
-
212
- ### `attributes`
213
-
214
- Overrides the DOM attributes used for inspector metadata.
215
-
216
- Defaults:
217
-
218
- - `editId`: `data-sculpted-edit-id`
219
- - `source`: `data-sculpted-source`
220
- - `jsxSource`: `data-sculpted-jsx-source`
221
- - `component`: `data-sculpted-component`
222
-
223
- Use these only when the defaults collide with app-specific tooling.
224
-
225
- ```ts
226
- sculpted({
227
- attributes: {
228
- editId: 'data-dev-edit-id',
229
- source: 'data-dev-source',
230
- jsxSource: 'data-dev-jsx-source',
231
- component: 'data-dev-component',
232
- },
233
- })
234
- ```
235
-
236
205
  ### `sourceSyntax`
237
206
 
238
- Adds one source parser adapter, or an ordered list of adapters, for non-standard source syntax that
239
- can expose original source ranges. See [source syntax adapters](source-syntax-adapters.md).
207
+ Adds source parsing support for non-standard source syntax. Sculpted currently documents this for
208
+ the bundled TSRX adapter. See [source syntax adapters](source-syntax-adapters.md).
240
209
 
241
210
  ```ts
242
- import { tsrxSourceParserAdapter } from 'sculpted'
211
+ import { sourceSyntax } from 'sculpted/tsrx'
243
212
 
244
213
  sculpted({
245
214
  include: ['src/**/*.{ts,tsx,tsrx}'],
246
- sourceSyntax: [tsrxSourceParserAdapter],
215
+ sourceSyntax: [sourceSyntax],
247
216
  })
248
217
  ```
249
218
 
250
- ## Endpoint Defaults
251
-
252
- These endpoint defaults are fixed unless an option above says otherwise:
253
-
254
- - Manifest: `/@sculpted/manifest`
255
- - Editor metadata: `/@sculpted/editor-metadata`
256
- - Source writeback: `/@sculpted/writeback`
257
- - Token writeback: `/@sculpted/token-writeback`
258
- - Open source location: `/@sculpted/open-source`
259
- - Style module route: `/@sculpted/style-module`
260
- - Runtime bootstrap: `/@sculpted/runtime`
261
- - Runtime module: `/@sculpted/runtime-module`
262
- - UI module: `/@sculpted/ui-module`
219
+ ## Development Routes
263
220
 
264
- The writeback, token writeback, open-source, style-module, and runtime module endpoints are internal
265
- runtime contracts today. They are listed here so local tooling can avoid route collisions.
221
+ Sculpted reserves development-only routes under `/@sculpted/*`. The manifest and editor metadata
222
+ routes can be customized with `manifest.virtualEndpoint` and `metadata.virtualEndpoint`; other
223
+ routes are internal runtime details and should not be treated as public integration points.
@@ -1,6 +1,6 @@
1
1
  import preact from '@preact/preset-vite'
2
2
  import tsrx from '@tsrx/vite-plugin-preact'
3
- import { tsrxSourceParserAdapter } from 'sculpted'
3
+ import { sourceSyntax } from 'sculpted/tsrx'
4
4
  import { sculpted } from 'sculpted/vite'
5
5
  import { defineConfig, } from 'vite'
6
6
 
@@ -9,7 +9,7 @@ export default defineConfig({
9
9
  sculpted({
10
10
  projectRoot: import.meta.dirname,
11
11
  include: ['src/**/*.{ts,tsx,tsrx}'],
12
- sourceSyntax: [tsrxSourceParserAdapter],
12
+ sourceSyntax: [sourceSyntax],
13
13
  panda: {
14
14
  cssImportSources: ['../styled-system/css']
15
15
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sculpted",
3
- "version": "0.2.3",
3
+ "version": "0.3.1",
4
4
  "description": "Experimental alpha dev inspector for editing Panda CSS styles and writing safe source updates.",
5
5
  "license": "FSL-1.1-ALv2",
6
6
  "author": "Alec Larson",
@@ -32,6 +32,10 @@
32
32
  "types": "./dist/vite.d.mts",
33
33
  "default": "./dist/vite.mjs"
34
34
  },
35
+ "./tsrx": {
36
+ "types": "./dist/tsrx.d.mts",
37
+ "default": "./dist/tsrx.mjs"
38
+ },
35
39
  "./runtime": {
36
40
  "types": "./dist/runtime.d.mts",
37
41
  "default": "./dist/runtime.mjs"
@@ -52,16 +56,22 @@
52
56
  "prepublishOnly": "pnpm check"
53
57
  },
54
58
  "dependencies": {
55
- "@pandacss/node": "1.11.1",
56
- "@tsrx/core": "0.1.25"
59
+ "@pandacss/node": "1.11.1"
57
60
  },
58
61
  "peerDependencies": {
62
+ "@tsrx/core": ">=0.1.0",
59
63
  "typescript": ">=5.0.0"
60
64
  },
65
+ "peerDependenciesMeta": {
66
+ "@tsrx/core": {
67
+ "optional": true
68
+ }
69
+ },
61
70
  "devDependencies": {
62
71
  "@goddard-ai/ui-primitives": "0.1.1",
63
72
  "@pandacss/dev": "^1.11.1",
64
73
  "@preact/signals": "2.9.1",
74
+ "@tsrx/core": "0.1.25",
65
75
  "@types/node": "^25.9.1",
66
76
  "fuzzysort2": "0.1.1",
67
77
  "happy-dom": "^20.9.0",