@shing.wong/sure-factor 0.3.3 → 0.4.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.
@@ -0,0 +1,186 @@
1
+ ---
2
+ name: sure-factor
3
+ description: Use when generating or changing UI from a database schema with @shing.wong/sure-factor — adding a form or table view, matching a column to a type, adding a field or validation rule, or regenerating generated components. Covers scoping the schema, the catalog, the three-tier presets, and why you edit the spec and regenerate rather than editing generated code.
4
+ ---
5
+
6
+ # sure-factor
7
+
8
+ Turns a database schema into UI: it matches columns to types in a catalog, then
9
+ generates forms, tables and stores. This skill is the non-obvious part — what to
10
+ read, what to skip, and what not to edit.
11
+
12
+ ## The pipeline
13
+
14
+ Five composable calls. Each step's output is the next step's input.
15
+
16
+ ```ts
17
+ import {
18
+ introspectSchemaFromDdl, // DDL string -> SchemaInfo
19
+ loadAllTypesSync, // -> CatalogType[] (the catalog)
20
+ matchColumnToTypeSync, // ColumnInfo -> TypeMatchResult | null
21
+ generateClientComponent, // SchemaInfo -> { module, fields, cssClasses }
22
+ generateStore, // SchemaInfo -> store module
23
+ } from "@shing.wong/sure-factor"
24
+ ```
25
+
26
+ `introspectSchema` is the same thing against a live database. Everything else is
27
+ synchronous and needs no connection.
28
+
29
+ ## Scope the schema before you introspect it
30
+
31
+ `introspectSchemaFromDdl` takes a **DDL string**, not a database handle. Pass the
32
+ one `CREATE TABLE` you care about rather than the whole file.
33
+
34
+ ```ts
35
+ // Don't: 25 tables when you need one. 5,043 tokens on the management schema.
36
+ const all = introspectSchemaFromDdl(allDdl)
37
+
38
+ // Do: slice first. 282 tokens, identical columns.
39
+ const ddl = /CREATE TABLE IF NOT EXISTS tickets \([^;]*\);/i.exec(allDdl)![0]
40
+ const schema = introspectSchemaFromDdl(ddl)
41
+ ```
42
+
43
+ Measured on `positronic/management` (25 tables): 5,043 → 282 tokens, a 94%
44
+ reduction. This is a caller-side slice, not a library option — there is no
45
+ filter parameter and you do not need one.
46
+
47
+ The pattern is literal, so keep the `IF NOT EXISTS` when your DDL has it — a
48
+ migration-style schema will not match `CREATE TABLE tickets` on its own. Either
49
+ form parses; it is the regex that has to match your file. If it returns `null`,
50
+ your DDL spells the clause differently than the pattern does.
51
+
52
+ ## Take columns out of the schema, never build one
53
+
54
+ `matchColumnToTypeSync` takes a column name, or a `ColumnInfo`. Taking it from
55
+ the schema is the right default, because the `dataType` is what lets the catalog
56
+ apply its `data_type` rules.
57
+
58
+ ```ts
59
+ // Fine — name only, matched on the name rules.
60
+ matchColumnToTypeSync("email", types)!.type.name // "email"
61
+
62
+ // Better — carries dataType, so data_type rules can also fire.
63
+ const col = schema.tables[0].columns.find(c => c.columnName === "subject")!
64
+ matchColumnToTypeSync(col, types) // -> text (no type claims it)
65
+ ```
66
+
67
+ A name alone will not match a type whose only rule is on `data_type`; the result
68
+ is `null` rather than a guess. If you expect a match and get `null`, you passed a
69
+ bare string for a column that needs its data type.
70
+
71
+ Do not construct a partial `ColumnInfo` by hand to get the data type — the rules
72
+ read `maxLength` too, and a hand-built object is a bug waiting to happen. Take the
73
+ column from the schema.
74
+
75
+ `null` also means "no type claims this column", which is normal: `subject`,
76
+ `status` and `quantity` have no catalog type and fall back to `text`. To give a
77
+ column a type, rename it to something the catalog recognises, or add a type to
78
+ `catalog/types/`.
79
+
80
+ ## Read the catalog, do not dump it
81
+
82
+ `loadAllTypesSync()` returns all 16 types — 7,532 tokens as JSON. The catalog is
83
+ YAML on disk, one type per file, and one type is the unit you want.
84
+
85
+ ```bash
86
+ cat node_modules/@shing.wong/sure-factor/catalog/types/email.yaml # 2.3 KB
87
+ ```
88
+
89
+ Read the file for the type you care about. Use the loader when you need to match
90
+ many columns at once.
91
+
92
+ A type carries `match` (how a column is recognised), `validation`, `sanitize`
93
+ (input and output), `hints` per locale, and `tiers`.
94
+
95
+ ## Pick a tier, and know what it costs
96
+
97
+ `vibe`, `prototype`, `production` are presets, not quality settings. They trade
98
+ validation strictness for less code.
99
+
100
+ | tier | email type size | what you get |
101
+ |---|---|---|
102
+ | `vibe` | 147 B | a loose regex |
103
+ | `prototype` | 414 B | a real regex, no extras |
104
+ | `production` | 499 B | full recipe plus sanitisation |
105
+
106
+ Use `vibe` for a throwaway, `production` for anything that stores a value. The
107
+ default is `production`; pass the tier explicitly when you mean something else.
108
+
109
+ ## `styles` is sure-ui compose, `notifications` is gated on the mode
110
+
111
+ `generateForTier` returns two output fields whose shape depends on the
112
+ component yaml, not on guesswork:
113
+
114
+ - **`styles`** is [`@shing.wong/sure-ui`](https://github.com/ShingWong/sure-ui)
115
+ `compose()` output over the yaml's `sure_ui: [blocks]` — tokens plus the
116
+ blocks the markup needs, in cascade layers. Do not add a second stylesheet
117
+ on top: consumer CSS is unlayered and wins over the theme regardless of
118
+ specificity, which pins the page to one palette (see below). The registry
119
+ test (`src/registry.test.ts`) keeps `sure_ui` in step with both the yaml's
120
+ `cssClasses` and sure-ui's `COMPONENTS`.
121
+ - **`notifications`** is the `showNotification`/`clearNotifications` runtime
122
+ source — present (`string`) only when `behavior.notificationModes`
123
+ declares a non-inline mode (`toast`, `statusBar`, `sidePanel`), `null`
124
+ otherwise. Write it to `notifications.js` when present; an inline-only
125
+ component needs no runtime, and shipping one invites imports that are
126
+ never called.
127
+
128
+ ## Edit the spec, regenerate; never edit generated code
129
+
130
+ Generated modules are large because they are complete: a 7-field form is 16,856
131
+ chars, and each extra field adds roughly 700. The 25-table module is ~100,000
132
+ chars — **16,856 of that is fixed boilerplate that does not change when a field
133
+ does.**
134
+
135
+ To change one field, change the input and regenerate. Do not read a generated
136
+ module to find the field, and do not edit the module to change the field.
137
+
138
+ ```ts
139
+ // Change the source of truth, then regenerate.
140
+ const result = generateClientComponent(schema, {
141
+ tier: "production",
142
+ component: "form", // or "data-table"
143
+ exportName: "TicketsForm",
144
+ })
145
+ ```
146
+
147
+ `component` picks a template from `catalog/components/`: `form`, `data-table`,
148
+ `form-modal`, `crud-resource`, `search-filter`, `dialog`, and the auth ones.
149
+ A `data-table` component renders a `<table>`, not a form.
150
+
151
+ The result carries `module` (TypeScript source), `fields`, and `cssClasses`.
152
+ The class names are a contract between the generator and `sure-ui` — pass them
153
+ through, do not hardcode `sure-form__field` in a consumer.
154
+
155
+ ## Check the output parses, then check what it does
156
+
157
+ `tsc --noEmit` on the emitted module. It is TypeScript and declares its own
158
+ spec interfaces, so a `new Function` probe fails on the interfaces rather than
159
+ on a real defect.
160
+
161
+ Then exercise the functions the module exports — `validateForm`, `sanitizeForm`
162
+ if it is a form. Reading the source tells you a function exists; calling it
163
+ tells you it works. A generated sanitiser that compiles and does nothing is
164
+ exactly the defect worth testing for.
165
+
166
+ Commit the generated module. It is the artefact the application builds, and a
167
+ suite that compiles a committed module without regenerating can be green
168
+ against a module no generator would produce.
169
+
170
+ ## What this skill does not cover
171
+
172
+ - **Server targets.** `generateForTier` emits Handlebars + htmx + express.
173
+ `generateClientComponent` emits plain DOM with no framework or dependencies.
174
+ Pick by what the application is.
175
+ - **Runtime UI styling.** `sure-ui` owns the class names; a consumer should not
176
+ restyle them, and a hardcoded colour in a consumer's stylesheet wins over the
177
+ theme and pins the page to one palette.
178
+ - **Sanitisation is not a security boundary.** It is a UX convenience. The
179
+ server re-validates every argument; treat the client copy as presentation.
180
+
181
+ ## Where the machine-readable version lives
182
+
183
+ `tsc` emits `.d.ts` for every export into `dist/` on each build — signatures,
184
+ argument shapes and tier unions, always current. Read those rather than trusting
185
+ this file for shapes. What no declaration carries is *which* call to make, which
186
+ is what the rest of this document is for.
package/README.md CHANGED
@@ -127,7 +127,8 @@ const output = generateForTier(schema, { tier: 'production', component: 'form' }
127
127
  // routes: "app.post('/patients', ...)",
128
128
  // template: "<form class='sure-form'>...",
129
129
  // i18n: { email_placeholder: 'user@example.com', ... },
130
- // styles: ".sure-form { max-width: 480px; }...",
130
+ // styles: "@layer sure.tokens, ... sure-ui compose [form, buttons]...",
131
+ // notifications: "…showNotification() runtime… | null (inline-only)",
131
132
  // validation: "z.string().regex(/^[a-zA-Z0-9.../).max(254)",
132
133
  // sanitization: "[trim, lowercase, normalize(NFKC), ...]"
133
134
  // }
@@ -235,7 +236,7 @@ Generation progresses through three quality tiers — same schema, different out
235
236
  | Audio | None | Error bell | Chime + speech |
236
237
  | Security | Param queries | + CSRF | + Encryption + audit |
237
238
  | State sync | — | — | sure-state + versioning |
238
- | CSS themes | None | Pure CSS | Nord / Forest / Dracula |
239
+ | CSS themes | sure-ui compose (7 themes) | sure-ui compose (7 themes) | sure-ui compose (7 themes) |
239
240
 
240
241
  ## Sanitization Pipeline
241
242
 
@@ -329,8 +330,36 @@ const formatted = await formatGeneratedOutput(output)
329
330
  |-------|------|-------------|
330
331
  | i18n | `catalog/assets/i18n/{en,es,fr}.json` | Locale strings for components |
331
332
  | Audio | `catalog/assets/audio/` | Error bell, success chime, voice help (JS audio generators) |
332
- | Themes | `catalog/assets/themes/{nord,forest,dracula}.css` | Production CSS themes |
333
333
  | Lookup data | `catalog/assets/data/{icd10-codes,us-zip-codes}.json` | Validation datasets |
334
+ | Agent skill | `.opencode/skills/sure-factor/SKILL.md` | How an agent should drive this package |
335
+
336
+ Theme CSS is not vendored: `styles` is composed on demand from
337
+ [`@shing.wong/sure-ui`](https://github.com/ShingWong/sure-ui) — pass any of
338
+ its seven themes via `generateForTier(schema, { theme: 'forest' })`.
339
+
340
+ ## Agent skill
341
+
342
+ The package ships an [OpenCode](https://opencode.ai) skill covering the parts of
343
+ this API that are not obvious from the signatures — scoping the DDL before
344
+ introspecting it, taking columns out of the schema rather than constructing
345
+ them, reading the catalog YAML instead of dumping the loader, and editing the
346
+ spec rather than the generated output.
347
+
348
+ Point OpenCode at it from your `opencode.json`:
349
+
350
+ ```jsonc
351
+ {
352
+ "$schema": "https://opencode.ai/config.json",
353
+ "skills": ["./node_modules/@shing.wong/sure-factor/.opencode/skills"]
354
+ }
355
+ ```
356
+
357
+ Only the skill's name and description are loaded up front; the body is read when
358
+ the agent decides the skill applies. Its claims are executed by this package's
359
+ test suite, so it cannot drift from the code without a test failing.
360
+
361
+ It is plain Markdown — copy it anywhere you prefer to keep instructions, or
362
+ point the `skills` array at any local directory or HTTP catalog.
334
363
 
335
364
  ## Related Projects
336
365
 
@@ -29,6 +29,9 @@ behavior:
29
29
  successChime: false
30
30
  voiceHelp: false
31
31
  autoFocus: true
32
+ sure_ui:
33
+ - auth
34
+ - buttons
32
35
  cssClasses:
33
36
  form: sure-auth__form
34
37
  header: sure-auth__header
@@ -29,6 +29,9 @@ behavior:
29
29
  errorBell: true
30
30
  successChime: true
31
31
  autoFocus: true
32
+ sure_ui:
33
+ - auth
34
+ - buttons
32
35
  cssClasses:
33
36
  form: sure-auth__form
34
37
  header: sure-auth__header
@@ -22,6 +22,9 @@ parameters:
22
22
  es: Restablecer Contraseña
23
23
  fr: Réinitialiser le Mot de Passe
24
24
  showLoginLink: true
25
+ sure_ui:
26
+ - auth
27
+ - buttons
25
28
  cssClasses:
26
29
  form: sure-auth__form
27
30
  header: sure-auth__header
@@ -46,6 +46,9 @@ behavior:
46
46
  confirmBeforeCancel: true
47
47
  scripts:
48
48
  - voice-help.js
49
+ sure_ui:
50
+ - crud
51
+ - buttons
49
52
  cssClasses:
50
53
  form: sure-crud
51
54
  field: sure-crud__field
@@ -41,6 +41,9 @@ behavior:
41
41
  confirmBeforeCancel: false
42
42
  scripts:
43
43
  - voice-help.js
44
+ sure_ui:
45
+ - table
46
+ - buttons
44
47
  cssClasses:
45
48
  form: sure-table
46
49
  field: sure-table__cell
@@ -35,6 +35,10 @@ behavior:
35
35
  successChime: false
36
36
  voiceHelp: false
37
37
  autoFocus: true
38
+ sure_ui:
39
+ - dialog
40
+ - form
41
+ - buttons
38
42
  cssClasses:
39
43
  overlay: sure-dialog-overlay
40
44
  dialog: sure-dialog
@@ -38,6 +38,9 @@ behavior:
38
38
  confirmBeforeCancel: true
39
39
  scripts:
40
40
  - voice-help.js
41
+ sure_ui:
42
+ - modal
43
+ - buttons
41
44
  cssClasses:
42
45
  form: sure-modal__form
43
46
  field: sure-modal__field
@@ -35,6 +35,9 @@ behavior:
35
35
  scripts:
36
36
  - error-bell.js
37
37
  - voice-help.js
38
+ sure_ui:
39
+ - form
40
+ - buttons
38
41
  cssClasses:
39
42
  form: sure-form
40
43
  field: sure-form__field
@@ -16,6 +16,10 @@ behavior:
16
16
  audio:
17
17
  errorBell: false
18
18
  successChime: false
19
+ sure_ui:
20
+ - menu
21
+ - form
22
+ - buttons
19
23
  cssClasses:
20
24
  menu: sure-menu
21
25
  item: sure-menu__item
@@ -17,6 +17,10 @@ behavior:
17
17
  errorBell: false
18
18
  successChime: false
19
19
  voiceHelp: false
20
+ sure_ui:
21
+ - markdown
22
+ - form
23
+ - buttons
20
24
  cssClasses:
21
25
  root: sure-markdown
22
26
  code: sure-markdown code
@@ -15,6 +15,10 @@ behavior:
15
15
  audio:
16
16
  errorBell: false
17
17
  successChime: false
18
+ sure_ui:
19
+ - sessions
20
+ - form
21
+ - buttons
18
22
  cssClasses:
19
23
  actionsContainer: msg-actions
20
24
  actionButton: msg-actions button
@@ -15,6 +15,9 @@ behavior:
15
15
  audio:
16
16
  errorBell: false
17
17
  successChime: false
18
+ sure_ui:
19
+ - form
20
+ - buttons
18
21
  cssClasses:
19
22
  panel: preview-panel
20
23
  header: preview-panel__header
@@ -37,6 +37,9 @@ behavior:
37
37
  confirmBeforeCancel: false
38
38
  scripts:
39
39
  - voice-help.js
40
+ sure_ui:
41
+ - search
42
+ - buttons
40
43
  cssClasses:
41
44
  form: sure-search
42
45
  field: sure-search__input
@@ -23,6 +23,10 @@ behavior:
23
23
  audio:
24
24
  errorBell: false
25
25
  successChime: false
26
+ sure_ui:
27
+ - sessions
28
+ - form
29
+ - buttons
26
30
  cssClasses:
27
31
  list: sure-session-list
28
32
  item: sure-session-item
@@ -13,6 +13,14 @@ export interface GeneratedOutput {
13
13
  i18n: Record<string, string>;
14
14
  styles: string;
15
15
  scripts: string[];
16
+ /**
17
+ * sure-ui's notifications runtime (showNotification/clearNotifications),
18
+ * emitted ONLY when the component declares a non-inline notification mode
19
+ * (toast/statusBar/sidePanel need it; pure-inline components don't). Null
20
+ * means "your component needs no runtime" — write the string to disk as
21
+ * notifications.js when present.
22
+ */
23
+ notifications: string | null;
16
24
  validation: string;
17
25
  sanitization: string;
18
26
  }
@@ -1 +1 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../src/generate.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAc,MAAM,iBAAiB,CAAA;AAC7D,OAAO,KAAK,EAAe,gBAAgB,EAAE,MAAM,YAAY,CAAA;AAK/D,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,WAAW,GAAG,YAAY,CAAA;AAEhE,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,cAAc,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC5B,MAAM,EAAE,MAAM,CAAA;IACd,OAAO,EAAE,MAAM,EAAE,CAAA;IACjB,UAAU,EAAE,MAAM,CAAA;IAClB,YAAY,EAAE,MAAM,CAAA;CACrB;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,eAAe,GAAG,eAAe,CA0D7F;AAwKD;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,gBAAgB,GAAG,MAAM,EAAE,CAE7E;AAED,wBAAgB,uBAAuB,CAAC,SAAS,EAAE,gBAAgB,GAAG,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC,CAE7G;AAED,wBAAgB,oBAAoB,CAAC,aAAa,E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G,KAAK,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,CAAC,CAIpG"}
package/dist/generate.js CHANGED
@@ -1,7 +1,10 @@
1
1
  import { readFileSync, existsSync } from 'fs';
2
+ import { createRequire } from 'module';
3
+ import { join, dirname } from 'path';
2
4
  import { matchColumnToTypeSync, loadAllTypesSync } from './match.js';
3
5
  import { parseYaml } from './parse-yaml.js';
4
6
  import { objectBody, sanitizeStepLiteral, toRegexLiteral, uniqueKey } from './generate-internal.js';
7
+ import { compose } from '@shing.wong/sure-ui';
5
8
  export function generateForTier(schema, options) {
6
9
  const { tier, component: componentName } = options;
7
10
  const component = loadComponent(componentName);
@@ -50,6 +53,7 @@ export function generateForTier(schema, options) {
50
53
  i18n: generateI18n(fields, options.locale ?? 'en'),
51
54
  styles: generateStyles(component, options.theme ?? 'nord'),
52
55
  scripts: resolveComponentScripts(component),
56
+ notifications: notificationsRuntime(component),
53
57
  validation: objectBody(validationEntries),
54
58
  sanitization: objectBody(sanitizeEntries, ''),
55
59
  };
@@ -206,8 +210,8 @@ function scriptExists(name) {
206
210
  return false;
207
211
  try {
208
212
  const url = new URL(`../catalog/assets/${name}`, import.meta.url);
209
- // Assets live in type subdirectories (audio/, i18n/, data/, themes/).
210
- for (const dir of ['', 'audio', 'i18n', 'data', 'themes']) {
213
+ // Assets live in type subdirectories (audio/, i18n/, data/).
214
+ for (const dir of ['', 'audio', 'i18n', 'data']) {
211
215
  const candidate = new URL(dir ? `${dir}/${name}` : name, url);
212
216
  if (existsSync(candidate))
213
217
  return true;
@@ -236,15 +240,70 @@ export function loadComponentScripts(componentName) {
236
240
  return inspectComponentScripts(component);
237
241
  }
238
242
  /**
239
- * Emit declarations for the component's cssClasses. The previous output was a
240
- * single comment naming the theme, so a caller writing `styles` to disk got no
241
- * rules at all.
243
+ * Emit the component's styles as sure-ui `compose()` output over the block
244
+ * list the yaml declares in `sure_ui` — one token-driven theme, no hand-rolled
245
+ * palette. The registry test keeps `sure_ui` honest against sure-ui's
246
+ * COMPONENTS and against the template's hardcoded classes.
247
+ *
248
+ * Only the *template defaults* (the generic `field`/`field-label`/… class
249
+ * names used when a yaml's cssClasses omits that role) get local rules here —
250
+ * compose styles sure-ui classes, not these. The error rule uses the theme's
251
+ * `--error-ink` token: a hardcoded colour pins the page to one palette.
242
252
  */
253
+ const TEMPLATE_DEFAULTS = { form: 'sure-form', field: 'field', label: 'field-label', input: 'field-input', error: 'field-error', help: 'field-help' };
254
+ const FALLBACK_RULES = {
255
+ form: 'display: flex; flex-direction: column; gap: 0.75rem;',
256
+ field: 'display: flex; flex-direction: column; gap: 0.25rem;',
257
+ label: 'font-weight: 600; font-size: 0.875rem;',
258
+ input: 'padding: 0.5rem; border: 1px solid currentColor; border-radius: 4px;',
259
+ help: 'font-size: 0.8125rem; opacity: 0.75;',
260
+ error: 'font-size: 0.8125rem; color: var(--error-ink);',
261
+ };
243
262
  function generateStyles(component, theme) {
244
263
  const cc = component.cssClasses ?? {};
245
- const rules = [`/* Theme: ${theme} — generated by sure-factor for "${component.name}" */`];
246
- const role = (name, fallback) => cc[name] ?? fallback;
247
- rules.push(`.${role('form', 'field-form')} { display: flex; flex-direction: column; gap: 0.75rem; }`, `.${role('field', 'field')} { display: flex; flex-direction: column; gap: 0.25rem; }`, `.${role('label', 'field-label')} { font-weight: 600; font-size: 0.875rem; }`, `.${role('input', 'field-input')} { padding: 0.5rem; border: 1px solid currentColor; border-radius: 4px; }`, `.${role('help', 'field-help')} { font-size: 0.8125rem; opacity: 0.75; }`, `.${role('error', 'field-error')} { font-size: 0.8125rem; color: #b00020; }`);
248
- return rules.join('\n');
264
+ const blocks = (component.sure_ui ?? []);
265
+ const composed = compose({ theme, components: blocks });
266
+ // A role the yaml maps to a sure-* class is styled by compose; only emit a
267
+ // local rule for the class the template will actually render that compose
268
+ // does not cover (generic defaults, catalog-private classes). The rules go
269
+ // through compose's `extra` so they land INSIDE the components layer —
270
+ // emitted after the layers they would be unlayered, and unlayered CSS
271
+ // beats the theme regardless of specificity (the e2e caught exactly this:
272
+ // an unlayered 4px override beating compose's 6px).
273
+ const styledBy = (cls) => new RegExp(`\\.${cls.replace(/[.*+?^${}()|[\]\\]/g, '\\$&')}(?![\\w-])`).test(composed);
274
+ const fallbacks = [];
275
+ for (const [role, decl] of Object.entries(FALLBACK_RULES)) {
276
+ const key = role;
277
+ const cls = cc[key] ?? TEMPLATE_DEFAULTS[key];
278
+ if (!styledBy(cls))
279
+ fallbacks.push(`.${cls} { ${decl} }`);
280
+ }
281
+ const header = `/* Theme: ${theme} — sure-ui compose [${blocks.join(', ')}] for "${component.name}" */`;
282
+ const css = fallbacks.length > 0 ? compose({ theme, components: blocks, extra: fallbacks.join('\n') }) : composed;
283
+ return `${header}\n${css}`;
284
+ }
285
+ /** sure-ui ships a self-contained notifications runtime (no imports). */
286
+ let notificationsSource = null;
287
+ function loadNotificationsSource() {
288
+ if (notificationsSource !== null)
289
+ return notificationsSource;
290
+ const entry = createRequire(import.meta.url).resolve('@shing.wong/sure-ui');
291
+ const runtime = join(dirname(entry), 'notifications.js');
292
+ if (!existsSync(runtime)) {
293
+ throw new Error(`notifications.js not found next to ${entry} — reinstall @shing.wong/sure-ui (its prepare script builds dist/)`);
294
+ }
295
+ // drop the sourceMappingURL comment: the generated app ships no .map
296
+ notificationsSource = readFileSync(runtime, 'utf8').replace(/\n?\/\/# sourceMappingURL=.*$/, '');
297
+ return notificationsSource;
298
+ }
299
+ /**
300
+ * Emit the notifications runtime only for components that declare a
301
+ * non-inline mode (toast/statusBar/sidePanel render through it). Pure-inline
302
+ * components — and components with no modes at all — get null: writing the
303
+ * runtime there would ship bytes nothing calls.
304
+ */
305
+ function notificationsRuntime(component) {
306
+ const modes = component.behavior?.notificationModes ?? [];
307
+ return modes.some((m) => m !== 'inline') ? loadNotificationsSource() : null;
249
308
  }
250
309
  //# sourceMappingURL=generate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"generate.js","sour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AAA;IAChG,OAAO,mBAAmB,CAAA;AAC5B,CAAC;AAED;;;;;GAKG;AACH,SAAS,oBAAoB,CAAC,SAA2B;IACvD,MAAM,KAAK,GAAG,SAAS,CAAC,QAAQ,EAAE,iBAAiB,IAAI,EAAE,CAAA;IACzD,OAAO,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,uBAAuB,EAAE,CAAC,CAAC,CAAC,IAAI,CAAA;AAC7E,CAAC"}
package/dist/match.d.ts CHANGED
@@ -6,5 +6,18 @@ export interface TypeMatchResult {
6
6
  }
7
7
  export declare function matchColumnToType(column: ColumnInfo, tier?: 'vibe' | 'prototype' | 'production'): Promise<TypeMatchResult | null>;
8
8
  export declare function loadAllTypesSync(): CatalogType[];
9
- export declare function matchColumnToTypeSync(column: ColumnInfo, types: CatalogType[], tier?: 'vibe' | 'prototype' | 'production'): TypeMatchResult | null;
9
+ /**
10
+ * Find the catalog type that best describes a column.
11
+ *
12
+ * `column` accepts a bare name as a convenience, because "which type is this
13
+ * column?" is the whole question this answers and passing a string is the
14
+ * obvious thing to try. A string carries no data type, so it is matched on name
15
+ * alone — if the catalog has a rule keyed on `data_type` and the caller's column
16
+ * name does not identify a type on its own, the answer is `null` rather than a
17
+ * guess. Pass a `ColumnInfo` when you have one.
18
+ *
19
+ * Throws a named error rather than failing inside the matcher: a `TypeError` on
20
+ * `column.columnName` told an agent nothing about what was expected.
21
+ */
22
+ export declare function matchColumnToTypeSync(column: ColumnInfo | string, types: CatalogType[], tier?: 'vibe' | 'prototype' | 'production'): TypeMatchResult | null;
10
23
  //# sourceMappingURL=match.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"match.d.ts","sourceRoot":"","sources":["../src/match.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAA;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAA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