@pipelex/mthds-ui 0.24.0 → 0.25.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.
@@ -1,41 +1,41 @@
1
1
  /**
2
- * The form kernel's Tailwind utilities, wrapped in a cascade layer.
3
- *
4
- * WHY THE LAYER, AND WHY THIS FILE EXISTS AT ALL
5
- *
6
- * `@pipelex/mthds-form/styles.css` is a COMPLETE Tailwind build: preflight plus
7
- * every utility the kernel's controls use, unprefixed and unscoped. That is the
8
- * right shape for its intended reader — a host with no Tailwind of its own — and
9
- * exactly the wrong shape for a host that HAS one. Injected raw into such a host
10
- * it is a second, later stylesheet full of colliding rules:
11
- *
12
- * - Its bare `.hidden { display: none }` outranks the host's `.sm\:inline`,
13
- * because the two have equal specificity and it happens to come last. Every
14
- * `class="hidden sm:inline"` label in the host app disappears at every
15
- * width. This is not hypothetical: it silently blanked the toolbar and
16
- * dialog labels across a consuming application the moment a graph mounted.
17
- * - Its preflight re-bases `*, ::before, ::after { border: 0 solid }`. A
18
- * shorthand always sets every longhand, so the host's own default border
19
- * color is still replaced — but with `currentColor`, which is Tailwind 4's
20
- * default. Through kernel 0.7.0 the declaration carried `#e5e7eb` and the
21
- * symptom was a pale grey hairline under anything with a border width and
22
- * no explicit color class. That symptom is gone as of 0.8.0; the collision
23
- * is milder, and the layer settles it either way.
24
- *
25
- * Both are the same failure: our sheet loading LATER than the host's and winning
26
- * ties it has no business winning. A cascade layer settles it by construction —
27
- * layered rules lose to unlayered rules regardless of source order, so the host
28
- * keeps every declaration it makes itself, and we still supply the classes it
29
- * never generated. Nothing here changes for a host with no Tailwind: a layer
30
- * only decides conflicts, and there are none to decide.
31
- *
32
- * The alternative — dropping the import and asking Tailwind hosts to widen their
33
- * content globs into `node_modules` — is the arrangement that was already
34
- * failing before the import was added. See the block comments in
35
- * `../graph/react/index.ts` and `../form/react/index.ts` for why the kernel's
36
- * classes cannot be left to the host to generate.
37
- *
38
- * `theme.css` stays out, layered or not: it defines the semantic tokens
39
- * (`--background`, `--border`, …) a shadcn host already owns.
2
+ * The form kernel's prebuilt stylesheet, for a host WITHOUT Tailwind.
3
+ *
4
+ * Such a host imports it once, from its own entry:
5
+ *
6
+ * import "@pipelex/mthds-ui/form-kernel.css";
7
+ *
8
+ * No JavaScript in this package imports it. From v0.20.0 through v0.24.0 both
9
+ * React entries injected it into every host, and no single position in the
10
+ * cascade served a host that has Tailwind of its own; the block comments in
11
+ * `../graph/react/index.ts` and `../form/react/index.ts` say why.
12
+ *
13
+ * WHAT A HOST GETS WITH IT
14
+ *
15
+ * `@pipelex/mthds-form/styles.css` is a COMPLETE Tailwind build: every utility
16
+ * the kernel's controls use, unprefixed and unscoped, and Tailwind's preflight.
17
+ * The preflight is what lets the controls render with no framework underneath,
18
+ * and it applies to the whole page, not only to the controls: it resets every
19
+ * browser default the host does not restate itself, so headings drop to body
20
+ * size, lists lose their markers, and paragraphs and the body lose their
21
+ * margins. A dedicated panel such as a webview expects that; a page of ordinary
22
+ * content that embeds a graph restates the defaults it wants to keep.
23
+ *
24
+ * WHY THE LAYER
25
+ *
26
+ * Layered rules lose to unlayered rules whatever the source order, so the
27
+ * host's own rules win every tie against the kernel's utilities and preflight,
28
+ * even though this sheet may load after the host's. In a host without Tailwind
29
+ * that is the whole question, which is why the layer stays.
30
+ *
31
+ * A HOST WITH TAILWIND 4 MUST NOT IMPORT THIS FILE. It compiles the kernel's
32
+ * classes itself, through `@pipelex/mthds-ui/tailwind.css` (`./tailwind.css`
33
+ * beside this file), and this sheet would put a second preflight in its page,
34
+ * ranked wherever the host's layers leave it.
35
+ *
36
+ * `theme.css` stays out: it defines the semantic tokens (`--background`,
37
+ * `--border`, …) that belong to the host. Since kernel `0.9.0` every utility in
38
+ * the kernel's sheet reads its token with a fallback, so a host that defines no
39
+ * tokens renders the kernel's light neutral palette.
40
40
  */
41
41
  @import "@pipelex/mthds-form/styles.css" layer(mthds-form);
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Where the form kernel's classes are, for a host with Tailwind 4.
3
+ *
4
+ * The kernel's controls are styled with Tailwind utilities that live in its
5
+ * shipped JavaScript, not in the host's source tree, so a host's build has to be
6
+ * told to scan it. The kernel's documented Tailwind 4 setup (its
7
+ * `docs/theming.md`, "A host that runs Tailwind") does that with an `@source`
8
+ * line naming a path into `node_modules`. This file replaces THAT LINE and
9
+ * nothing else: a host writes
10
+ *
11
+ * @import "@pipelex/mthds-ui/tailwind.css";
12
+ *
13
+ * among its other `@import`s, in any position, since `@source` does not depend
14
+ * on order. The rest of the kernel's setup stays the host's: `tw-animate-css`,
15
+ * whose utilities the select popover's and the tooltip's transitions use, and
16
+ * the `@theme inline` mapping of the shadcn tokens, without which a class such
17
+ * as `bg-background` compiles to nothing however well the scan found it.
18
+ *
19
+ * WHY TWO PATHS
20
+ *
21
+ * Tailwind resolves an imported package stylesheet to its REAL path and resolves
22
+ * that file's `@source` directives relative to it, so both paths below are
23
+ * relative to where this file lands, `dist/styles/` inside this package. An
24
+ * explicit `@source` is scanned even inside `node_modules`.
25
+ *
26
+ * - `../../../mthds-form/dist` is the kernel as a sibling of this package:
27
+ * in a pnpm virtual store, where every dependency of this package is linked
28
+ * beside it, and in an npm tree that hoisted the kernel to the top.
29
+ * - `../../node_modules/@pipelex/mthds-form/dist` is the kernel nested under
30
+ * this package, which npm does when the host's tree already holds another
31
+ * version at the top.
32
+ *
33
+ * A path that does not exist is skipped silently, which is why both are listed:
34
+ * in the layouts pnpm and npm give this package, one of them is the copy of the
35
+ * kernel this package imports, and the host never names a path into
36
+ * `node_modules` or declares the kernel itself.
37
+ *
38
+ * ONE LAYOUT ESCAPES BOTH
39
+ *
40
+ * A tree holding two versions of this package that share a kernel range can
41
+ * have npm nest one of them, under the workspace or dependency that asked for
42
+ * it, while the kernel they share is hoisted further up. No path fixed relative
43
+ * to this file reaches a kernel an arbitrary number of levels above it, so both
44
+ * candidates are skipped, silently, and the host adds its own `@source` at the
45
+ * kernel's `dist` (`docs/run-form-panel.md`).
46
+ *
47
+ * No JavaScript imports this file, and a host WITHOUT Tailwind never loads it:
48
+ * it imports `@pipelex/mthds-ui/form-kernel.css` instead. Never both.
49
+ */
50
+ @source "../../../mthds-form/dist";
51
+ @source "../../node_modules/@pipelex/mthds-form/dist";
@@ -524,12 +524,16 @@ declare function toolbarSide(position: ToolbarPosition): ToolbarSide;
524
524
  * host's validation lifecycle, not the static analyzer's: `validating` while a
525
525
  * verdict is being produced, `valid`/`invalid` once one exists, and `error`
526
526
  * when no verdict could be produced at all (validator unavailable, timeout…).
527
+ * `unvalidated` is for a host with no validator at all, such as a page drawing
528
+ * a method from its source: no verdict exists or is coming, and the issues are
529
+ * what reading the source turned up.
527
530
  */
528
531
  declare const VALIDATION_STATE: {
529
532
  readonly VALIDATING: "validating";
530
533
  readonly VALID: "valid";
531
534
  readonly INVALID: "invalid";
532
535
  readonly ERROR: "error";
536
+ readonly UNVALIDATED: "unvalidated";
533
537
  };
534
538
  type ValidationState = (typeof VALIDATION_STATE)[keyof typeof VALIDATION_STATE];
535
539
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipelex/mthds-ui",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "description": "Shared graph rendering logic for MTHDS method visualization",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -51,7 +51,9 @@
51
51
  "./static-graph": {
52
52
  "import": "./dist/static-graph/index.js",
53
53
  "types": "./dist/static-graph/index.d.ts"
54
- }
54
+ },
55
+ "./tailwind.css": "./dist/styles/tailwind.css",
56
+ "./form-kernel.css": "./dist/styles/form-kernel.css"
55
57
  },
56
58
  "files": [
57
59
  "dist"
@@ -76,14 +78,14 @@
76
78
  "build-storybook": "storybook build"
77
79
  },
78
80
  "dependencies": {
79
- "@pipelex/mthds-form": "^0.8.0",
81
+ "@pipelex/mthds-form": "^0.11.0",
80
82
  "@xyflow/react": "^12",
81
83
  "elkjs": "^0.11.1",
82
84
  "smol-toml": "^1.7.0"
83
85
  },
84
86
  "peerDependencies": {
85
- "react": "^19",
86
- "react-dom": "^19",
87
+ "react": "^19.2.3",
88
+ "react-dom": "^19.2.3",
87
89
  "shiki": "^3.22.0"
88
90
  },
89
91
  "peerDependenciesMeta": {