@colixsystems/widget-sdk 0.259.0 → 0.261.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.
Files changed (75) hide show
  1. package/README.md +9 -1
  2. package/dist/accordion.js +2 -1
  3. package/dist/accordion.native.js +2 -1
  4. package/dist/banner.js +1 -1
  5. package/dist/banner.native.js +2 -1
  6. package/dist/bounded-text.native.js +29 -0
  7. package/dist/button.js +1 -1
  8. package/dist/button.native.js +2 -1
  9. package/dist/card-photo.js +1 -1
  10. package/dist/card.js +1 -1
  11. package/dist/chart.js +1 -1
  12. package/dist/chart.native.js +2 -1
  13. package/dist/checkbox.js +1 -1
  14. package/dist/checkbox.native.js +2 -1
  15. package/dist/chip.js +1 -1
  16. package/dist/chip.native.js +2 -1
  17. package/dist/confirm-dialog.js +1 -1
  18. package/dist/confirm-dialog.native.js +3 -3
  19. package/dist/contract.cjs +22 -18
  20. package/dist/contract.js +23 -18
  21. package/dist/data-table.js +1 -1
  22. package/dist/data-table.native.js +2 -1
  23. package/dist/datetimepicker.js +2 -1
  24. package/dist/datetimepicker.native.js +2 -1
  25. package/dist/detail-parts.js +1 -1
  26. package/dist/detail-parts.native.js +2 -1
  27. package/dist/emoji-picker.js +1 -1
  28. package/dist/emoji-picker.native.js +2 -1
  29. package/dist/file-image.js +1 -1
  30. package/dist/file-upload.js +2 -1
  31. package/dist/file-upload.native.js +2 -1
  32. package/dist/filter-bar.js +1 -1
  33. package/dist/form.js +1 -1
  34. package/dist/form.native.js +2 -1
  35. package/dist/gradient.js +1 -1
  36. package/dist/grid.js +1 -1
  37. package/dist/index.d.ts +2 -0
  38. package/dist/linter.cjs +1 -1
  39. package/dist/list.js +1 -1
  40. package/dist/list.native.js +2 -1
  41. package/dist/loading.js +1 -1
  42. package/dist/loading.native.js +2 -1
  43. package/dist/markdown-input.js +1 -1
  44. package/dist/markdown-input.native.js +2 -1
  45. package/dist/modal.js +1 -1
  46. package/dist/modal.native.js +1 -1
  47. package/dist/overlay.js +1 -1
  48. package/dist/people-picker.js +1 -1
  49. package/dist/popover.js +1 -1
  50. package/dist/popover.native.js +2 -1
  51. package/dist/primitives.js +1 -1
  52. package/dist/primitives.native.js +2 -2
  53. package/dist/radio-group.js +1 -1
  54. package/dist/radio-group.native.js +2 -1
  55. package/dist/richtext.js +1 -1
  56. package/dist/richtext.native.js +2 -1
  57. package/dist/search-field.js +1 -1
  58. package/dist/search-field.native.js +2 -1
  59. package/dist/select.js +1 -1
  60. package/dist/select.native.js +2 -1
  61. package/dist/sortable.js +1 -1
  62. package/dist/sortable.native.js +2 -1
  63. package/dist/surface-theme.js +2 -2
  64. package/dist/switch.js +1 -1
  65. package/dist/switch.native.js +2 -1
  66. package/dist/tabs.js +1 -1
  67. package/dist/tabs.native.js +2 -1
  68. package/dist/text-field.js +1 -1
  69. package/dist/text-field.native.js +2 -1
  70. package/dist/text-scale-style.js +60 -0
  71. package/dist/text-scale.d.ts +11 -0
  72. package/dist/text-scale.js +40 -0
  73. package/dist/video.js +1 -1
  74. package/package.json +7 -1
  75. package/src/contract.js +23 -18
package/src/contract.js CHANGED
@@ -1,12 +1,7 @@
1
- // ESM mirror of contract.cjs. Generated from contract.cjs — keep both in lockstep.
2
- // runtime) can `require()` it directly without dynamic import gymnastics.
3
- //
4
- // The ESM `contract.js` re-exports the SAME object as the `CONTRACT` named
5
- // export. The contract test asserts the two are identical (deep-equal) so
6
- // drift between this file and the ESM source-of-truth is caught in CI.
7
- //
8
- // Keep edits in lockstep between `contract.cjs` and `contract.js`. The
9
- // SDK build script copies both into `dist/`.
1
+ // The widget SDK contract: the ONE source the linter, the AI agents, the
2
+ // compiler and both hosts read. `contract.cjs` is GENERATED from `contract.js`
3
+ // (`npm run generate:contract`) for CommonJS consumers — never edit it by hand;
4
+ // contract-cjs-generated.test.js fails when it is stale.
10
5
 
11
6
  // REQ-AI-AGENT-DESIGN (sc-3696): the ONE cross-platform elevation vocabulary.
12
7
  // `shadow*` applies on iOS + react-native-web, `elevation` drives Android.
@@ -2645,7 +2640,7 @@ const HOOKS = [
2645
2640
  scopes: ["users.write:*"],
2646
2641
  },
2647
2642
  // REQ-BANKID-AUTH — link / unlink a BankID identity to the signed-in
2648
- // app-user. Self-service + JWT-gated (no widget scope). Mirror of contract.cjs.
2643
+ // app-user. Self-service + JWT-gated (no widget scope).
2649
2644
  {
2650
2645
  name: "useBankIdLink",
2651
2646
  signature: "useBankIdLink()",
@@ -2681,7 +2676,7 @@ const HOOKS = [
2681
2676
  scopes: null,
2682
2677
  },
2683
2678
  // REQ-IDENT (sc-4313) — identify a visitor who is NOT signed in and keep the
2684
- // result. Anonymous by design (no widget scope, no session). Mirror of contract.cjs.
2679
+ // result. Anonymous by design (no widget scope, no session).
2685
2680
  {
2686
2681
  name: "useIdentification",
2687
2682
  signature: "useIdentification(options)",
@@ -2732,7 +2727,7 @@ const HOOKS = [
2732
2727
  scopes: null,
2733
2728
  },
2734
2729
  // REQ-ACL-06 / REQ-ACL-RELINHERIT-05 — per-record VirtualPermission
2735
- // management for a single record. Mirror of contract.js.
2730
+ // management for a single record.
2736
2731
  {
2737
2732
  name: "useRecordPermissions",
2738
2733
  signature: "useRecordPermissions(tableId, recordId)",
@@ -2865,7 +2860,7 @@ const HOOKS = [
2865
2860
  requiredContextSlice: ["datastore.records"],
2866
2861
  scopes: ["datastore.read:<table>"],
2867
2862
  },
2868
- // REQ-WSDK-PLATFORM §6 — Tier A SDK hooks. Mirror of contract.js.
2863
+ // REQ-WSDK-PLATFORM §6 — Tier A SDK hooks.
2869
2864
  {
2870
2865
  name: "useClipboard",
2871
2866
  signature: "useClipboard()",
@@ -3701,6 +3696,10 @@ const ACTION_TRIGGER_TYPES = [
3701
3696
  // Globals the action script runs against (the runner's surface) — distinct
3702
3697
  // from the React/SDK widget surface, so the component import/banned-API
3703
3698
  // linter does NOT scan action scripts.
3699
+ // sc-7877 deliberately does NOT add `directory` here. That global is
3700
+ // reachable only by a MARKETPLACE action whose install consented to a
3701
+ // `directory:` scope; a widget-declared action has no install, so
3702
+ // resolveForActionRow grants it nothing and the global is never defined.
3704
3703
  const ACTION_SCRIPT_GLOBALS = [
3705
3704
  "datastore",
3706
3705
  "secrets",
@@ -4213,14 +4212,14 @@ const WIDGET_CONTEXT_SHAPE = {
4213
4212
  required: true,
4214
4213
  fields: { requestPayment: "function", getPayment: "function" },
4215
4214
  },
4216
- // sc-890 — backs useSendNotification(). Mirror of contract.cjs.
4215
+ // sc-890 — backs useSendNotification().
4217
4216
  notifications: {
4218
4217
  description:
4219
4218
  "Injected @colixsystems/notifications-client instance (sc-890). { send(body) -> Promise<notification>, mutes: { get, set, clear } }. send backs useSendNotification(); requires the notifications.send:appUser scope. The host POSTs the body snake_case verbatim ({ recipient_user_id, title, body, link?, payload? }) to /notifications/send and returns the created notification row; the call is imperative (a send never fires on mount). mutes backs useRecordMute() and useRecordMutes() (sc-10268): get({ table_id, record_id }) / set({ table_id, record_id, muted_until }) -> { muted, muted_until }, clear({ table_id, record_id }) -> undefined, list({ table_id, limit?, offset? }) -> { data: [{ record_id, muted_until }], meta }. mutes is optional — a host without it (the Builder canvas preview) leaves useRecordMute() reading not muted.",
4220
4219
  required: true,
4221
4220
  fields: { send: "function", mutes: "object" },
4222
4221
  },
4223
- // REQ-IDENT (sc-4313) — backs useIdentification(). Mirror of contract.cjs.
4222
+ // REQ-IDENT (sc-4313) — backs useIdentification().
4224
4223
  identification: {
4225
4224
  description:
4226
4225
  "Injected @colixsystems/identification-client instance (REQ-IDENT). { available() -> Promise<{ available, providers }>, start(body) -> Promise<order>, get(id) -> Promise<state>, cancel(id) -> Promise<state> }. Backs useIdentification(); no widget scope and no signed-in user required — identifying a NOT-signed-in visitor is the point, so the endpoints are anonymous. Bodies and rows are snake_case verbatim. A completed identification exposes name + personal_number_masked + a stable subject_hash; the RAW personal number is never reachable from a widget (it lives behind a studio-admin endpoint).",
@@ -4261,7 +4260,7 @@ const WIDGET_CONTEXT_SHAPE = {
4261
4260
  error: "function",
4262
4261
  },
4263
4262
  },
4264
- // REQ-WSDK-PLATFORM §6 — backs useToast(). Mirror of contract.js.
4263
+ // REQ-WSDK-PLATFORM §6 — backs useToast().
4265
4264
  toast: {
4266
4265
  description:
4267
4266
  "Optional host toast slot. { showToast({ kind, message }): void }. " +
@@ -4705,7 +4704,7 @@ const VETTED_IMPORTS = [
4705
4704
  // `allowedBareImports` (so the loader's shim⊆vetted guard treats them as
4706
4705
  // vetted) WITHOUT bloating the rich `VETTED_IMPORTS` reference the AI prompt /
4707
4706
  // Developer guide enumerate — the SAME treatment `react/jsx-runtime` gets, but
4708
- // kept out of the author-facing list. Mirror of contract.cjs.
4707
+ // kept out of the author-facing list.
4709
4708
  const CORE_INFRA_BARE_IMPORTS = ["react-dom", "react-dom/client"];
4710
4709
 
4711
4710
  // Back-compat shape — every existing consumer (widgetLoader, the static
@@ -6375,7 +6374,9 @@ const CONTRACT = deepFreeze({
6375
6374
  // `<testID>-option-<id>`.
6376
6375
  // 1.210.0: behaviour (sc-12245) — `<Avatar url>` falls back to the
6377
6376
  // initials when its picture fails to load. No API change.
6378
- version: "1.210.0",
6377
+ // 1.211.0: additive (sc-9168) — `maxFontSizeMultiplier`: native `<Text>` /
6378
+ // `<TextInput>` follow the device font scale up to this bound.
6379
+ version: "1.211.0",
6379
6380
  sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
6380
6381
  hooks: HOOKS,
6381
6382
  primitives: PRIMITIVES,
@@ -6404,6 +6405,10 @@ const CONTRACT = deepFreeze({
6404
6405
  bundleExportContract: BUNDLE_EXPORT_CONTRACT,
6405
6406
  // sc-10829 — the hook a `badgeCounter: true` entry exports by name.
6406
6407
  badgeCounterExport: "useBadgeCount",
6408
+ // sc-9168 — the most native text grows with the device font-scale setting.
6409
+ // Above it a layout sized against the Player overflows; the browser has no
6410
+ // such setting to preview it with.
6411
+ maxFontSizeMultiplier: 1.3,
6407
6412
  bannedApis: BANNED_APIS,
6408
6413
  vettedImports: VETTED_IMPORTS,
6409
6414
  allowedBareImports: ALLOWED_BARE_IMPORTS,