@marianmeres/stuic 3.143.0 → 3.144.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/AGENTS.md CHANGED
@@ -53,6 +53,9 @@ Theme CSS files are not bundled in this package — they're provided by `@marian
53
53
  5. Create components without `unstyled`, `class`, `el` props
54
54
  6. Use `dark:` Tailwind prefix when CSS vars handle dark mode
55
55
  7. Import CSS inside components — centralize in `src/lib/index.css`
56
+ (**exception:** subpath-export components with optional peer deps — `MarkdownEditor`,
57
+ `CommentInput` — import their own `index.css` locally so their styles don't ship to
58
+ barrel-only consumers. Enforced by `src/lib/barrel-optional-peers.test.ts`.)
56
59
  8. Declare component tokens at `:root` that reference shared structural tokens (use fallback pattern instead)
57
60
 
58
61
  ### CSS Variable Pattern
package/README.md CHANGED
@@ -27,6 +27,29 @@ npm install @marianmeres/stuic
27
27
  </Modal>
28
28
  ```
29
29
 
30
+ ## Subpath exports
31
+
32
+ Most of the library is on the main entry. A few things live behind subpaths:
33
+
34
+ | Subpath | Contents |
35
+ | ------------------------------------- | ------------------------------------------------------------- |
36
+ | `@marianmeres/stuic` | Components, actions, icons, utils — everything below excepted |
37
+ | `@marianmeres/stuic/utils` | Utilities only, without pulling in components |
38
+ | `@marianmeres/stuic/phone-validation` | Phone validation helpers |
39
+ | `@marianmeres/stuic/markdown-editor` | `MarkdownEditor` — requires optional peer deps |
40
+ | `@marianmeres/stuic/comment-input` | `CommentInput` — requires optional peer deps |
41
+
42
+ The last two are **not** on the main entry by design: they depend on Milkdown and
43
+ CodeMirror, which are declared as _optional_ peer dependencies. Keeping them off the
44
+ barrel means consumers who don't use them never have to install that stack — and,
45
+ more importantly, their builds don't fail for want of it.
46
+
47
+ ```ts
48
+ import { CommentInput } from "@marianmeres/stuic/comment-input";
49
+ ```
50
+
51
+ See each component's README for the peer set to install.
52
+
30
53
  ## Theming System
31
54
 
32
55
  STUIC uses a 4-layer CSS variable token system:
@@ -143,6 +143,7 @@
143
143
  import { Button } from "../Button/index.js";
144
144
  import Thc from "../Thc/Thc.svelte";
145
145
  import { MarkdownEditor } from "../MarkdownEditor/index.js";
146
+ import "./index.css";
146
147
 
147
148
  let {
148
149
  value = $bindable(""),
@@ -110,6 +110,7 @@ export interface Props extends InputWrapClassProps {
110
110
  classFooter?: string;
111
111
  style?: string;
112
112
  }
113
+ import "./index.css";
113
114
  declare const CommentInput: import("svelte").Component<Props, {
114
115
  validate: () => ValidationResult | undefined;
115
116
  clearValidation: () => void;
@@ -12,9 +12,14 @@ lightweight, opinionated wrapper for the common "leave a comment / reply" use
12
12
  case: a clean minimal toolbar, an avatar, a submit button, and
13
13
  ⌘/Ctrl+Enter-to-send — without you having to wire any of it up.
14
14
 
15
+ Because it embeds `MarkdownEditor`, it is shipped as an **optional subpath export**
16
+ (`@marianmeres/stuic/comment-input`), separate from the main barrel — so the heavy
17
+ editor dependencies never reach consumers who don't use it. Importing it from
18
+ `@marianmeres/stuic` will not work.
19
+
15
20
  ```svelte
16
21
  <script>
17
- import { CommentInput } from "@marianmeres/stuic";
22
+ import { CommentInput } from "@marianmeres/stuic/comment-input";
18
23
 
19
24
  let value = $state("");
20
25
 
@@ -49,6 +54,11 @@ This is the same peer set as `MarkdownEditor` — see its README for the
49
54
  authoritative list. If they aren't installed, the surface stays empty and a
50
55
  console error explains why.
51
56
 
57
+ > **CSS is imported locally** by this component, not via the central
58
+ > `src/lib/index.css`. Deliberate deviation from the usual STUIC convention,
59
+ > required so these styles ship only to subpath users. Same as `MarkdownEditor`;
60
+ > see `index.css` for the rationale.
61
+
52
62
  ## Toolbar
53
63
 
54
64
  `toolbar` accepts `true` (the default), `false` (hidden), or an ordered
@@ -1,6 +1,19 @@
1
1
  /******************************************************************************
2
2
  CommentInput
3
3
 
4
+ NOTE — intentional deviation from the usual STUIC CSS convention.
5
+ Every other component's `index.css` is `@import`-ed into the central
6
+ `src/lib/index.css`. This component is NOT: because it embeds `MarkdownEditor`
7
+ it is an OPTIONAL subpath export (`@marianmeres/stuic/comment-input`) kept off
8
+ the main barrel, so the heavy Milkdown/CodeMirror peers never reach consumers
9
+ who don't use it. Centralizing its CSS would ship these styles to every
10
+ consumer anyway. Instead `CommentInput.svelte` imports THIS file locally; the
11
+ package's `sideEffects` glob (all css files) keeps the import for real users.
12
+
13
+ `MarkdownEditor/index.css` arrives on its own — `MarkdownEditor.svelte`
14
+ imports it locally too — so do NOT `@import` it here (it would double-inject
15
+ for anyone using both components).
16
+
4
17
  A GitHub-style comment composer built on top of `MarkdownEditor` (a rich
5
18
  WYSIWYG / source surface) with an avatar gutter and a submit/cancel footer.
6
19
 
package/dist/index.css CHANGED
@@ -71,7 +71,9 @@ In practice:
71
71
  @import "./components/LoginOrRegisterForm/index.css";
72
72
  @import "./components/Checkout/index.css";
73
73
  @import "./components/CommandMenu/index.css";
74
- @import "./components/CommentInput/index.css";
74
+ /* NOTE: CommentInput/index.css is deliberately NOT imported here — same reason as
75
+ MarkdownEditor's. It is a subpath-export component and imports its own CSS
76
+ locally (see components/CommentInput/index.css). Do not re-add. */
75
77
  @import "./components/ContactUsForm/index.css";
76
78
  @import "./components/CronInput/index.css";
77
79
  @import "./components/DataTable/index.css";
package/dist/index.d.ts CHANGED
@@ -38,7 +38,6 @@ export * from "./components/Checkout/index.js";
38
38
  export * from "./components/Collapsible/index.js";
39
39
  export * from "./components/ColorScheme/index.js";
40
40
  export * from "./components/CommandMenu/index.js";
41
- export * from "./components/CommentInput/index.js";
42
41
  export * from "./components/ContactUsForm/index.js";
43
42
  export * from "./components/CronInput/index.js";
44
43
  export * from "./components/DataTable/index.js";
package/dist/index.js CHANGED
@@ -39,7 +39,11 @@ export * from "./components/Checkout/index.js";
39
39
  export * from "./components/Collapsible/index.js";
40
40
  export * from "./components/ColorScheme/index.js";
41
41
  export * from "./components/CommandMenu/index.js";
42
- export * from "./components/CommentInput/index.js";
42
+ // NOTE: CommentInput is deliberately NOT exported here. It embeds MarkdownEditor,
43
+ // whose optional @milkdown/* + @codemirror/* peers would then be pulled into the
44
+ // root entry graph of every consumer. It ships as the `@marianmeres/stuic/comment-input`
45
+ // subpath export instead, mirroring `@marianmeres/stuic/markdown-editor`.
46
+ // Guarded by src/lib/barrel-optional-peers.test.ts — do not re-add.
43
47
  export * from "./components/ContactUsForm/index.js";
44
48
  export * from "./components/CronInput/index.js";
45
49
  export * from "./components/DataTable/index.js";
@@ -80,6 +80,17 @@ src/lib/
80
80
 
81
81
  **DO NOT** use `import './index.css'` inside component `.svelte` files.
82
82
 
83
+ **Exception — subpath-export components.** A component whose peer dependencies are
84
+ declared _optional_ (`MarkdownEditor`, `CommentInput`) is kept off the root barrel and
85
+ shipped behind its own subpath export, so those peers never enter the entry graph of
86
+ consumers who don't use it. Such a component imports its own `index.css` locally and is
87
+ **not** `@import`-ed into `src/lib/index.css` — centralizing it would ship the styles to
88
+ every consumer, defeating the isolation. `sideEffects: ["**/*.css"]` in `package.json`
89
+ keeps the local import alive for real users.
90
+
91
+ Both halves are enforced by `src/lib/barrel-optional-peers.test.ts` — adding such a
92
+ component to the barrel (or its CSS to the central stylesheet) fails the suite.
93
+
83
94
  ---
84
95
 
85
96
  ## Data Flow
@@ -151,9 +162,20 @@ Theme CSS files are provided by the `@marianmeres/design-tokens` package (a regu
151
162
  ### Package Exports
152
163
 
153
164
  ```json
154
- ".": Main entry (components, utils, actions, icons, theme types)
165
+ ".": Main entry (components, utils, actions, icons, theme types)
166
+ "./utils": Utilities only
167
+ "./phone-validation": Phone validation helpers
168
+ "./markdown-editor": MarkdownEditor — optional peer deps, local CSS
169
+ "./comment-input": CommentInput — optional peer deps, local CSS
155
170
  ```
156
171
 
172
+ The last two are deliberately **off** the main entry: they reach `@milkdown/*` and
173
+ `@codemirror/*`, which are optional peers. A consumer that has not installed those
174
+ peers gets a hard bundler error (rolldown reports every named import from the
175
+ unresolved stub as `MISSING_EXPORT`) if the root barrel can reach them — even though
176
+ the editor backends sit behind `await import()`, because the specifiers are static
177
+ literals that a bundler must still resolve at build time.
178
+
157
179
  ---
158
180
 
159
181
  ## Security Boundaries
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marianmeres/stuic",
3
- "version": "3.143.0",
3
+ "version": "3.144.0",
4
4
  "packageManager": "pnpm@11.5.0",
5
5
  "scripts": {
6
6
  "dev": "vite dev",
@@ -54,6 +54,11 @@
54
54
  "types": "./dist/components/MarkdownEditor/index.d.ts",
55
55
  "svelte": "./dist/components/MarkdownEditor/index.js",
56
56
  "default": "./dist/components/MarkdownEditor/index.js"
57
+ },
58
+ "./comment-input": {
59
+ "types": "./dist/components/CommentInput/index.d.ts",
60
+ "svelte": "./dist/components/CommentInput/index.js",
61
+ "default": "./dist/components/CommentInput/index.js"
57
62
  }
58
63
  },
59
64
  "peerDependencies": {
@@ -72,8 +77,6 @@
72
77
  "@milkdown/prose": "^7.0.0",
73
78
  "@milkdown/transformer": "^7.0.0",
74
79
  "@milkdown/utils": "^7.0.0",
75
- "dompurify": "^3.0.0",
76
- "marked": "^18.0.0",
77
80
  "svelte": "^5.0.0"
78
81
  },
79
82
  "peerDependenciesMeta": {
@@ -121,12 +124,6 @@
121
124
  },
122
125
  "@milkdown/utils": {
123
126
  "optional": true
124
- },
125
- "dompurify": {
126
- "optional": true
127
- },
128
- "marked": {
129
- "optional": true
130
127
  }
131
128
  },
132
129
  "devDependencies": {
@@ -157,11 +154,9 @@
157
154
  "@tailwindcss/vite": "^4.3.1",
158
155
  "@types/node": "^25.9.4",
159
156
  "@vitest/browser-playwright": "^4.1.9",
160
- "dompurify": "^3.4.11",
161
157
  "dotenv": "^16.6.1",
162
158
  "eslint": "^9.39.4",
163
159
  "globals": "^16.5.0",
164
- "marked": "^18.0.5",
165
160
  "playwright": "^1.61.1",
166
161
  "prettier": "^3.9.0",
167
162
  "prettier-plugin-svelte": "^3.5.2",