@colixsystems/widget-sdk 0.348.0 → 0.350.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,17 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
91
91
 
92
92
  ## Status
93
93
 
94
- `v0.348.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**.
94
+ `v0.350.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.350.0 (contract 1.287.0)
97
+
98
+ **A scheduled action script can tell whose account it runs for — `connection` joins `CONTRACT.actionScriptGlobals` (sc-15765).** An Action whose schedule runs once per account app users connected gets that account as `connection`; it is `null` on every other run. The action-sdk README has the details. Nothing changes for widget authors.
99
+
100
+ ### What's new in 0.349.0 (contract 1.286.0)
101
+
102
+ **A full-screen `<Overlay>` draws its own close control, and the new linter rule `full-overlay-no-close` (severity `warning`, non-blocking) flags the clearest case.** `onRequestClose` fires on the backdrop, the Escape key and the Android back button; at `size="full"` there is no backdrop, and an iPhone has no back button, so content with no close of its own traps the user. Draw a visible close (or pause) button inside the overlay that runs the same handler, padded by `useSafeAreaInsets()`. The rule flags only plain display content (text, pictures, video, layout) in an overlay that a press opens. A press handler, a spread, a component of your own or a state that code clears keeps it quiet, so a quiet rule is no proof of a close.
103
+
104
+ Use `size="full"` for content that needs the whole screen or uninterrupted touch: a game, an image, video or PDF preview, a lightbox, a signature or drawing pad, a map's full view, a slideshow. Open it from an inline launcher (a thumbnail, a title card, a button): inside the page, every drag scrolls the page instead.
95
105
 
96
106
  ### What's new in 0.348.0 (contract 1.285.0)
97
107
 
@@ -2754,6 +2764,9 @@ Start the reading from a **user gesture** on both hosts — iOS Safari also need
2754
2764
 
2755
2765
  ```jsx
2756
2766
  <Overlay visible={!!preview} onRequestClose={() => setPreview(null)} size="full">
2767
+ <View style={{ paddingTop: insets.top, paddingRight: insets.right, alignItems: "flex-end" }}>
2768
+ <IconButton icon="x" accessibilityLabel="Close" onPress={() => setPreview(null)} />
2769
+ </View>
2757
2770
  <ScrollView>{renderPreview(preview)}</ScrollView>
2758
2771
  </Overlay>
2759
2772
  ```
@@ -2794,6 +2807,7 @@ Additive — one new hook, one new optional context-slice member; no existing ex
2794
2807
  **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.
2795
2808
 
2796
2809
  - **`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.
2810
+ - **`full-overlay-no-close`** flags an `<Overlay size="full">` that only displays content, with no control to close it. Add a visible close or pause button that runs the same handler as `onRequestClose`.
2797
2811
  - **`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.
2798
2812
 
2799
2813
  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.
@@ -3778,7 +3792,7 @@ import { defineWidget, validateManifest, useDatastoreQuery, Text, View } from "@
3778
3792
  - `useDatastoreQuery`, `useDatastoreRecord`, `useDatastoreSchema`, `useDatastoreMutation`, `useDirectory`, `useUsers`, `useGroups`, `useRecordPermissions`, `useAsset`, `useWidgetEvent`, `useWidgetInput`, `usePayments`, `useSendNotification`, `useTheme`, `useI18n`, `useUser`, `useNavigation`, `useRouteParams`, `usePageContext`, `useWidgetRoute`, `useChildRenderer`, `useClipboard`, `useToast` — hooks that read from the host-provided `WidgetContext` (or, for `useClipboard`, the platform clipboard API directly). `useDirectory(query?)` returns `{ users, loading, error, refetch }` (each user `{ id, name, role }`) and requires the `directory.read:users` scope. `useUsers(query?)` returns `{ users, loading, error, refetch, invite, deactivate, reactivate, remove }` and requires `users.read:*` (mutations also need `users.write:*`); rejections are a `DirectoryError`. `useGroups(query?)` returns `{ groups, loading, error, refetch, create, remove, addMember, removeMember }` and requires `groups.read:*` (mutations also need `groups.write:*`). `usePayments()` returns `{ requestPayment, getPayment }` and requires the `payments.charge:appUser` scope; `requestPayment(...)` rejects with a `PaymentError` carrying `code`, the server's user-safe `message`, and `retryable` (`false` = this charge cannot succeed until the workspace, manifest, or amount changes — show the message, not a retry). `useSendNotification()` returns `{ send, sending, error }` and requires the `notifications.send:appUser` scope; `send({ recipient_user_id, title, body, link?, payload? })` notifies one app user in the same workspace (cross-workspace `recipient_user_id` is rejected), must be called from an event handler rather than render, and rejects with a `NotificationError`. `useUser()` returns the active end-user identity `{ id, email, displayName, roles, groupIds }` (camelCase — the host-built context object, not a wire payload; `id` is `null` for anonymous / preview). `useNavigation()` returns `{ goTo, goToStartPage, scrollToSection, scrollIntoView, goBack, push, replace, back, currentRoute, openLink }` for internal page navigation; `goToStartPage()` opens the signed-in user's own start page (the page the app opens on for them); `scrollToSection(sectionId)` scrolls the current page to one of its sections (bind the id with a `sectionRef` prop); `scrollIntoView(ref)` scrolls it to an element inside the calling widget; `openLink(link)` follows an author- or data-supplied link of unknown shape through the host's shared resolver (in-app page → internal route, off-app http(s) → opened outside, unsafe → refused) and is the safe choice for any value your code did not construct, while `Linking.openURL(url)` is for an external URL you built yourself. `useRouteParams()` returns the current route's params object (`currentRoute.params`) — the flat master→detail accessor; read a param off it (e.g. `recordId`), never call it. `useDatastoreRecord(tableId, recordId)` returns `{ data, loading, error, refetch }` for a single record (data is one row or null). `useDatastoreSchema(tableId)` returns `{ schema, loading, error, refetch }` where `schema` is `{ id, name, columns: [{ id, name, data_type, required, relation_type, target_table_id, is_identification }] }` (structure only, no row data; snake_case verbatim) — use it to resolve a stored `columnId` to its column type at runtime; requires the `datastore.read:<table>` scope. `useAsset(fileId)` returns `{ url, file, loading, error, refetch }` — the `url` is an absolute URL composed against the host's API base. `useChildRenderer()` returns `{ renderNode(node) }` — container widgets call it to render arbitrary child page-tree nodes (prefer the `WidgetTree` component for the common case). `useWidgetInput(inputName)` returns the latest payload a sibling widget published on the event the page author wired to this widget's declared `inputs` entry (`undefined` when unwired or not yet published).
3779
3793
  - `WidgetTree({ node })` — component that renders an author-authored child node through the host's renderer; used by Tabs / Card / custom containers to host arbitrary child widgets.
3780
3794
  - `Text`, `View`, `Pressable`, `Image`, `ScrollView`, `TextInput`, `FlatList`, `SectionList`, `ActivityIndicator`, `Switch`, `StyleSheet`, `Linking`, `Icon`, `DateTimePicker` — re-exported from `react-native` (the RN primitives) or implemented in the SDK (`Icon` wraps `lucide-react-native`; `DateTimePicker` wraps `@react-native-community/datetimepicker` on native and renders `<input type="date|time|datetime-local">` directly on web because the RN library has no react-native-web mapping). The web build aliases `react-native` to `react-native-web` so the RN-re-exported primitives render in the browser without any per-platform code; the exported Expo app's Metro bundler resolves the real `react-native` library. `Linking` is a static API (`Linking.openURL(url)`) — use it for external URLs, and use `useNavigation().goTo(pageId)` for internal page navigation. See https://reactnative.dev/docs/ for per-component props.
3781
- - `Overlay` — the screen-level overlay. `<Overlay visible={!!preview} onRequestClose={() => setPreview(null)} size="full">…</Overlay>` renders its children OUTSIDE the widget's layout box on both hosts (web portals it to the document root, native uses the OS modal), so no clipping card, `ScrollView` or neighbouring widget can cut off a document/media preview, lightbox or confirm dialog — which absolute positioning inside the widget cannot achieve on either platform. Children stay in your own React tree, so state and hooks work normally. `onRequestClose` carries the backdrop press, Escape on web, and the Android back button; `size` is `sm` | `md` (default) | `lg` | `full`; the scrim, surface, radius, padding and elevation come from the workspace theme. An anchored dropdown still belongs inside your own root.
3795
+ - `Overlay` — the screen-level overlay. `<Overlay visible={!!preview} onRequestClose={() => setPreview(null)} size="full">…</Overlay>` renders its children OUTSIDE the widget's layout box on both hosts (web portals it to the document root, native uses the OS modal), so no clipping card, `ScrollView` or neighbouring widget can cut off a document/media preview, lightbox or confirm dialog — which absolute positioning inside the widget cannot achieve on either platform. Children stay in your own React tree, so state and hooks work normally. `onRequestClose` carries the backdrop press, Escape on web, and the Android back button; `size` is `sm` | `md` (default) | `lg` | `full` (draw its own visible close: it has no backdrop); the scrim, surface, radius, padding and elevation come from the workspace theme. An anchored dropdown still belongs inside your own root.
3782
3796
  - `ConfirmDialog` — the standard confirmation prompt, a preset of `Modal` and `Button`. `<ConfirmDialog visible={asking} tone="destructive" title="Delete this order?" message="This cannot be undone." confirmLabel="Delete" onCancel={() => setAsking(false)} onConfirm={removeOrder} />` asks before a delete or any other action that cannot be undone. Cancel, the close button, the backdrop, Escape and the Android back button fire `onCancel`; a promise returned from `onConfirm` keeps it busy (buttons disabled, a second press ignored) until it settles. Props: `visible`, `title`, `message`, `confirmLabel`, `cancelLabel`, `tone` (`default` | `destructive`), `busy`, `onConfirm`, `onCancel`, `closeAccessibilityLabel`, `testID`. Use it instead of building a confirmation from `Modal` yourself.
3783
3797
  - `Modal` — the standard dialog, built on `Overlay`. `<Modal visible={open} onRequestClose={() => setOpen(false)} title="Edit order" footer={<Button title="Save" onPress={save} />}>…</Modal>` draws a title, a close button, a body that scrolls when it is long and a footer action row laid out below it. Its background, corner radius, padding, scrim, shadow and title colour come from the theme's `modal` scope (Design > Components > Dialogs), so every dialog in an app matches. Props: `visible`, `onRequestClose`, `dismissible`, `title`, `footer`, `presentation` (`dialog` | `sheet`), `size` (`sm` | `md` | `lg` | `full`), `dismissOnBackdropPress`, `role`, `initialFocusRef`, `closeAccessibilityLabel`, `accessibilityLabel`, `testID`. Use it for every dialog instead of hand-building a header and an action row inside `Overlay`.
3784
3798
  - `RichText` — the formatted-content renderer. `<RichText value={post.body} />` parses the markdown subset (`**bold**`, `*italic*` / `_italic_`, `` `code` ``, `#`/`##`/`###` headings, `-`/`*` bullets, `1.` ordered items, one-line `![alt](src "large")` images) and renders it with SDK primitives, so formatted content reads the same in the web Player and the exported Expo app. `value` is markdown, NOT HTML — widgets have no `dangerouslySetInnerHTML` on either host, so tags in a content string render as literal tag soup; stored text that still holds legacy HTML is stripped to plain text rather than shown as markup. Props: `value`, `renderImage` (`({ src, alt, size }) => node` — supply it when images are filestore ids, because resolving one needs the scopes your own widget holds; without it only absolute `http(s)` URLs render), `style`, `testID`. Colour, type scale and leading come from the workspace theme — never re-style them.
package/dist/contract.cjs CHANGED
@@ -3751,7 +3751,7 @@ const PRIMITIVES = [
3751
3751
  {
3752
3752
  name: "Overlay",
3753
3753
  description:
3754
- 'Screen-level overlay. `<Overlay visible={open} onRequestClose={() => setOpen(false)} size="md">…panel…</Overlay>`. THE way to open anything that must cover the SCREEN rather than the widget and is not a dialog — a preview (PDF, image, video), a lightbox, a full-screen viewer. A dialog (a title, a close button, actions) is `<Modal>`, which is built on this. It renders OUTSIDE the widget layout box on both hosts (react-native-web portals it to the document root; native uses the OS modal), so no `overflow: hidden` card, scroll container or sibling widget can clip or cover it — which absolute positioning inside the widget cannot achieve on either host. Children stay in your own React tree, so state and hooks work normally. Props: `visible` (boolean, required to show), `onRequestClose` (fired by the backdrop press, the Escape key on web, and the Android back button — always wire it or the overlay cannot be closed), `size` ("sm" | "md" | "lg" | "full", default "md"; `full` runs edge to edge for media), `presentation` ("dialog", centred, the default | "sheet", anchored to the bottom edge), `dismissOnBackdropPress` (default true), `role` ("dialog" default | "alertdialog"; web only), `initialFocusRef` (web only), `accessibilityLabel` (names the dialog), `testID`, and `style` for extra panel styles. The scrim, surface, radius, padding and elevation come from the workspace theme (the scrim from Design > Components > Dialogs) — never re-style them. Keep it for screen-level surfaces: a dropdown anchored to its trigger still belongs inside the widget.',
3754
+ 'Screen-level overlay. `<Overlay visible={open} onRequestClose={() => setOpen(false)} size="md">…panel…</Overlay>`. THE way to open anything that must cover the SCREEN rather than the widget and is not a dialog — a preview (PDF, image, video), a lightbox, a full-screen viewer. A dialog (a title, a close button, actions) is `<Modal>`, which is built on this. It renders OUTSIDE the widget layout box on both hosts (react-native-web portals it to the document root; native uses the OS modal), so no `overflow: hidden` card, scroll container or sibling widget can clip or cover it — which absolute positioning inside the widget cannot achieve on either host. Children stay in your own React tree, so state and hooks work normally. Props: `visible` (boolean, required to show), `onRequestClose` (fired by the backdrop press, the Escape key on web, and the Android back button — always wire it or the overlay cannot be closed), `size` ("sm" | "md" | "lg" | "full", default "md"; `full` runs edge to edge: use it for content that needs the whole screen or uninterrupted touch — a game, an image, video or PDF preview, a lightbox, a signature or drawing pad, a map\'s full view, a slideshow — opened from an inline launcher, because inside the page every drag scrolls the page instead; a `full` overlay MUST draw its own visible close or pause control that runs the same handler as `onRequestClose`, padded by `useSafeAreaInsets()` so a notch never covers it: it has no backdrop to tap and an iPhone has no back button, so without one the user is trapped), `presentation` ("dialog", centred, the default | "sheet", anchored to the bottom edge), `dismissOnBackdropPress` (default true), `role` ("dialog" default | "alertdialog"; web only), `initialFocusRef` (web only), `accessibilityLabel` (names the dialog), `testID`, and `style` for extra panel styles. The scrim, surface, radius, padding and elevation come from the workspace theme (the scrim from Design > Components > Dialogs) — never re-style them. Keep it for screen-level surfaces: a dropdown anchored to its trigger still belongs inside the widget.',
3755
3755
  rnComponent: null,
3756
3756
  docsUrl: null,
3757
3757
  },
@@ -4173,6 +4173,8 @@ const ACTION_SCRIPT_GLOBALS = [
4173
4173
  "triggerTableId",
4174
4174
  // sc-7885 — who initiated the run; null on `schedule` / `record_*`.
4175
4175
  "triggeredBy",
4176
+ // sc-15765 — the account a per-connection scheduled run is for; null otherwise.
4177
+ "connection",
4176
4178
  // sc-9031 — a Run action event's parameters; null on every other trigger.
4177
4179
  "input",
4178
4180
  // sc-13843 — hands the app run its one JSON result.
@@ -7167,7 +7169,12 @@ const CONTRACT = deepFreeze({
7167
7169
  // 1.285.0: additive (sc-18008) — a `datastoreTemplate` column may declare
7168
7170
  // `buyerEmail: true` (an immutable STRING); the platform emails the order
7169
7171
  // confirmation there. New PaymentError code BUYER_EMAIL_INVALID.
7170
- version: "1.285.0",
7172
+ // 1.286.0: guidance (sc-16714) — when an Overlay goes `full`, and that a
7173
+ // full one draws its own close control; the `full-overlay-no-close`
7174
+ // lint warning flags one that does not.
7175
+ // 1.287.0: additive (sc-15765) — `connection` joins `actionScriptGlobals`:
7176
+ // the account a per-connection scheduled run is for, null otherwise.
7177
+ version: "1.287.0",
7171
7178
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
7172
7179
  hooks: HOOKS,
7173
7180
  primitives: PRIMITIVES,
package/dist/contract.js CHANGED
@@ -3746,7 +3746,7 @@ const PRIMITIVES = [
3746
3746
  {
3747
3747
  name: "Overlay",
3748
3748
  description:
3749
- 'Screen-level overlay. `<Overlay visible={open} onRequestClose={() => setOpen(false)} size="md">…panel…</Overlay>`. THE way to open anything that must cover the SCREEN rather than the widget and is not a dialog — a preview (PDF, image, video), a lightbox, a full-screen viewer. A dialog (a title, a close button, actions) is `<Modal>`, which is built on this. It renders OUTSIDE the widget layout box on both hosts (react-native-web portals it to the document root; native uses the OS modal), so no `overflow: hidden` card, scroll container or sibling widget can clip or cover it — which absolute positioning inside the widget cannot achieve on either host. Children stay in your own React tree, so state and hooks work normally. Props: `visible` (boolean, required to show), `onRequestClose` (fired by the backdrop press, the Escape key on web, and the Android back button — always wire it or the overlay cannot be closed), `size` ("sm" | "md" | "lg" | "full", default "md"; `full` runs edge to edge for media), `presentation` ("dialog", centred, the default | "sheet", anchored to the bottom edge), `dismissOnBackdropPress` (default true), `role` ("dialog" default | "alertdialog"; web only), `initialFocusRef` (web only), `accessibilityLabel` (names the dialog), `testID`, and `style` for extra panel styles. The scrim, surface, radius, padding and elevation come from the workspace theme (the scrim from Design > Components > Dialogs) — never re-style them. Keep it for screen-level surfaces: a dropdown anchored to its trigger still belongs inside the widget.',
3749
+ 'Screen-level overlay. `<Overlay visible={open} onRequestClose={() => setOpen(false)} size="md">…panel…</Overlay>`. THE way to open anything that must cover the SCREEN rather than the widget and is not a dialog — a preview (PDF, image, video), a lightbox, a full-screen viewer. A dialog (a title, a close button, actions) is `<Modal>`, which is built on this. It renders OUTSIDE the widget layout box on both hosts (react-native-web portals it to the document root; native uses the OS modal), so no `overflow: hidden` card, scroll container or sibling widget can clip or cover it — which absolute positioning inside the widget cannot achieve on either host. Children stay in your own React tree, so state and hooks work normally. Props: `visible` (boolean, required to show), `onRequestClose` (fired by the backdrop press, the Escape key on web, and the Android back button — always wire it or the overlay cannot be closed), `size` ("sm" | "md" | "lg" | "full", default "md"; `full` runs edge to edge: use it for content that needs the whole screen or uninterrupted touch — a game, an image, video or PDF preview, a lightbox, a signature or drawing pad, a map\'s full view, a slideshow — opened from an inline launcher, because inside the page every drag scrolls the page instead; a `full` overlay MUST draw its own visible close or pause control that runs the same handler as `onRequestClose`, padded by `useSafeAreaInsets()` so a notch never covers it: it has no backdrop to tap and an iPhone has no back button, so without one the user is trapped), `presentation` ("dialog", centred, the default | "sheet", anchored to the bottom edge), `dismissOnBackdropPress` (default true), `role` ("dialog" default | "alertdialog"; web only), `initialFocusRef` (web only), `accessibilityLabel` (names the dialog), `testID`, and `style` for extra panel styles. The scrim, surface, radius, padding and elevation come from the workspace theme (the scrim from Design > Components > Dialogs) — never re-style them. Keep it for screen-level surfaces: a dropdown anchored to its trigger still belongs inside the widget.',
3750
3750
  rnComponent: null,
3751
3751
  docsUrl: null,
3752
3752
  },
@@ -4168,6 +4168,8 @@ const ACTION_SCRIPT_GLOBALS = [
4168
4168
  "triggerTableId",
4169
4169
  // sc-7885 — who initiated the run; null on `schedule` / `record_*`.
4170
4170
  "triggeredBy",
4171
+ // sc-15765 — the account a per-connection scheduled run is for; null otherwise.
4172
+ "connection",
4171
4173
  // sc-9031 — a Run action event's parameters; null on every other trigger.
4172
4174
  "input",
4173
4175
  // sc-13843 — hands the app run its one JSON result.
@@ -7162,7 +7164,12 @@ const CONTRACT = deepFreeze({
7162
7164
  // 1.285.0: additive (sc-18008) — a `datastoreTemplate` column may declare
7163
7165
  // `buyerEmail: true` (an immutable STRING); the platform emails the order
7164
7166
  // confirmation there. New PaymentError code BUYER_EMAIL_INVALID.
7165
- version: "1.285.0",
7167
+ // 1.286.0: guidance (sc-16714) — when an Overlay goes `full`, and that a
7168
+ // full one draws its own close control; the `full-overlay-no-close`
7169
+ // lint warning flags one that does not.
7170
+ // 1.287.0: additive (sc-15765) — `connection` joins `actionScriptGlobals`:
7171
+ // the account a per-connection scheduled run is for, null otherwise.
7172
+ version: "1.287.0",
7166
7173
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
7167
7174
  hooks: HOOKS,
7168
7175
  primitives: PRIMITIVES,
package/dist/index.d.ts CHANGED
@@ -4481,6 +4481,9 @@ export const Video: (props: {
4481
4481
  *
4482
4482
  * @example
4483
4483
  * <Overlay visible={!!preview} onRequestClose={() => setPreview(null)} size="full">
4484
+ * <View style={{ paddingTop: insets.top, paddingRight: insets.right, alignItems: "flex-end" }}>
4485
+ * <IconButton icon="x" accessibilityLabel="Close" onPress={() => setPreview(null)} />
4486
+ * </View>
4484
4487
  * <ScrollView>{renderPreview(preview)}</ScrollView>
4485
4488
  * </Overlay>
4486
4489
  */
@@ -4489,7 +4492,10 @@ export const Overlay: (props: {
4489
4492
  visible?: boolean;
4490
4493
  /** Backdrop press, Escape (web) and the Android back button all fire this. */
4491
4494
  onRequestClose?: () => void;
4492
- /** Panel width tier. `full` runs edge to edge. Defaults to `md`. */
4495
+ /**
4496
+ * Panel width tier. `full` runs edge to edge, with no backdrop: draw a
4497
+ * visible close that runs `onRequestClose`'s handler. Defaults to `md`.
4498
+ */
4493
4499
  size?: "sm" | "md" | "lg" | "full";
4494
4500
  /** Centred (`dialog`, the default) or anchored to the bottom edge (`sheet`). */
4495
4501
  presentation?: OverlayPresentation;
package/dist/linter.cjs CHANGED
@@ -4714,6 +4714,177 @@ function lintEditability(manifest, files) {
4714
4714
  return { ok: true, findings };
4715
4715
  }
4716
4716
 
4717
+ // Story 16714 — a full-screen overlay has no backdrop to tap and an iPhone has
4718
+ // no back button, so one with no close control of its own traps the user. The
4719
+ // agent's publish gate blocks on it and a close takes many forms, so no handler
4720
+ // is followed: only an overlay of plain display components is flagged.
4721
+ const _OVERLAY_TAG_RE = /<(\/?)Overlay(?![\w$.])/g;
4722
+ const _FULL_SIZE_RE = /(?:^|\s)size\s{0,20}=\s{0,20}(?:(["'])full\1|\{\s{0,20}(["'`])full\2\s{0,20}\}|\{[^{}]{0,200}[?:]\s{0,20}(["'`])full\3\s{0,20}[:}])/;
4723
+ const _PACKAGE_IMPORT_RE = /(?<![\w$.])from\s*["']([^"'\n]{1,200})["']/g;
4724
+ const _STATE_SETTER_RE = /(?<![\w$])(?:const|let|var)\s{0,40}\[\s{0,40}([\w$]+)\s{0,40},\s{0,40}([\w$]+)\s{0,40}\]\s{0,40}=\s{0,40}(?:React\s{0,40}\.\s{0,40})?useState(?![\w$])/g;
4725
+ const _STATE_VISIBLE_RE = /(?:^|\s)visible\s{0,40}=\s{0,40}\{\s{0,40}(?:!!\s{0,40})?([A-Za-z_$][\w$]*)\s{0,40}(?:!==?\s{0,40}null\s{0,40})?\}/;
4726
+ const _PRESS_ATTR_RE = /^on(?:Press(?:In|Out)?|LongPress|RequestClose|Close)$/;
4727
+ const _ONE_LINE_HELPER_RE = /(?<![\w$])const\s{1,20}([A-Za-z_$][\w$]*)\s{0,20}=\s{0,20}(?:\([^()]{0,100}\)|[A-Za-z_$][\w$]*)\s{0,20}=>[^\n;{}]{0,200}$/;
4728
+ const _DISPLAY_TAGS = new Set([
4729
+ "View", "Text", "Image", "FileImage", "ImageBackground", "ScrollView", "Card", "Grid", "Icon",
4730
+ "ActivityIndicator", "Spinner", "Divider", "Skeleton", "Video", "RichText", "MapView",
4731
+ ]);
4732
+ const _INERT_ATTR_RE =
4733
+ /^(?:source|uri|src|fileId|assetId|style|contentContainerStyle|resizeMode|contentFit|aspectRatio|key|testID|alt|size|color|name|width|height|radius|gap|padding|align|justify|numberOfLines|horizontal|pagingEnabled|bounces|scrollEnabled|shows[A-Z]\w*|pointerEvents|accessible|accessibility(?:Label|Role|Hint)|poster|autoPlay|loop|muted|initialRegion|onLoad|onLayout|onError)$/;
4734
+ const _LIVE_VALUE_RE = /<|=>|(?<![\w$])function(?![\w$])|\)\s{0,20}\{|(?<![\w$])on[A-Z]/;
4735
+ const _EVENT_ATTR_RE = /^on[A-Z]/;
4736
+ const _CONTENT_ATTR_RE = /(?<![\w$.-])([A-Za-z_$][\w$-]*)\s{0,20}=\s{0,20}\{/g;
4737
+ const _COPY_RE = /<Text(?![\w$.])[^<>]{0,400}>(?:[^<{}]|\{\s{0,20}t\([^(){}<]{0,400}\)\s{0,20}\}){0,1000}<\/Text>/g;
4738
+ const _CONDITION_RE = /\{\s{0,20}!{0,2}[A-Za-z_$][\w$]*(?:\??\.[A-Za-z_$][\w$]*){0,8}\s{0,20}(?:&&|\?(?![.?]))/g;
4739
+ const _NOTHING_RE = /(?<![\w$.])(?:null|undefined|false)(?![\w$])/g;
4740
+ // What a quote in JSX text would hide from the mask.
4741
+ const _MARKUP_RE = /<\/?[A-Za-z]|\.\.\.|(?<![\w$])on[A-Z]\w{0,40}\s{0,20}=/g;
4742
+ const _OVERLAY_CAP = 16;
4743
+ const _CONTENT_CAP = 20000;
4744
+ const _NAME_USE_CAP = 50;
4745
+
4746
+ /** Local names bound by package imports; a sibling file's markup is out of sight. */
4747
+ function _packageImports(code, kept) {
4748
+ const names = new Set();
4749
+ let count = 0;
4750
+ for (const m of kept.matchAll(_PACKAGE_IMPORT_RE)) {
4751
+ if (m[1].startsWith(".") || !code.startsWith("from", m.index)) continue;
4752
+ if (++count > 200) break;
4753
+ const head = code.slice(Math.max(0, m.index - 2000), m.index);
4754
+ const clause = head.slice(head.lastIndexOf("import") + 6);
4755
+ for (const name of clause.match(/[A-Za-z_$][\w$]*/g) || []) names.add(name);
4756
+ }
4757
+ return names;
4758
+ }
4759
+
4760
+ /** The file's press handlers, as disjoint [from, to) spans in order. */
4761
+ function _pressSpans(code, partner) {
4762
+ const spans = [];
4763
+ let done = -1;
4764
+ for (const m of code.matchAll(_CONTENT_ATTR_RE)) {
4765
+ if (m.index < done || !_PRESS_ATTR_RE.test(m[1])) continue;
4766
+ const open = m.index + m[0].length - 1;
4767
+ if (partner[open] === -1) continue;
4768
+ done = partner[open];
4769
+ spans.push([open, done]);
4770
+ }
4771
+ return spans;
4772
+ }
4773
+
4774
+ /** Whether `name` is used in press handlers only, or in a one-line helper that is. */
4775
+ function _usedByPressOnly(ctx, name, declaredAt, followsHelper) {
4776
+ let uses = 0;
4777
+ for (let at = ctx.code.indexOf(name); at !== -1; at = ctx.code.indexOf(name, at + name.length)) {
4778
+ const whole = !/[\w$]/.test(ctx.code[at - 1] || "") && !/[\w$]/.test(ctx.code[at + name.length] || "");
4779
+ if (!whole || declaredAt(at)) continue;
4780
+ if (++uses > _NAME_USE_CAP) return false;
4781
+ if (ctx.presses.some(([from, to]) => at > from && at < to)) continue;
4782
+ const lead = ctx.code.slice(Math.max(0, at - 300), at);
4783
+ const helper = followsHelper && _ONE_LINE_HELPER_RE.exec(lead.slice(lead.lastIndexOf("const ")));
4784
+ if (!helper) return false;
4785
+ const helperAt = at - helper[0].length;
4786
+ const isDeclaration = (i) => i > helperAt && i < at;
4787
+ if (!_usedByPressOnly(ctx, helper[1], isDeclaration, false)) return false;
4788
+ }
4789
+ return true;
4790
+ }
4791
+
4792
+ /** Whether `visible` is one state only presses change: a cover that code closes traps nobody. */
4793
+ function _opensByPressOnly(ctx, attrs) {
4794
+ const shown = _STATE_VISIBLE_RE.exec(attrs);
4795
+ const setter = shown && ctx.setterOf.get(shown[1]);
4796
+ if (!setter) return false;
4797
+ const inState = (at) => /^\s{0,20}\]/.test(ctx.code.slice(at + setter.length, at + setter.length + 24));
4798
+ return _usedByPressOnly(ctx, setter, inState, true);
4799
+ }
4800
+
4801
+ /** Whether everything between the overlay's tags only displays. */
4802
+ function _contentOnlyDisplays(ctx, [from, to]) {
4803
+ if (to - from > _CONTENT_CAP) return false;
4804
+ const code = ctx.code.slice(from, to);
4805
+ const raw = ctx.kept.slice(from, to);
4806
+ const markup = (text) => (text.match(_MARKUP_RE) || []).length;
4807
+ if (code.includes("...") || markup(code) !== markup(raw)) return false;
4808
+ let content = "";
4809
+ let done = 0;
4810
+ for (const m of code.matchAll(_CONTENT_ATTR_RE)) {
4811
+ if (m.index < done) continue;
4812
+ const open = m.index + m[0].length - 1;
4813
+ const close = ctx.partner[from + open] - from;
4814
+ if (close <= open || close >= code.length) return false;
4815
+ const value = code.slice(open + 1, close);
4816
+ if (_EVENT_ATTR_RE.test(m[1]) ? value.includes("<") : _LIVE_VALUE_RE.test(value)) return false;
4817
+ content += code.slice(done, open) + " ";
4818
+ done = close + 1;
4819
+ }
4820
+ content += code.slice(done);
4821
+ for (const [, name, attrs] of content.matchAll(/<([A-Za-z_$][\w$.]*)([^<>]{0,2000})/g)) {
4822
+ if (!_DISPLAY_TAGS.has(name) || !ctx.imports.has(name)) return false;
4823
+ if ((attrs.match(/[A-Za-z_$][\w$-]*/g) || []).some((attr) => !_INERT_ATTR_RE.test(attr))) return false;
4824
+ }
4825
+ // Copy, conditions and tags aside, any name left is rendered from out of sight.
4826
+ const rest = content
4827
+ .replace(_COPY_RE, " ")
4828
+ .replace(/<[^<>]{0,2000}>/g, " ")
4829
+ .replace(_CONDITION_RE, " ")
4830
+ .replace(_NOTHING_RE, " ");
4831
+ return !/[\w$]/.test(rest);
4832
+ }
4833
+
4834
+ function _overlayTags(code) {
4835
+ const index = _jsxScanIndex(code);
4836
+ const tags = [];
4837
+ for (const m of code.matchAll(_OVERLAY_TAG_RE)) {
4838
+ const end = index.tagEnd(m.index);
4839
+ const inLast = tags.length > 0 && m.index <= tags[tags.length - 1].end;
4840
+ if (end !== -1 && !inLast) tags.push({ at: m.index, end, closing: Boolean(m[1]) });
4841
+ }
4842
+ return tags;
4843
+ }
4844
+
4845
+ function _fullOverlayCloseRules(source) {
4846
+ if (!source.includes("<Overlay")) return [];
4847
+ const kept = _stripNonCode(source, { keepStrings: true, keepHoleBraces: true });
4848
+ if (!_FULL_SIZE_RE.test(kept)) return [];
4849
+ const code = _stripNonCode(source, { keepHoleBraces: true });
4850
+ const ctx = {
4851
+ code,
4852
+ kept,
4853
+ imports: _packageImports(code, kept),
4854
+ setterOf: new Map([...code.matchAll(_STATE_SETTER_RE)].map((m) => [m[1], m[2]])),
4855
+ partner: _bracketPartners(code),
4856
+ };
4857
+ if (!ctx.imports.has("Overlay")) return [];
4858
+ ctx.presses = _pressSpans(code, ctx.partner);
4859
+ const tags = _overlayTags(code);
4860
+ const lineAt = _lineCounter(code);
4861
+ const lines = source.split(/\r?\n/);
4862
+ const findings = [];
4863
+ let judged = 0;
4864
+ for (let i = 0; i < tags.length && judged < _OVERLAY_CAP; i += 1) {
4865
+ const { at, end, closing } = tags[i];
4866
+ const next = tags[i + 1];
4867
+ if (closing || _selfClosing(code, end) || !next || !next.closing) continue;
4868
+ const attrs = kept.slice(at, end);
4869
+ // A spread carries anything.
4870
+ if (!_FULL_SIZE_RE.test(attrs) || attrs.includes("...")) continue;
4871
+ judged += 1;
4872
+ if (!_contentOnlyDisplays(ctx, [end + 1, next.at]) || !_opensByPressOnly(ctx, attrs)) continue;
4873
+ const line = lineAt(at);
4874
+ findings.push({
4875
+ rule: "full-overlay-no-close",
4876
+ severity: "warning",
4877
+ label:
4878
+ `<Overlay size="full"> draws no close control, so on an iPhone there is no way out: ` +
4879
+ `no backdrop to tap and no back button. Draw a visible close (or pause) button inside it ` +
4880
+ `that runs the same handler as onRequestClose, padded by useSafeAreaInsets().`,
4881
+ line,
4882
+ snippet: (lines[line - 1] || "").trim().slice(0, 200),
4883
+ });
4884
+ }
4885
+ return findings;
4886
+ }
4887
+
4717
4888
  // sc-10829 — `manifest.badgeCounter` promises the host a hook it can run
4718
4889
  // while the page is closed; each shipped entry must export it by name.
4719
4890
  function _exportedNameLine(code, name) {
@@ -4842,6 +5013,7 @@ function lintSource(source, options) {
4842
5013
  findings.push(..._useAssetOnFileColumnRules(source));
4843
5014
  findings.push(..._rowActionGatingRules(source));
4844
5015
  findings.push(..._unknownMutationMethodRules(source));
5016
+ findings.push(..._fullOverlayCloseRules(source));
4845
5017
  // REQ-USERMGMT / REQ-ACL-SYS M3 — scope-aware rules. Run after the
4846
5018
  // line-by-line scan so banned-identifier findings stay first in the
4847
5019
  // output.
package/dist/linter.js CHANGED
@@ -4709,6 +4709,177 @@ export function lintEditability(manifest, files) {
4709
4709
  return { ok: true, findings };
4710
4710
  }
4711
4711
 
4712
+ // Story 16714 — a full-screen overlay has no backdrop to tap and an iPhone has
4713
+ // no back button, so one with no close control of its own traps the user. The
4714
+ // agent's publish gate blocks on it and a close takes many forms, so no handler
4715
+ // is followed: only an overlay of plain display components is flagged.
4716
+ const _OVERLAY_TAG_RE = /<(\/?)Overlay(?![\w$.])/g;
4717
+ const _FULL_SIZE_RE = /(?:^|\s)size\s{0,20}=\s{0,20}(?:(["'])full\1|\{\s{0,20}(["'`])full\2\s{0,20}\}|\{[^{}]{0,200}[?:]\s{0,20}(["'`])full\3\s{0,20}[:}])/;
4718
+ const _PACKAGE_IMPORT_RE = /(?<![\w$.])from\s*["']([^"'\n]{1,200})["']/g;
4719
+ const _STATE_SETTER_RE = /(?<![\w$])(?:const|let|var)\s{0,40}\[\s{0,40}([\w$]+)\s{0,40},\s{0,40}([\w$]+)\s{0,40}\]\s{0,40}=\s{0,40}(?:React\s{0,40}\.\s{0,40})?useState(?![\w$])/g;
4720
+ const _STATE_VISIBLE_RE = /(?:^|\s)visible\s{0,40}=\s{0,40}\{\s{0,40}(?:!!\s{0,40})?([A-Za-z_$][\w$]*)\s{0,40}(?:!==?\s{0,40}null\s{0,40})?\}/;
4721
+ const _PRESS_ATTR_RE = /^on(?:Press(?:In|Out)?|LongPress|RequestClose|Close)$/;
4722
+ const _ONE_LINE_HELPER_RE = /(?<![\w$])const\s{1,20}([A-Za-z_$][\w$]*)\s{0,20}=\s{0,20}(?:\([^()]{0,100}\)|[A-Za-z_$][\w$]*)\s{0,20}=>[^\n;{}]{0,200}$/;
4723
+ const _DISPLAY_TAGS = new Set([
4724
+ "View", "Text", "Image", "FileImage", "ImageBackground", "ScrollView", "Card", "Grid", "Icon",
4725
+ "ActivityIndicator", "Spinner", "Divider", "Skeleton", "Video", "RichText", "MapView",
4726
+ ]);
4727
+ const _INERT_ATTR_RE =
4728
+ /^(?:source|uri|src|fileId|assetId|style|contentContainerStyle|resizeMode|contentFit|aspectRatio|key|testID|alt|size|color|name|width|height|radius|gap|padding|align|justify|numberOfLines|horizontal|pagingEnabled|bounces|scrollEnabled|shows[A-Z]\w*|pointerEvents|accessible|accessibility(?:Label|Role|Hint)|poster|autoPlay|loop|muted|initialRegion|onLoad|onLayout|onError)$/;
4729
+ const _LIVE_VALUE_RE = /<|=>|(?<![\w$])function(?![\w$])|\)\s{0,20}\{|(?<![\w$])on[A-Z]/;
4730
+ const _EVENT_ATTR_RE = /^on[A-Z]/;
4731
+ const _CONTENT_ATTR_RE = /(?<![\w$.-])([A-Za-z_$][\w$-]*)\s{0,20}=\s{0,20}\{/g;
4732
+ const _COPY_RE = /<Text(?![\w$.])[^<>]{0,400}>(?:[^<{}]|\{\s{0,20}t\([^(){}<]{0,400}\)\s{0,20}\}){0,1000}<\/Text>/g;
4733
+ const _CONDITION_RE = /\{\s{0,20}!{0,2}[A-Za-z_$][\w$]*(?:\??\.[A-Za-z_$][\w$]*){0,8}\s{0,20}(?:&&|\?(?![.?]))/g;
4734
+ const _NOTHING_RE = /(?<![\w$.])(?:null|undefined|false)(?![\w$])/g;
4735
+ // What a quote in JSX text would hide from the mask.
4736
+ const _MARKUP_RE = /<\/?[A-Za-z]|\.\.\.|(?<![\w$])on[A-Z]\w{0,40}\s{0,20}=/g;
4737
+ const _OVERLAY_CAP = 16;
4738
+ const _CONTENT_CAP = 20000;
4739
+ const _NAME_USE_CAP = 50;
4740
+
4741
+ /** Local names bound by package imports; a sibling file's markup is out of sight. */
4742
+ function _packageImports(code, kept) {
4743
+ const names = new Set();
4744
+ let count = 0;
4745
+ for (const m of kept.matchAll(_PACKAGE_IMPORT_RE)) {
4746
+ if (m[1].startsWith(".") || !code.startsWith("from", m.index)) continue;
4747
+ if (++count > 200) break;
4748
+ const head = code.slice(Math.max(0, m.index - 2000), m.index);
4749
+ const clause = head.slice(head.lastIndexOf("import") + 6);
4750
+ for (const name of clause.match(/[A-Za-z_$][\w$]*/g) || []) names.add(name);
4751
+ }
4752
+ return names;
4753
+ }
4754
+
4755
+ /** The file's press handlers, as disjoint [from, to) spans in order. */
4756
+ function _pressSpans(code, partner) {
4757
+ const spans = [];
4758
+ let done = -1;
4759
+ for (const m of code.matchAll(_CONTENT_ATTR_RE)) {
4760
+ if (m.index < done || !_PRESS_ATTR_RE.test(m[1])) continue;
4761
+ const open = m.index + m[0].length - 1;
4762
+ if (partner[open] === -1) continue;
4763
+ done = partner[open];
4764
+ spans.push([open, done]);
4765
+ }
4766
+ return spans;
4767
+ }
4768
+
4769
+ /** Whether `name` is used in press handlers only, or in a one-line helper that is. */
4770
+ function _usedByPressOnly(ctx, name, declaredAt, followsHelper) {
4771
+ let uses = 0;
4772
+ for (let at = ctx.code.indexOf(name); at !== -1; at = ctx.code.indexOf(name, at + name.length)) {
4773
+ const whole = !/[\w$]/.test(ctx.code[at - 1] || "") && !/[\w$]/.test(ctx.code[at + name.length] || "");
4774
+ if (!whole || declaredAt(at)) continue;
4775
+ if (++uses > _NAME_USE_CAP) return false;
4776
+ if (ctx.presses.some(([from, to]) => at > from && at < to)) continue;
4777
+ const lead = ctx.code.slice(Math.max(0, at - 300), at);
4778
+ const helper = followsHelper && _ONE_LINE_HELPER_RE.exec(lead.slice(lead.lastIndexOf("const ")));
4779
+ if (!helper) return false;
4780
+ const helperAt = at - helper[0].length;
4781
+ const isDeclaration = (i) => i > helperAt && i < at;
4782
+ if (!_usedByPressOnly(ctx, helper[1], isDeclaration, false)) return false;
4783
+ }
4784
+ return true;
4785
+ }
4786
+
4787
+ /** Whether `visible` is one state only presses change: a cover that code closes traps nobody. */
4788
+ function _opensByPressOnly(ctx, attrs) {
4789
+ const shown = _STATE_VISIBLE_RE.exec(attrs);
4790
+ const setter = shown && ctx.setterOf.get(shown[1]);
4791
+ if (!setter) return false;
4792
+ const inState = (at) => /^\s{0,20}\]/.test(ctx.code.slice(at + setter.length, at + setter.length + 24));
4793
+ return _usedByPressOnly(ctx, setter, inState, true);
4794
+ }
4795
+
4796
+ /** Whether everything between the overlay's tags only displays. */
4797
+ function _contentOnlyDisplays(ctx, [from, to]) {
4798
+ if (to - from > _CONTENT_CAP) return false;
4799
+ const code = ctx.code.slice(from, to);
4800
+ const raw = ctx.kept.slice(from, to);
4801
+ const markup = (text) => (text.match(_MARKUP_RE) || []).length;
4802
+ if (code.includes("...") || markup(code) !== markup(raw)) return false;
4803
+ let content = "";
4804
+ let done = 0;
4805
+ for (const m of code.matchAll(_CONTENT_ATTR_RE)) {
4806
+ if (m.index < done) continue;
4807
+ const open = m.index + m[0].length - 1;
4808
+ const close = ctx.partner[from + open] - from;
4809
+ if (close <= open || close >= code.length) return false;
4810
+ const value = code.slice(open + 1, close);
4811
+ if (_EVENT_ATTR_RE.test(m[1]) ? value.includes("<") : _LIVE_VALUE_RE.test(value)) return false;
4812
+ content += code.slice(done, open) + " ";
4813
+ done = close + 1;
4814
+ }
4815
+ content += code.slice(done);
4816
+ for (const [, name, attrs] of content.matchAll(/<([A-Za-z_$][\w$.]*)([^<>]{0,2000})/g)) {
4817
+ if (!_DISPLAY_TAGS.has(name) || !ctx.imports.has(name)) return false;
4818
+ if ((attrs.match(/[A-Za-z_$][\w$-]*/g) || []).some((attr) => !_INERT_ATTR_RE.test(attr))) return false;
4819
+ }
4820
+ // Copy, conditions and tags aside, any name left is rendered from out of sight.
4821
+ const rest = content
4822
+ .replace(_COPY_RE, " ")
4823
+ .replace(/<[^<>]{0,2000}>/g, " ")
4824
+ .replace(_CONDITION_RE, " ")
4825
+ .replace(_NOTHING_RE, " ");
4826
+ return !/[\w$]/.test(rest);
4827
+ }
4828
+
4829
+ function _overlayTags(code) {
4830
+ const index = _jsxScanIndex(code);
4831
+ const tags = [];
4832
+ for (const m of code.matchAll(_OVERLAY_TAG_RE)) {
4833
+ const end = index.tagEnd(m.index);
4834
+ const inLast = tags.length > 0 && m.index <= tags[tags.length - 1].end;
4835
+ if (end !== -1 && !inLast) tags.push({ at: m.index, end, closing: Boolean(m[1]) });
4836
+ }
4837
+ return tags;
4838
+ }
4839
+
4840
+ function _fullOverlayCloseRules(source) {
4841
+ if (!source.includes("<Overlay")) return [];
4842
+ const kept = _stripNonCode(source, { keepStrings: true, keepHoleBraces: true });
4843
+ if (!_FULL_SIZE_RE.test(kept)) return [];
4844
+ const code = _stripNonCode(source, { keepHoleBraces: true });
4845
+ const ctx = {
4846
+ code,
4847
+ kept,
4848
+ imports: _packageImports(code, kept),
4849
+ setterOf: new Map([...code.matchAll(_STATE_SETTER_RE)].map((m) => [m[1], m[2]])),
4850
+ partner: _bracketPartners(code),
4851
+ };
4852
+ if (!ctx.imports.has("Overlay")) return [];
4853
+ ctx.presses = _pressSpans(code, ctx.partner);
4854
+ const tags = _overlayTags(code);
4855
+ const lineAt = _lineCounter(code);
4856
+ const lines = source.split(/\r?\n/);
4857
+ const findings = [];
4858
+ let judged = 0;
4859
+ for (let i = 0; i < tags.length && judged < _OVERLAY_CAP; i += 1) {
4860
+ const { at, end, closing } = tags[i];
4861
+ const next = tags[i + 1];
4862
+ if (closing || _selfClosing(code, end) || !next || !next.closing) continue;
4863
+ const attrs = kept.slice(at, end);
4864
+ // A spread carries anything.
4865
+ if (!_FULL_SIZE_RE.test(attrs) || attrs.includes("...")) continue;
4866
+ judged += 1;
4867
+ if (!_contentOnlyDisplays(ctx, [end + 1, next.at]) || !_opensByPressOnly(ctx, attrs)) continue;
4868
+ const line = lineAt(at);
4869
+ findings.push({
4870
+ rule: "full-overlay-no-close",
4871
+ severity: "warning",
4872
+ label:
4873
+ `<Overlay size="full"> draws no close control, so on an iPhone there is no way out: ` +
4874
+ `no backdrop to tap and no back button. Draw a visible close (or pause) button inside it ` +
4875
+ `that runs the same handler as onRequestClose, padded by useSafeAreaInsets().`,
4876
+ line,
4877
+ snippet: (lines[line - 1] || "").trim().slice(0, 200),
4878
+ });
4879
+ }
4880
+ return findings;
4881
+ }
4882
+
4712
4883
  // sc-10829 — `manifest.badgeCounter` promises the host a hook it can run
4713
4884
  // while the page is closed; each shipped entry must export it by name.
4714
4885
  function _exportedNameLine(code, name) {
@@ -4837,6 +5008,7 @@ export function lintSource(source, options) {
4837
5008
  findings.push(..._useAssetOnFileColumnRules(source));
4838
5009
  findings.push(..._rowActionGatingRules(source));
4839
5010
  findings.push(..._unknownMutationMethodRules(source));
5011
+ findings.push(..._fullOverlayCloseRules(source));
4840
5012
  // REQ-USERMGMT / REQ-ACL-SYS M3 — scope-aware rules. Run after the
4841
5013
  // line-by-line scan so banned-identifier findings stay first in the
4842
5014
  // output.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@colixsystems/widget-sdk",
3
- "version": "0.348.0",
3
+ "version": "0.350.0",
4
4
  "description": "Common widget interface for AppStudio. Implements WidgetManifest, WidgetContext, property schema, and helper hooks.",
5
5
  "repository": {
6
6
  "type": "git",
package/src/contract.js CHANGED
@@ -3746,7 +3746,7 @@ const PRIMITIVES = [
3746
3746
  {
3747
3747
  name: "Overlay",
3748
3748
  description:
3749
- 'Screen-level overlay. `<Overlay visible={open} onRequestClose={() => setOpen(false)} size="md">…panel…</Overlay>`. THE way to open anything that must cover the SCREEN rather than the widget and is not a dialog — a preview (PDF, image, video), a lightbox, a full-screen viewer. A dialog (a title, a close button, actions) is `<Modal>`, which is built on this. It renders OUTSIDE the widget layout box on both hosts (react-native-web portals it to the document root; native uses the OS modal), so no `overflow: hidden` card, scroll container or sibling widget can clip or cover it — which absolute positioning inside the widget cannot achieve on either host. Children stay in your own React tree, so state and hooks work normally. Props: `visible` (boolean, required to show), `onRequestClose` (fired by the backdrop press, the Escape key on web, and the Android back button — always wire it or the overlay cannot be closed), `size` ("sm" | "md" | "lg" | "full", default "md"; `full` runs edge to edge for media), `presentation` ("dialog", centred, the default | "sheet", anchored to the bottom edge), `dismissOnBackdropPress` (default true), `role` ("dialog" default | "alertdialog"; web only), `initialFocusRef` (web only), `accessibilityLabel` (names the dialog), `testID`, and `style` for extra panel styles. The scrim, surface, radius, padding and elevation come from the workspace theme (the scrim from Design > Components > Dialogs) — never re-style them. Keep it for screen-level surfaces: a dropdown anchored to its trigger still belongs inside the widget.',
3749
+ 'Screen-level overlay. `<Overlay visible={open} onRequestClose={() => setOpen(false)} size="md">…panel…</Overlay>`. THE way to open anything that must cover the SCREEN rather than the widget and is not a dialog — a preview (PDF, image, video), a lightbox, a full-screen viewer. A dialog (a title, a close button, actions) is `<Modal>`, which is built on this. It renders OUTSIDE the widget layout box on both hosts (react-native-web portals it to the document root; native uses the OS modal), so no `overflow: hidden` card, scroll container or sibling widget can clip or cover it — which absolute positioning inside the widget cannot achieve on either host. Children stay in your own React tree, so state and hooks work normally. Props: `visible` (boolean, required to show), `onRequestClose` (fired by the backdrop press, the Escape key on web, and the Android back button — always wire it or the overlay cannot be closed), `size` ("sm" | "md" | "lg" | "full", default "md"; `full` runs edge to edge: use it for content that needs the whole screen or uninterrupted touch — a game, an image, video or PDF preview, a lightbox, a signature or drawing pad, a map\'s full view, a slideshow — opened from an inline launcher, because inside the page every drag scrolls the page instead; a `full` overlay MUST draw its own visible close or pause control that runs the same handler as `onRequestClose`, padded by `useSafeAreaInsets()` so a notch never covers it: it has no backdrop to tap and an iPhone has no back button, so without one the user is trapped), `presentation` ("dialog", centred, the default | "sheet", anchored to the bottom edge), `dismissOnBackdropPress` (default true), `role` ("dialog" default | "alertdialog"; web only), `initialFocusRef` (web only), `accessibilityLabel` (names the dialog), `testID`, and `style` for extra panel styles. The scrim, surface, radius, padding and elevation come from the workspace theme (the scrim from Design > Components > Dialogs) — never re-style them. Keep it for screen-level surfaces: a dropdown anchored to its trigger still belongs inside the widget.',
3750
3750
  rnComponent: null,
3751
3751
  docsUrl: null,
3752
3752
  },
@@ -4168,6 +4168,8 @@ const ACTION_SCRIPT_GLOBALS = [
4168
4168
  "triggerTableId",
4169
4169
  // sc-7885 — who initiated the run; null on `schedule` / `record_*`.
4170
4170
  "triggeredBy",
4171
+ // sc-15765 — the account a per-connection scheduled run is for; null otherwise.
4172
+ "connection",
4171
4173
  // sc-9031 — a Run action event's parameters; null on every other trigger.
4172
4174
  "input",
4173
4175
  // sc-13843 — hands the app run its one JSON result.
@@ -7162,7 +7164,12 @@ const CONTRACT = deepFreeze({
7162
7164
  // 1.285.0: additive (sc-18008) — a `datastoreTemplate` column may declare
7163
7165
  // `buyerEmail: true` (an immutable STRING); the platform emails the order
7164
7166
  // confirmation there. New PaymentError code BUYER_EMAIL_INVALID.
7165
- version: "1.285.0",
7167
+ // 1.286.0: guidance (sc-16714) — when an Overlay goes `full`, and that a
7168
+ // full one draws its own close control; the `full-overlay-no-close`
7169
+ // lint warning flags one that does not.
7170
+ // 1.287.0: additive (sc-15765) — `connection` joins `actionScriptGlobals`:
7171
+ // the account a per-connection scheduled run is for, null otherwise.
7172
+ version: "1.287.0",
7166
7173
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
7167
7174
  hooks: HOOKS,
7168
7175
  primitives: PRIMITIVES,