@colixsystems/widget-sdk 0.314.0 → 0.315.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
@@ -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.314.0` — 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**.
93
+ `v0.315.1` — 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.315.1 (contract 1.255.0)
96
+
97
+ **`text-literal-unexposed` points at translation.** The rule still flags copy pinned in a `<Text>`; its message now says to render each line through `t("key", "<that text>")` so it translates, instead of moving it into a `propertySchema` string, whose default has one value for every language.
98
+
99
+ ### What's new in 0.315.0 (contract 1.255.0)
100
+
101
+ **The theme's type scale never goes below 12 px.** `CONTRACT.minFontPx` (12) is the smallest page text the render check accepts, and the lower bound of the theme's font sizes: the six text tiers in `theme.typography.roles` and the Buttons and Text component sizes. A smaller value now clamps up to it instead of to 8, in the web Player, in the exported app and when the theme is saved, so a size taken from `useTheme()` always passes the app's render check. Text you size yourself should stay at or above it too. A theme already at 12 or more renders exactly as before.
94
102
 
95
103
  ### What's new in 0.314.0 (contract 1.254.0)
96
104
 
package/dist/contract.cjs CHANGED
@@ -313,6 +313,11 @@ const THEME_TEXT_ROLE_FONT_WEIGHTS = Object.freeze([
313
313
 
314
314
  const THEME_TEXT_ROLE_FONT_STYLES = Object.freeze(["normal", "italic"]);
315
315
 
316
+ // sc-16654 — the smallest page text the render check accepts (TEXT_TOO_SMALL
317
+ // reads this value). The type scale and component font sizes clamp up to it on
318
+ // both hosts and at save; a per-widget size is the author's own choice.
319
+ const MIN_FONT_PX = 12;
320
+
316
321
  // The per-role token vocabulary, declared like a `themeComponents` scope's
317
322
  // `tokens`: each field's value type and bounds stated ONCE, so the Studio
318
323
  // control, the set_theme coercion and the host validator cannot disagree.
@@ -320,7 +325,7 @@ const THEME_TEXT_ROLE_FONT_STYLES = Object.freeze(["normal", "italic"]);
320
325
  // value is right at every size; `color` overrides the role's surface-aware
321
326
  // `colorToken`, which is why no role seeds a literal colour.
322
327
  const THEME_TEXT_ROLE_FIELDS = Object.freeze({
323
- fontSize: Object.freeze({ type: "size", min: 8, max: 96 }),
328
+ fontSize: Object.freeze({ type: "size", min: MIN_FONT_PX, max: 96 }),
324
329
  fontWeight: Object.freeze({ type: "enum", values: THEME_TEXT_ROLE_FONT_WEIGHTS }),
325
330
  fontStyle: Object.freeze({ type: "enum", values: THEME_TEXT_ROLE_FONT_STYLES }),
326
331
  lineHeight: Object.freeze({ type: "decimal", min: 0.8, max: 3, step: 0.05 }),
@@ -561,7 +566,7 @@ const THEME_COMPONENTS = Object.freeze({
561
566
  textColor: Object.freeze({ type: "color", uiDefault: "colors.onPrimary" }),
562
567
  borderColor: Object.freeze({ type: "color", uiDefault: "colors.border" }),
563
568
  radius: Object.freeze({ type: "size", min: 0, max: 48, uiDefault: "radii.sm" }),
564
- fontSize: Object.freeze({ type: "size", min: 8, max: 96, uiDefault: "typography.sizes.sm" }),
569
+ fontSize: Object.freeze({ type: "size", min: MIN_FONT_PX, max: 96, uiDefault: "typography.sizes.sm" }),
565
570
  shadow: Object.freeze({ type: "shadow" }),
566
571
  gradient: Object.freeze({ type: "gradient" }),
567
572
  }),
@@ -615,7 +620,7 @@ const THEME_COMPONENTS = Object.freeze({
615
620
  label: "Text",
616
621
  tokens: Object.freeze({
617
622
  color: Object.freeze({ type: "color", uiDefault: "colors.onSurface" }),
618
- fontSize: Object.freeze({ type: "size", min: 8, max: 96, uiDefault: "typography.sizes.md" }),
623
+ fontSize: Object.freeze({ type: "size", min: MIN_FONT_PX, max: 96, uiDefault: "typography.sizes.md" }),
619
624
  // sc-3857 — leading as a MULTIPLE of the font size, so one app-wide value
620
625
  // is right at every size; `size` cannot carry it because it rounds.
621
626
  lineHeight: Object.freeze({ type: "decimal", min: 0.8, max: 3, step: 0.05 }),
@@ -6957,7 +6962,10 @@ const CONTRACT = deepFreeze({
6957
6962
  // so `useSafeAreaInsets()` returns zeros on web as documented instead of throwing.
6958
6963
  // 1.254.0: `formatMoney` shows a whole amount without decimals ("795 kr");
6959
6964
  // `formatMoney(minor, { decimals: "always" })` keeps them ("795,00 kr").
6960
- version: "1.254.0",
6965
+ // 1.255.0: fix (sc-16654) — `minFontPx` (12) publishes the smallest page text
6966
+ // the render check accepts. The theme's six text tiers and its Buttons and
6967
+ // Text component sizes now clamp up to it instead of to 8.
6968
+ version: "1.255.0",
6961
6969
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
6962
6970
  hooks: HOOKS,
6963
6971
  primitives: PRIMITIVES,
@@ -6979,6 +6987,7 @@ const CONTRACT = deepFreeze({
6979
6987
  themeComponentGradient: THEME_COMPONENT_GRADIENT,
6980
6988
  themeTextRoles: THEME_TEXT_ROLES,
6981
6989
  themeTextRoleFields: THEME_TEXT_ROLE_FIELDS,
6990
+ minFontPx: MIN_FONT_PX,
6982
6991
  themeSpacingScale: THEME_SPACING_SCALE,
6983
6992
  themeMenuTypes: THEME_MENU_TYPES,
6984
6993
  themeWidgetStyles: THEME_WIDGET_STYLES,
package/dist/contract.js CHANGED
@@ -308,6 +308,11 @@ const THEME_TEXT_ROLE_FONT_WEIGHTS = Object.freeze([
308
308
 
309
309
  const THEME_TEXT_ROLE_FONT_STYLES = Object.freeze(["normal", "italic"]);
310
310
 
311
+ // sc-16654 — the smallest page text the render check accepts (TEXT_TOO_SMALL
312
+ // reads this value). The type scale and component font sizes clamp up to it on
313
+ // both hosts and at save; a per-widget size is the author's own choice.
314
+ const MIN_FONT_PX = 12;
315
+
311
316
  // The per-role token vocabulary, declared like a `themeComponents` scope's
312
317
  // `tokens`: each field's value type and bounds stated ONCE, so the Studio
313
318
  // control, the set_theme coercion and the host validator cannot disagree.
@@ -315,7 +320,7 @@ const THEME_TEXT_ROLE_FONT_STYLES = Object.freeze(["normal", "italic"]);
315
320
  // value is right at every size; `color` overrides the role's surface-aware
316
321
  // `colorToken`, which is why no role seeds a literal colour.
317
322
  const THEME_TEXT_ROLE_FIELDS = Object.freeze({
318
- fontSize: Object.freeze({ type: "size", min: 8, max: 96 }),
323
+ fontSize: Object.freeze({ type: "size", min: MIN_FONT_PX, max: 96 }),
319
324
  fontWeight: Object.freeze({ type: "enum", values: THEME_TEXT_ROLE_FONT_WEIGHTS }),
320
325
  fontStyle: Object.freeze({ type: "enum", values: THEME_TEXT_ROLE_FONT_STYLES }),
321
326
  lineHeight: Object.freeze({ type: "decimal", min: 0.8, max: 3, step: 0.05 }),
@@ -556,7 +561,7 @@ const THEME_COMPONENTS = Object.freeze({
556
561
  textColor: Object.freeze({ type: "color", uiDefault: "colors.onPrimary" }),
557
562
  borderColor: Object.freeze({ type: "color", uiDefault: "colors.border" }),
558
563
  radius: Object.freeze({ type: "size", min: 0, max: 48, uiDefault: "radii.sm" }),
559
- fontSize: Object.freeze({ type: "size", min: 8, max: 96, uiDefault: "typography.sizes.sm" }),
564
+ fontSize: Object.freeze({ type: "size", min: MIN_FONT_PX, max: 96, uiDefault: "typography.sizes.sm" }),
560
565
  shadow: Object.freeze({ type: "shadow" }),
561
566
  gradient: Object.freeze({ type: "gradient" }),
562
567
  }),
@@ -610,7 +615,7 @@ const THEME_COMPONENTS = Object.freeze({
610
615
  label: "Text",
611
616
  tokens: Object.freeze({
612
617
  color: Object.freeze({ type: "color", uiDefault: "colors.onSurface" }),
613
- fontSize: Object.freeze({ type: "size", min: 8, max: 96, uiDefault: "typography.sizes.md" }),
618
+ fontSize: Object.freeze({ type: "size", min: MIN_FONT_PX, max: 96, uiDefault: "typography.sizes.md" }),
614
619
  // sc-3857 — leading as a MULTIPLE of the font size, so one app-wide value
615
620
  // is right at every size; `size` cannot carry it because it rounds.
616
621
  lineHeight: Object.freeze({ type: "decimal", min: 0.8, max: 3, step: 0.05 }),
@@ -6952,7 +6957,10 @@ const CONTRACT = deepFreeze({
6952
6957
  // so `useSafeAreaInsets()` returns zeros on web as documented instead of throwing.
6953
6958
  // 1.254.0: `formatMoney` shows a whole amount without decimals ("795 kr");
6954
6959
  // `formatMoney(minor, { decimals: "always" })` keeps them ("795,00 kr").
6955
- version: "1.254.0",
6960
+ // 1.255.0: fix (sc-16654) — `minFontPx` (12) publishes the smallest page text
6961
+ // the render check accepts. The theme's six text tiers and its Buttons and
6962
+ // Text component sizes now clamp up to it instead of to 8.
6963
+ version: "1.255.0",
6956
6964
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
6957
6965
  hooks: HOOKS,
6958
6966
  primitives: PRIMITIVES,
@@ -6974,6 +6982,7 @@ const CONTRACT = deepFreeze({
6974
6982
  themeComponentGradient: THEME_COMPONENT_GRADIENT,
6975
6983
  themeTextRoles: THEME_TEXT_ROLES,
6976
6984
  themeTextRoleFields: THEME_TEXT_ROLE_FIELDS,
6985
+ minFontPx: MIN_FONT_PX,
6977
6986
  themeSpacingScale: THEME_SPACING_SCALE,
6978
6987
  themeMenuTypes: THEME_MENU_TYPES,
6979
6988
  themeWidgetStyles: THEME_WIDGET_STYLES,
package/dist/index.d.ts CHANGED
@@ -6454,6 +6454,8 @@ export interface AiWidgetContract {
6454
6454
  readonly badgeCounterExport: "useBadgeCount";
6455
6455
  /** The most native Text / TextInput grow with the device font-scale setting. */
6456
6456
  readonly maxFontSizeMultiplier: number;
6457
+ /** The smallest page text in px the render check accepts; the theme's type scale clamps up to it. */
6458
+ readonly minFontPx: number;
6457
6459
  readonly bannedApis: ReadonlyArray<ContractBannedApi>;
6458
6460
  readonly allowedBareImports: ReadonlyArray<string>;
6459
6461
  /** Bare specifiers the web host provides by exact name; a widget bundle never inlines them. */
package/dist/linter.cjs CHANGED
@@ -2863,9 +2863,10 @@ function _hardcodedDesignRules(source) {
2863
2863
  `useTheme() (theme.colors.* / theme.typography.* / theme.radii.*), ` +
2864
2864
  `use the SDK's <Card> / <Button> / <ListRow>, or declare a ` +
2865
2865
  `styleSchema field and apply props.style.<field>. License a value ` +
2866
- `that truly cannot be a token — a series palette, a video ` +
2867
- `letterbox, a QR plate — with a preceding ` +
2868
- `"// appstudio-design-ok: <reason>".`,
2866
+ `that truly cannot be a token — a video letterbox, a QR plate — ` +
2867
+ `with a preceding ` +
2868
+ `"// appstudio-design-ok: <reason>". A colour per category comes ` +
2869
+ `from chartColors(theme).series(i).`,
2869
2870
  line: i + 1,
2870
2871
  snippet: (sourceLines[i] || "").trim().slice(0, 200),
2871
2872
  });
@@ -3247,8 +3248,7 @@ function _textLiteralFindings(occurrences) {
3247
3248
  label:
3248
3249
  `Copy pinned in a <Text> reaches neither author nor translation: ` +
3249
3250
  `${listed.join(", ")}${more > 0 ? `, …(+${more} more)` : ""}. ` +
3250
- `Declare each as a propertySchema string defaulting to that text ` +
3251
- `and render the prop; fixed chrome uses t().`,
3251
+ `Render each through t("key", "<that text>") so it translates.`,
3252
3252
  line: occurrences[0].line,
3253
3253
  snippet: _clip(occurrences[0].text, 12),
3254
3254
  },
package/dist/linter.js CHANGED
@@ -2858,9 +2858,10 @@ function _hardcodedDesignRules(source) {
2858
2858
  `useTheme() (theme.colors.* / theme.typography.* / theme.radii.*), ` +
2859
2859
  `use the SDK's <Card> / <Button> / <ListRow>, or declare a ` +
2860
2860
  `styleSchema field and apply props.style.<field>. License a value ` +
2861
- `that truly cannot be a token — a series palette, a video ` +
2862
- `letterbox, a QR plate — with a preceding ` +
2863
- `"// appstudio-design-ok: <reason>".`,
2861
+ `that truly cannot be a token — a video letterbox, a QR plate — ` +
2862
+ `with a preceding ` +
2863
+ `"// appstudio-design-ok: <reason>". A colour per category comes ` +
2864
+ `from chartColors(theme).series(i).`,
2864
2865
  line: i + 1,
2865
2866
  snippet: (sourceLines[i] || "").trim().slice(0, 200),
2866
2867
  });
@@ -3242,8 +3243,7 @@ function _textLiteralFindings(occurrences) {
3242
3243
  label:
3243
3244
  `Copy pinned in a <Text> reaches neither author nor translation: ` +
3244
3245
  `${listed.join(", ")}${more > 0 ? `, …(+${more} more)` : ""}. ` +
3245
- `Declare each as a propertySchema string defaulting to that text ` +
3246
- `and render the prop; fixed chrome uses t().`,
3246
+ `Render each through t("key", "<that text>") so it translates.`,
3247
3247
  line: occurrences[0].line,
3248
3248
  snippet: _clip(occurrences[0].text, 12),
3249
3249
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colixsystems/widget-sdk",
3
- "version": "0.314.0",
3
+ "version": "0.315.1",
4
4
  "description": "Common widget interface for AppStudio. Implements WidgetManifest, WidgetContext, property schema, and helper hooks.",
5
5
  "homepage": "https://github.com/Colix-AB/AppStudio",
6
6
  "type": "module",
package/src/contract.js CHANGED
@@ -308,6 +308,11 @@ const THEME_TEXT_ROLE_FONT_WEIGHTS = Object.freeze([
308
308
 
309
309
  const THEME_TEXT_ROLE_FONT_STYLES = Object.freeze(["normal", "italic"]);
310
310
 
311
+ // sc-16654 — the smallest page text the render check accepts (TEXT_TOO_SMALL
312
+ // reads this value). The type scale and component font sizes clamp up to it on
313
+ // both hosts and at save; a per-widget size is the author's own choice.
314
+ const MIN_FONT_PX = 12;
315
+
311
316
  // The per-role token vocabulary, declared like a `themeComponents` scope's
312
317
  // `tokens`: each field's value type and bounds stated ONCE, so the Studio
313
318
  // control, the set_theme coercion and the host validator cannot disagree.
@@ -315,7 +320,7 @@ const THEME_TEXT_ROLE_FONT_STYLES = Object.freeze(["normal", "italic"]);
315
320
  // value is right at every size; `color` overrides the role's surface-aware
316
321
  // `colorToken`, which is why no role seeds a literal colour.
317
322
  const THEME_TEXT_ROLE_FIELDS = Object.freeze({
318
- fontSize: Object.freeze({ type: "size", min: 8, max: 96 }),
323
+ fontSize: Object.freeze({ type: "size", min: MIN_FONT_PX, max: 96 }),
319
324
  fontWeight: Object.freeze({ type: "enum", values: THEME_TEXT_ROLE_FONT_WEIGHTS }),
320
325
  fontStyle: Object.freeze({ type: "enum", values: THEME_TEXT_ROLE_FONT_STYLES }),
321
326
  lineHeight: Object.freeze({ type: "decimal", min: 0.8, max: 3, step: 0.05 }),
@@ -556,7 +561,7 @@ const THEME_COMPONENTS = Object.freeze({
556
561
  textColor: Object.freeze({ type: "color", uiDefault: "colors.onPrimary" }),
557
562
  borderColor: Object.freeze({ type: "color", uiDefault: "colors.border" }),
558
563
  radius: Object.freeze({ type: "size", min: 0, max: 48, uiDefault: "radii.sm" }),
559
- fontSize: Object.freeze({ type: "size", min: 8, max: 96, uiDefault: "typography.sizes.sm" }),
564
+ fontSize: Object.freeze({ type: "size", min: MIN_FONT_PX, max: 96, uiDefault: "typography.sizes.sm" }),
560
565
  shadow: Object.freeze({ type: "shadow" }),
561
566
  gradient: Object.freeze({ type: "gradient" }),
562
567
  }),
@@ -610,7 +615,7 @@ const THEME_COMPONENTS = Object.freeze({
610
615
  label: "Text",
611
616
  tokens: Object.freeze({
612
617
  color: Object.freeze({ type: "color", uiDefault: "colors.onSurface" }),
613
- fontSize: Object.freeze({ type: "size", min: 8, max: 96, uiDefault: "typography.sizes.md" }),
618
+ fontSize: Object.freeze({ type: "size", min: MIN_FONT_PX, max: 96, uiDefault: "typography.sizes.md" }),
614
619
  // sc-3857 — leading as a MULTIPLE of the font size, so one app-wide value
615
620
  // is right at every size; `size` cannot carry it because it rounds.
616
621
  lineHeight: Object.freeze({ type: "decimal", min: 0.8, max: 3, step: 0.05 }),
@@ -6952,7 +6957,10 @@ const CONTRACT = deepFreeze({
6952
6957
  // so `useSafeAreaInsets()` returns zeros on web as documented instead of throwing.
6953
6958
  // 1.254.0: `formatMoney` shows a whole amount without decimals ("795 kr");
6954
6959
  // `formatMoney(minor, { decimals: "always" })` keeps them ("795,00 kr").
6955
- version: "1.254.0",
6960
+ // 1.255.0: fix (sc-16654) — `minFontPx` (12) publishes the smallest page text
6961
+ // the render check accepts. The theme's six text tiers and its Buttons and
6962
+ // Text component sizes now clamp up to it instead of to 8.
6963
+ version: "1.255.0",
6956
6964
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
6957
6965
  hooks: HOOKS,
6958
6966
  primitives: PRIMITIVES,
@@ -6974,6 +6982,7 @@ const CONTRACT = deepFreeze({
6974
6982
  themeComponentGradient: THEME_COMPONENT_GRADIENT,
6975
6983
  themeTextRoles: THEME_TEXT_ROLES,
6976
6984
  themeTextRoleFields: THEME_TEXT_ROLE_FIELDS,
6985
+ minFontPx: MIN_FONT_PX,
6977
6986
  themeSpacingScale: THEME_SPACING_SCALE,
6978
6987
  themeMenuTypes: THEME_MENU_TYPES,
6979
6988
  themeWidgetStyles: THEME_WIDGET_STYLES,