@colixsystems/widget-sdk 0.319.0 → 0.319.2
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 +10 -2
- package/dist/button-view.js +2 -1
- package/dist/host.d.ts +2 -0
- package/dist/linter.cjs +11 -0
- package/dist/linter.js +10 -0
- package/dist/theme-components.cjs +16 -1
- package/dist/theme-components.js +16 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -90,7 +90,15 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
|
|
|
90
90
|
|
|
91
91
|
## Status
|
|
92
92
|
|
|
93
|
-
`v0.
|
|
93
|
+
`v0.319.2` — pre-publish. The package surface (types, function names, export paths) is the v1 contract; runtime behaviour for some hooks is stubbed (each hook documents what's wired and what isn't). It is **not yet published to npm**.
|
|
94
|
+
|
|
95
|
+
### What's new in 0.319.2 (contract 1.259.0)
|
|
96
|
+
|
|
97
|
+
**A danger button stays red when the app's button look gives every button a fill.** A `<Button variant="danger">` (and the built-in Button widget's Danger variant, the destructive `<ConfirmDialog>` confirm and a danger `<IconButton>`) took the Buttons fill, gradient, label and border colour, so a lime button look painted Delete lime too. Its colours now come only from Danger buttons (Design > Components) over the theme's danger colour; with no Danger buttons colours set it draws `theme.colors.danger`, never the general button fill. The Buttons corner radius, size and shadow still apply, and a colour you pass in `fields` or the maker sets on that button still wins. Hosts get the same rule from `applyThemeComponentStyle`, which leaves those four colours out of an `appstudio.button` whose `props.variant` is `"danger"`. The widget contract is unchanged.
|
|
98
|
+
|
|
99
|
+
### What's new in 0.319.1 (contract 1.259.0)
|
|
100
|
+
|
|
101
|
+
**`symbolIconName(text)` from the linter.** It returns the lucide name `text-symbol-icon` names for a text that is one icon symbol (`"✓"` → `"check"`), or `null`. AppStudio's agents use it to redraw such a `<Text>` as `<Icon>` on submit. Additive.
|
|
94
102
|
|
|
95
103
|
### What's new in 0.319.0 (contract 1.259.0)
|
|
96
104
|
|
|
@@ -4047,7 +4055,7 @@ Pass `--manifest` to enable `style-field-unread` and the three editability rules
|
|
|
4047
4055
|
|
|
4048
4056
|
`grid-cell-too-narrow` refuses a `<Grid minCellWidth={N}>` with `N` under 200 whose cell holds more than one `Text`, naming the cell width and the default of 240: a card with a title and a price breaks its words at that width. A cell of a single `Text` passes at any width, and a Grid without `minCellWidth` passes. An error.
|
|
4049
4057
|
|
|
4050
|
-
`text-symbol-icon` flags a JSX text child that is nothing but symbols or emoji (`<Text>✓</Text>`, `<Text>{open ? "▲" : "▼"}</Text>`, or `✓ {label}`), naming the lucide `<Icon>` to draw instead where one is obvious (✓ check, ★ star, → arrow-right, ☰ menu, ⌕ search). A symbol inside running text ("Steg 1 → 2", "© 2026"), bullets and dashes (• · – —), ×, currency signs and flag emoji pass. A warning for a human author, blocking for the AI widget agent and `/mcp/build`.
|
|
4058
|
+
`text-symbol-icon` flags a JSX text child that is nothing but symbols or emoji (`<Text>✓</Text>`, `<Text>{open ? "▲" : "▼"}</Text>`, or `✓ {label}`), naming the lucide `<Icon>` to draw instead where one is obvious (✓ check, ★ star, → arrow-right, ☰ menu, ⌕ search). A symbol inside running text ("Steg 1 → 2", "© 2026"), bullets and dashes (• · – —), ×, currency signs and flag emoji pass. A warning for a human author, blocking for the AI widget agent and `/mcp/build`, which first redraw a `<Text>` holding one mapped symbol as that `<Icon>` at the text's size and colour. `symbolIconName(text)` returns the name the rule maps a lone symbol to, or `null`.
|
|
4051
4059
|
|
|
4052
4060
|
`empty-state-action-outside` flags a `<Button>` or `<Pressable>` placed beside an `<EmptyState>` (next to it, or first in the `View` after it), outside the panel. Pass it as the EmptyState's children. A warning.
|
|
4053
4061
|
|
package/dist/button-view.js
CHANGED
|
@@ -46,6 +46,7 @@ const CENTRED_OVER = {
|
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
// Precedence, weakest first: variant, danger scope, ring, then the fields.
|
|
49
|
+
// A danger button's fields hold no theme-wide button colour (the fold drops it).
|
|
49
50
|
function containerLayers(variant, selected, f, colors, owned) {
|
|
50
51
|
const paint = paintOnBackdrop(variant, variantPaint(variant, colors, selected), colors, owned);
|
|
51
52
|
let ink = paint.ink;
|
|
@@ -86,7 +87,7 @@ function useButtonLook({ variant, selected, fields, hostThemed, style, labelStyl
|
|
|
86
87
|
const theme = useHostTheme() || DEFAULT_THEME_TOKENS;
|
|
87
88
|
const folded = hostThemed
|
|
88
89
|
? fields || {}
|
|
89
|
-
: applyThemeComponentStyle(THEMED_AS, theme, { style: fields }).style || {};
|
|
90
|
+
: applyThemeComponentStyle(THEMED_AS, theme, { variant, style: fields }).style || {};
|
|
90
91
|
const f = isQuietLook(variant, selected) ? quietButtonFields(folded, fields) : folded;
|
|
91
92
|
const owned = ownedButtonPaint(variant, f, flattenStyle(style), flattenStyle(labelStyle));
|
|
92
93
|
const { layers, ink } = containerLayers(variant, selected, f, theme.colors, owned);
|
package/dist/host.d.ts
CHANGED
|
@@ -123,6 +123,8 @@ export function normaliseWidgetStyles(raw: unknown): ThemeWidgetStyles;
|
|
|
123
123
|
* palette/`components.<scope>` -> `widgetStyles[manifestId]` -> per-instance
|
|
124
124
|
* `props.style`. Returns the same `props` reference when neither the theme nor
|
|
125
125
|
* the schema sets anything. Applied by the platform hosts, never by authors.
|
|
126
|
+
* An `appstudio.button` whose `props.variant` is `"danger"` takes no general
|
|
127
|
+
* button colour (background, gradient, text, border) from the theme layers.
|
|
126
128
|
*/
|
|
127
129
|
export function applyThemeComponentStyle<T = Record<string, unknown>>(
|
|
128
130
|
manifestId: string,
|
package/dist/linter.cjs
CHANGED
|
@@ -1180,6 +1180,16 @@ function _iconSymbols(text) {
|
|
|
1180
1180
|
return symbols.every(isIcon) ? symbols.join("") : null;
|
|
1181
1181
|
}
|
|
1182
1182
|
|
|
1183
|
+
/**
|
|
1184
|
+
* The lucide name `text-symbol-icon` names for a text that is exactly one
|
|
1185
|
+
* icon symbol (`"✓"` → `"check"`), or null. Agents' publish paths use it to
|
|
1186
|
+
* redraw such a text as `<Icon>`.
|
|
1187
|
+
*/
|
|
1188
|
+
function symbolIconName(text) {
|
|
1189
|
+
const symbols = typeof text === "string" ? _iconSymbols(text) : null;
|
|
1190
|
+
return symbols && [...symbols].length === 1 ? (_SYMBOL_ICON_NAMES.get(symbols) ?? null) : null;
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1183
1193
|
// A braced child rendering only symbol strings: `{"✓"}`, `{open ? "▲" : "▼"}`.
|
|
1184
1194
|
function _bracedIconSymbols(inner) {
|
|
1185
1195
|
const strings = [...inner.matchAll(_STRING_LITERAL_RE)];
|
|
@@ -3515,6 +3525,7 @@ function lintSource(source, options) {
|
|
|
3515
3525
|
module.exports = {
|
|
3516
3526
|
bannedIdentifiers,
|
|
3517
3527
|
subpathImportRootsFor,
|
|
3528
|
+
symbolIconName,
|
|
3518
3529
|
narrowManifestForFile,
|
|
3519
3530
|
lintStyleWiring,
|
|
3520
3531
|
callsBasicStyle,
|
package/dist/linter.js
CHANGED
|
@@ -1175,6 +1175,16 @@ function _iconSymbols(text) {
|
|
|
1175
1175
|
return symbols.every(isIcon) ? symbols.join("") : null;
|
|
1176
1176
|
}
|
|
1177
1177
|
|
|
1178
|
+
/**
|
|
1179
|
+
* The lucide name `text-symbol-icon` names for a text that is exactly one
|
|
1180
|
+
* icon symbol (`"✓"` → `"check"`), or null. Agents' publish paths use it to
|
|
1181
|
+
* redraw such a text as `<Icon>`.
|
|
1182
|
+
*/
|
|
1183
|
+
export function symbolIconName(text) {
|
|
1184
|
+
const symbols = typeof text === "string" ? _iconSymbols(text) : null;
|
|
1185
|
+
return symbols && [...symbols].length === 1 ? (_SYMBOL_ICON_NAMES.get(symbols) ?? null) : null;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1178
1188
|
// A braced child rendering only symbol strings: `{"✓"}`, `{open ? "▲" : "▼"}`.
|
|
1179
1189
|
function _bracedIconSymbols(inner) {
|
|
1180
1190
|
const strings = [...inner.matchAll(_STRING_LITERAL_RE)];
|
|
@@ -363,6 +363,21 @@ function componentStyleFor(manifestId, components, styleSchema, widgetStyles) {
|
|
|
363
363
|
return Object.keys(out).length > 0 ? out : null;
|
|
364
364
|
}
|
|
365
365
|
|
|
366
|
+
// The general button colours a danger button never takes from the theme.
|
|
367
|
+
const GENERAL_BUTTON_PAINT = Object.freeze(["background", "gradient", "textColor", "borderColor"]);
|
|
368
|
+
|
|
369
|
+
/**
|
|
370
|
+
* A danger button is coloured by the `destructive` scope (its `danger*`
|
|
371
|
+
* fields) over the variant's danger colour, so the theme's general button
|
|
372
|
+
* colours are left out of its themed layer. Its own `props.style` still wins.
|
|
373
|
+
*/
|
|
374
|
+
function withoutGeneralButtonPaint(manifestId, props, themed) {
|
|
375
|
+
if (manifestId !== "appstudio.button" || props.variant !== "danger") return themed;
|
|
376
|
+
const kept = { ...themed };
|
|
377
|
+
for (const field of GENERAL_BUTTON_PAINT) delete kept[field];
|
|
378
|
+
return kept;
|
|
379
|
+
}
|
|
380
|
+
|
|
366
381
|
/**
|
|
367
382
|
* Fold the widget's declared `styleSchema` defaults and the theme's
|
|
368
383
|
* per-component tokens into a widget's props as `style` DEFAULTS. The author's
|
|
@@ -397,7 +412,7 @@ function applyThemeComponentStyle(manifestId, theme, props, styleSchema) {
|
|
|
397
412
|
if (!themed) return props;
|
|
398
413
|
const base = isPlainObject(props) ? props : {};
|
|
399
414
|
const authored = isPlainObject(base.style) ? base.style : null;
|
|
400
|
-
return { ...base, style: { ...themed, ...authored } };
|
|
415
|
+
return { ...base, style: { ...withoutGeneralButtonPaint(manifestId, base, themed), ...authored } };
|
|
401
416
|
}
|
|
402
417
|
module.exports = {
|
|
403
418
|
coerceThemeColor,
|
package/dist/theme-components.js
CHANGED
|
@@ -358,6 +358,21 @@ function componentStyleFor(manifestId, components, styleSchema, widgetStyles) {
|
|
|
358
358
|
return Object.keys(out).length > 0 ? out : null;
|
|
359
359
|
}
|
|
360
360
|
|
|
361
|
+
// The general button colours a danger button never takes from the theme.
|
|
362
|
+
const GENERAL_BUTTON_PAINT = Object.freeze(["background", "gradient", "textColor", "borderColor"]);
|
|
363
|
+
|
|
364
|
+
/**
|
|
365
|
+
* A danger button is coloured by the `destructive` scope (its `danger*`
|
|
366
|
+
* fields) over the variant's danger colour, so the theme's general button
|
|
367
|
+
* colours are left out of its themed layer. Its own `props.style` still wins.
|
|
368
|
+
*/
|
|
369
|
+
function withoutGeneralButtonPaint(manifestId, props, themed) {
|
|
370
|
+
if (manifestId !== "appstudio.button" || props.variant !== "danger") return themed;
|
|
371
|
+
const kept = { ...themed };
|
|
372
|
+
for (const field of GENERAL_BUTTON_PAINT) delete kept[field];
|
|
373
|
+
return kept;
|
|
374
|
+
}
|
|
375
|
+
|
|
361
376
|
/**
|
|
362
377
|
* Fold the widget's declared `styleSchema` defaults and the theme's
|
|
363
378
|
* per-component tokens into a widget's props as `style` DEFAULTS. The author's
|
|
@@ -392,5 +407,5 @@ export function applyThemeComponentStyle(manifestId, theme, props, styleSchema)
|
|
|
392
407
|
if (!themed) return props;
|
|
393
408
|
const base = isPlainObject(props) ? props : {};
|
|
394
409
|
const authored = isPlainObject(base.style) ? base.style : null;
|
|
395
|
-
return { ...base, style: { ...themed, ...authored } };
|
|
410
|
+
return { ...base, style: { ...withoutGeneralButtonPaint(manifestId, base, themed), ...authored } };
|
|
396
411
|
}
|
package/package.json
CHANGED