@colixsystems/widget-sdk 0.343.1 → 0.344.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/README.md CHANGED
@@ -91,7 +91,15 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
91
91
 
92
92
  ## Status
93
93
 
94
- `v0.343.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
+ `v0.344.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**.
95
+
96
+ ### What's new in 0.344.0 (contract 1.281.0)
97
+
98
+ **The linter flags a date shown with a fixed pattern or locale.** A date written with date-fns `format(d, "dd/MM/yyyy")`, `toLocaleDateString("en-GB")`, `new Intl.DateTimeFormat("de-DE")` or a string built from `getDate()` and `getMonth()` reads the same in every app language, and `03/01/2027` is a different day in another country. The new `date-shown-fixed-format` finding names `useI18n().formatDate(value)` as the fix, and `Intl.DateTimeFormat(useI18n().locale, …)` for part of a date. For date-fns it reads `format`, `lightFormat` and date-fns-tz `formatInTimeZone`, imported by name, by default (`date-fns/format`) or as a namespace (`import * as dateFns`). A pattern is flagged when it prints words (`EEE`, `MMM`, `MMMM`, `do`, the localized `P` tokens), which date-fns writes in English unless the call passes a `locale` other than one fixed `date-fns/locale` import, or when it writes a numeric day and month in any order but year-month-day. No finding for: a numeric year-month-day pattern (`yyyy-MM-dd`, `yyyyMMdd`), a date-fns pattern with no day and month and no words (`HH:mm`, `yyyy`), date math (`addDays`, `differenceInDays`), a locale taken from `useI18n().locale`, and a fixed year-first locale (`sv-SE`, `en-CA`, …) with no options or only numeric and `timeZone` options, the usual way to build a local `YYYY-MM-DD` key. Not read: `require("date-fns")` and the curried `date-fns/fp` formatters. It is a **warning**: `appstudio-widget lint` prints it and an uploaded widget still publishes, because the linter reads text and cannot always tell a shown date from a stored one. The in-Studio widget agent's publish gate refuses every lint finding, warnings included, so a widget it writes or edits is repaired before it ships: an edit that touches a widget with its own fixed-pattern date helper rewrites the helper to use `formatDate`. That repair holds even where a widget hard-coded Swedish dates in an app whose language is still English: the date then follows the app's language.
99
+
100
+ ### What's new in 0.343.2 (contract 1.280.0)
101
+
102
+ **`style-field-unread` counts the fields `<Card>` paints from the widget's style when it is handed whole.** The recommended `<Card style={style}>` names none of `cardBackground`, `cardBorderColor`, `cardRadius`, `cardPadding`, `cardGradient`, `shadow` or `margin`, so the rule called every one a dead control, and the widget agent's style repair removed them from the manifest. A widget that hands its style to `<Card style>` now reads all of them, less `margin` under `withoutMargin` (or `withoutMargin={true}`), less any field a `<Card>` prop overrides (`background`, `borderColor`, `radius`, `padding`, `gradient`, `shadow`), and less `cardGradient` on a photo card (`image`). The style counts only where it is the widget's own: `useWidgetStyle()` or a name bound to it, `props.style` (any component's parameter), `style` destructured from a component's props in its parameters or its body (renamed or not), a prop a call site fills from one of those (`<Post cardStyle={style} />`, read as `cardStyle` or `props.cardStyle`, even from another file of the bundle), or a `{ ...style }` copy. A default export wrapped in `memo(…)` or bound to a lowercase name is a component; an array method's callback is not. It may be handed alone, with a fallback (`style || {}`), as either branch of a ternary, as an item of a style array, or spread into an object literal (`{ ...style, flex: 1 }`). A style sheet, the theme, a record's `item.style` or a sub-object such as `style.header` hands over nothing, and neither does a tag whose brackets do not pair. The helpers count for the fields each paints, called or spread (`{ ...marginStyle(style) }`): `cardOverlay` (the card fields except the gradient, plus `shadow` and `margin`), `cardSurfaceStyle` (the same, without `margin`), `cardGradientProps` (`cardGradient`) and `marginStyle` (`margin`). Only names imported from `@colixsystems/widget-sdk` count, under any local alias. Every other field is still read by name. Fix-only: no rule was added or renamed.
95
103
 
96
104
  ### What's new in 0.343.1 (contract 1.280.0)
97
105
 
@@ -2762,7 +2770,7 @@ Additive — one new hook, one new optional context-slice member; no existing ex
2762
2770
  **Two linter rules make the styling contract checkable, and `lintStyleWiring` joins the linter export (sc-6455).** Every visual value a widget writes reaches the app's owner through one of exactly two channels — a **theme token** (`useTheme()`), which is the app-wide default and follows a look change, or a **`styleSchema` field** read off `props.style`, which the Studio offers per instance in the widget editor *and* app-wide under **Design → Widget appearance**. A literal reaches neither: it outranks the theme permanently and no control on either surface can move it, so the owner finds a corner of their app they cannot restyle. Until now that rule was documentation only.
2763
2771
 
2764
2772
  - **`no-hardcoded-design`** flags a colour literal (`#rgb` / `#rrggbb` / `#rrggbbaa`, `rgb()`, `rgba()`, `hsl()`, `hsla()`), a `fontFamily` string literal or (since 0.326.0) a family named as the fallback of a font read (`style.titleFont || "Lora"`), a numeric `fontSize`, or (since 0.165.0) a literal non-zero corner radius (`borderRadius: 12`, any per-corner spelling). A `fontSize` resolved off a theme token or a style field (`style.valueSize ?? 18`) is *not* flagged — a literal `default` beside a declared field is the contract working — and neither is a computed radius (`size / 2`) or `0`. Raw `padding` / `margin` numbers are deliberately out of scope: measured layout legitimately carries them, so a spacing rule would be noise.
2765
- - **`style-field-unread`** flags a `styleSchema` field whose name appears nowhere in the widget's source — a dead control the author moves to no effect. It runs over the WHOLE bundle, not per file, so a split-impl widget that reads a field in `widget.web.jsx` and not in `widget.native.jsx` is correctly counted as wired.
2773
+ - **`style-field-unread`** flags a `styleSchema` field whose name appears nowhere in the widget's source — a dead control the author moves to no effect. It runs over the WHOLE bundle, not per file, so a split-impl widget that reads a field in `widget.web.jsx` and not in `widget.native.jsx` is correctly counted as wired. Since 0.343.2 a field is also read when the widget hands its own style (from `useWidgetStyle()` or `props.style`) whole to the SDK consumer that paints it: `<Card style={style}>` (less a field a `<Card>` prop overrides, `margin` under `withoutMargin` and `cardGradient` on a photo card), `cardOverlay`, `cardSurfaceStyle`, `cardGradientProps` or `marginStyle`, imported from the SDK.
2766
2774
 
2767
2775
  A value that genuinely cannot be a token — a categorical series palette, a video letterbox, a scannable QR plate — is licensed with a preceding comment. **The reason is mandatory**; a bare marker licenses nothing. A marker on its own line covers the whole statement below it (bracket-balanced, so one marker covers a multi-line palette); a trailing marker covers only its own line.
2768
2776
 
package/dist/contract.cjs CHANGED
@@ -7149,7 +7149,11 @@ const CONTRACT = deepFreeze({
7149
7149
  // 1.280.0: additive (sc-18010) — connections.add and connections.signIn
7150
7150
  // may reject SIGN_IN_NEEDS_SETUP (422): the server's sign-in needs the
7151
7151
  // app's administrator to register it first. No token fixes it.
7152
- version: "1.280.0",
7152
+ // 1.281.0: stricter lint (sc-18484) — a date shown with a fixed pattern or
7153
+ // locale (date-fns format(d, "dd/MM/yyyy"), toLocaleDateString("en-GB"),
7154
+ // a hand-built getDate()/getMonth() string) is the `date-shown-fixed-format`
7155
+ // warning; the widget agent's publish gate blocks on it.
7156
+ version: "1.281.0",
7153
7157
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
7154
7158
  hooks: HOOKS,
7155
7159
  primitives: PRIMITIVES,
package/dist/contract.js CHANGED
@@ -7144,7 +7144,11 @@ const CONTRACT = deepFreeze({
7144
7144
  // 1.280.0: additive (sc-18010) — connections.add and connections.signIn
7145
7145
  // may reject SIGN_IN_NEEDS_SETUP (422): the server's sign-in needs the
7146
7146
  // app's administrator to register it first. No token fixes it.
7147
- version: "1.280.0",
7147
+ // 1.281.0: stricter lint (sc-18484) — a date shown with a fixed pattern or
7148
+ // locale (date-fns format(d, "dd/MM/yyyy"), toLocaleDateString("en-GB"),
7149
+ // a hand-built getDate()/getMonth() string) is the `date-shown-fixed-format`
7150
+ // warning; the widget agent's publish gate blocks on it.
7151
+ version: "1.281.0",
7148
7152
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
7149
7153
  hooks: HOOKS,
7150
7154
  primitives: PRIMITIVES,