@colixsystems/widget-sdk 0.326.0 → 0.327.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.
@@ -10,7 +10,7 @@
10
10
  // button. The applied filters sit beneath as removable chips at every width.
11
11
 
12
12
  import React from "react";
13
- import { useContainerWidth, useHostTheme } from "./hooks.js";
13
+ import { useContainerWidth, useHostTheme, useSdkText, useSdkTextDefaults } from "./hooks.js";
14
14
  import { DEFAULT_THEME_TOKENS } from "./_theme-tokens.js";
15
15
  import { DEFAULT_SEARCH_DEBOUNCE_MS, createDebouncer, normaliseQuery } from "./select-search-logic.js";
16
16
  import {
@@ -30,6 +30,16 @@ import {
30
30
  const h = React.createElement;
31
31
  const NO_FILTERS = Object.freeze({});
32
32
  const MAX_UNECHOED = 20;
33
+ const FILTER_TEXT_KEYS = Object.freeze({
34
+ searchPlaceholder: "search",
35
+ anyText: "filter_any",
36
+ filtersText: "filters",
37
+ clearAllText: "clear_all",
38
+ applyText: "apply",
39
+ clearText: "clear",
40
+ activeFiltersText: "active_filters",
41
+ removeText: "remove_named",
42
+ });
33
43
 
34
44
  function part(testID, name) {
35
45
  return testID ? `${testID}-${name}` : undefined;
@@ -128,7 +138,8 @@ export function makeFilterBar(rn) {
128
138
  }
129
139
 
130
140
  function SortSelect({ sort, value, onPick, compact, testID }) {
131
- const label = typeof sort.label === "string" ? sort.label : "Sort";
141
+ const sortText = useSdkText()("sort");
142
+ const label = typeof sort.label === "string" ? sort.label : sortText;
132
143
  return h(Select, {
133
144
  title: label,
134
145
  options: Array.isArray(sort.options) ? sort.options : [],
@@ -145,27 +156,34 @@ export function makeFilterBar(rn) {
145
156
  });
146
157
  }
147
158
 
148
- function FilterBar({
149
- query,
150
- onQueryChange,
151
- queryDebounceMs = DEFAULT_SEARCH_DEBOUNCE_MS,
152
- facets,
153
- value,
154
- onChange,
155
- sort,
156
- searchPlaceholder = "Search",
157
- anyText = "Any",
158
- filtersText = "Filters",
159
- activeCountText = "{count} active",
160
- clearAllText = "Clear all",
161
- applyText = "Apply",
162
- clearText = "Clear",
163
- activeFiltersText = "Active filters",
164
- removeText = "Remove {label}",
165
- closeAccessibilityLabel,
166
- style,
167
- testID,
168
- }) {
159
+ function FilterBar(ownProps) {
160
+ const {
161
+ query,
162
+ onQueryChange,
163
+ queryDebounceMs = DEFAULT_SEARCH_DEBOUNCE_MS,
164
+ facets,
165
+ value,
166
+ onChange,
167
+ sort,
168
+ searchPlaceholder,
169
+ anyText,
170
+ filtersText,
171
+ activeCountText,
172
+ clearAllText,
173
+ applyText,
174
+ clearText,
175
+ activeFiltersText,
176
+ removeText,
177
+ closeAccessibilityLabel,
178
+ style,
179
+ testID,
180
+ } = useSdkTextDefaults(ownProps, FILTER_TEXT_KEYS);
181
+ const text = useSdkText();
182
+ // The built-in text picks its plural form; an author's is a template.
183
+ const activeCount = (count) =>
184
+ activeCountText === undefined
185
+ ? text("filters_active_count", { count })
186
+ : fillText(activeCountText, "count", count);
169
187
  const theme = useHostTheme() || DEFAULT_THEME_TOKENS;
170
188
  const spacing = theme.spacing || DEFAULT_THEME_TOKENS.spacing;
171
189
  const gap = spacing.sm;
@@ -258,7 +276,7 @@ export function makeFilterBar(rn) {
258
276
  title: filtersButtonText(filtersText, applied.length),
259
277
  accessibilityLabel:
260
278
  applied.length > 0
261
- ? `${filtersText}, ${fillText(activeCountText, "count", applied.length)}`
279
+ ? `${filtersText}, ${activeCount(applied.length)}`
262
280
  : filtersText,
263
281
  icon: "sliders-horizontal",
264
282
  variant: "secondary",
package/dist/form-view.js CHANGED
@@ -8,7 +8,7 @@
8
8
  // renderer live in ./form-layout-logic.js.
9
9
 
10
10
  import React from "react";
11
- import { useContainerWidth, useHostSharedText, useHostTheme } from "./hooks.js";
11
+ import { useContainerWidth, useHostTheme, useSdkText } from "./hooks.js";
12
12
  import { DEFAULT_THEME_TOKENS } from "./_theme-tokens.js";
13
13
  import { resolveGridGap } from "./grid-logic.js";
14
14
  import { resolveFormControlTokens } from "./form-control-tokens.js";
@@ -217,7 +217,8 @@ export function makeForm(rn) {
217
217
  function FormField({ label, required = false, helper, error, disabled = false, children, style, testID }) {
218
218
  const theme = useThemeTokens();
219
219
  const t = resolveFormControlTokens(theme);
220
- const requiredWord = useHostSharedText("required", "Required");
220
+ const text = useSdkText();
221
+ const requiredWord = text("required");
221
222
  const noteId = React.useId();
222
223
  const items = React.Children.toArray(children);
223
224
  const only = items.length === 1 ? items[0] : null;
@@ -0,0 +1,49 @@
1
+ // GENERATED from group-id-text.js by scripts/generate-cjs.js — DO NOT EDIT.
2
+ // Change group-id-text.js, then run `npm run generate:cjs` in packages/widget-sdk.
3
+ "use strict";
4
+
5
+ // Typed group ids hide the groups and break on Copy Workspace. One matcher
6
+ // for widget and Action settings; each caller supplies its own usage signal.
7
+ const GROUP_WORD = /group|grupp/i;
8
+ const ID_LIST_WORDING = /\b(?:ids?|uuids?|list)\b|comma|komma/i;
9
+ // Settings about a group, not naming one: its display text, name, look or count.
10
+ const NOT_A_GROUP_REF_NAME =
11
+ /group(?:by|ing|ed)|(?:label|title|heading|header|caption|text|name|prefix|description|mode|size|count|colou?r|icon|type)$/i;
12
+
13
+ function _holdsGroupIds(name, def) {
14
+ if (GROUP_WORD.test(name) && !NOT_A_GROUP_REF_NAME.test(name)) return true;
15
+ const wording = `${def.label ?? ""} ${def.description ?? ""}`;
16
+ return GROUP_WORD.test(wording) && ID_LIST_WORDING.test(wording);
17
+ }
18
+
19
+ function _groupIdTextFields(schema, prefix, out) {
20
+ if (!schema || typeof schema !== "object") return out;
21
+ for (const [name, def] of Object.entries(schema)) {
22
+ if (!def || typeof def !== "object") continue;
23
+ const path = prefix + name;
24
+ const items = def.items && typeof def.items === "object" ? def.items : null;
25
+ const isText = def.type === "string" || (def.type === "array" && items !== null && items.type === "string");
26
+ if (isText && _holdsGroupIds(name, def)) out.push(path);
27
+ if (def.type === "object") _groupIdTextFields(def.properties, `${path}.`, out);
28
+ if (items !== null && items.type === "object") _groupIdTextFields(items.properties, `${path}[].`, out);
29
+ }
30
+ return out;
31
+ }
32
+
33
+ /** A finding per text setting, at any depth, that holds user group ids. */
34
+ function groupIdTextFindings(propertySchema) {
35
+ return _groupIdTextFields(propertySchema, "", []).map((path) => ({
36
+ rule: "group-ids-as-text",
37
+ severity: "error",
38
+ label:
39
+ `propertySchema.${path} takes the app's user groups as typed text: makers cannot see which groups they chose, ` +
40
+ "and a workspace copy cannot carry them over. Declare { type: \"groupRef\", label } for one group, or " +
41
+ "{ type: \"array\", label, items: { type: \"groupRef\", label } } for several. Saved settings keep the old text, " +
42
+ "so read both forms (split a string on commas); the maker re-picks the groups in the Studio.",
43
+ line: 0,
44
+ snippet: "",
45
+ }));
46
+ }
47
+ module.exports = {
48
+ groupIdTextFindings,
49
+ };
@@ -0,0 +1,42 @@
1
+ // Typed group ids hide the groups and break on Copy Workspace. One matcher
2
+ // for widget and Action settings; each caller supplies its own usage signal.
3
+ const GROUP_WORD = /group|grupp/i;
4
+ const ID_LIST_WORDING = /\b(?:ids?|uuids?|list)\b|comma|komma/i;
5
+ // Settings about a group, not naming one: its display text, name, look or count.
6
+ const NOT_A_GROUP_REF_NAME =
7
+ /group(?:by|ing|ed)|(?:label|title|heading|header|caption|text|name|prefix|description|mode|size|count|colou?r|icon|type)$/i;
8
+
9
+ function _holdsGroupIds(name, def) {
10
+ if (GROUP_WORD.test(name) && !NOT_A_GROUP_REF_NAME.test(name)) return true;
11
+ const wording = `${def.label ?? ""} ${def.description ?? ""}`;
12
+ return GROUP_WORD.test(wording) && ID_LIST_WORDING.test(wording);
13
+ }
14
+
15
+ function _groupIdTextFields(schema, prefix, out) {
16
+ if (!schema || typeof schema !== "object") return out;
17
+ for (const [name, def] of Object.entries(schema)) {
18
+ if (!def || typeof def !== "object") continue;
19
+ const path = prefix + name;
20
+ const items = def.items && typeof def.items === "object" ? def.items : null;
21
+ const isText = def.type === "string" || (def.type === "array" && items !== null && items.type === "string");
22
+ if (isText && _holdsGroupIds(name, def)) out.push(path);
23
+ if (def.type === "object") _groupIdTextFields(def.properties, `${path}.`, out);
24
+ if (items !== null && items.type === "object") _groupIdTextFields(items.properties, `${path}[].`, out);
25
+ }
26
+ return out;
27
+ }
28
+
29
+ /** A finding per text setting, at any depth, that holds user group ids. */
30
+ export function groupIdTextFindings(propertySchema) {
31
+ return _groupIdTextFields(propertySchema, "", []).map((path) => ({
32
+ rule: "group-ids-as-text",
33
+ severity: "error",
34
+ label:
35
+ `propertySchema.${path} takes the app's user groups as typed text: makers cannot see which groups they chose, ` +
36
+ "and a workspace copy cannot carry them over. Declare { type: \"groupRef\", label } for one group, or " +
37
+ "{ type: \"array\", label, items: { type: \"groupRef\", label } } for several. Saved settings keep the old text, " +
38
+ "so read both forms (split a string on commas); the maker re-picks the groups in the Studio.",
39
+ line: 0,
40
+ snippet: "",
41
+ }));
42
+ }
package/dist/hooks.js CHANGED
@@ -43,6 +43,9 @@ import {
43
43
  widgetTranslationKey,
44
44
  sharedTranslationKey,
45
45
  isSharedTranslationKey,
46
+ // sc-16877 — the built-in default texts components fall back to.
47
+ sdkText,
48
+ fillSdkText,
46
49
  formatMoneyIn,
47
50
  normaliseCurrencyCode,
48
51
  // sc-5717 — "is this key still at its declared default", shared with the
@@ -274,12 +277,33 @@ function hostTranslation(hostT, key) {
274
277
  return hit ? text : null;
275
278
  }
276
279
 
277
- // @internal — a predefined shared string in the host's language, or
278
- // `fallback` outside a widget context. Not re-exported from index.js.
279
- export function useHostSharedText(key, fallback) {
280
+ // @internal — `text(key, values?)`: a component's default text in the app's
281
+ // language. The workspace's wording of a shared key wins, then the SDK's own
282
+ // table (CONTRACT `sdkText`), then English. Not re-exported from index.js.
283
+ export function useSdkText() {
280
284
  const ctx = useContext(HostWidgetContext);
281
- const hostT = ctx && ctx.i18n && typeof ctx.i18n.t === "function" ? ctx.i18n.t : null;
282
- return (hostT && hostTranslation(hostT, sharedTranslationKey(key))) || fallback;
285
+ const i18n = ctx ? ctx.i18n : undefined;
286
+ const hostT = i18n && typeof i18n.t === "function" ? i18n.t : null;
287
+ const locale = i18n && typeof i18n.locale === "string" ? i18n.locale : undefined;
288
+ return useCallback(
289
+ (key, values) => {
290
+ const own =
291
+ hostT && isSharedTranslationKey(key) ? hostTranslation(hostT, sharedTranslationKey(key)) : null;
292
+ return own === null ? sdkText(key, locale, values) : fillSdkText(own, values);
293
+ },
294
+ [hostT, locale],
295
+ );
296
+ }
297
+
298
+ // @internal — `props` with each prop named in `keys` the author left out set
299
+ // to its default text; `null` stays, as a destructuring default leaves it.
300
+ export function useSdkTextDefaults(props, keys) {
301
+ const text = useSdkText();
302
+ const resolved = { ...props };
303
+ for (const [prop, key] of Object.entries(keys)) {
304
+ resolved[prop] = props[prop] === undefined ? text(key) : props[prop];
305
+ }
306
+ return resolved;
283
307
  }
284
308
 
285
309
  /**
package/dist/index.d.ts CHANGED
@@ -4701,7 +4701,7 @@ export const DataTable: <Row = Record<string, any>>(
4701
4701
  showHeader?: boolean;
4702
4702
  /** Placeholder rows while `rows` is still empty. */
4703
4703
  loading?: boolean;
4704
- /** The empty state's title and message; the message defaults to "No results". */
4704
+ /** The empty state's title and message; the message defaults to "No results", in the app's language. */
4705
4705
  emptyTitle?: ReactNode;
4706
4706
  emptyMessage?: ReactNode;
4707
4707
  /** The words a sort is spoken with, in the widget's language. */
@@ -5112,13 +5112,13 @@ export interface SelectSearchProps<V extends string | number = string | number>
5112
5112
  * saved choice outside the first page), so the trigger names them.
5113
5113
  */
5114
5114
  selectedOptions?: Array<SelectOption<V>>;
5115
- /** Default "Search". */
5115
+ /** Default "Search", in the app's language. */
5116
5116
  searchPlaceholder?: string;
5117
- /** Shown when a query finds nothing. Default "No results". */
5117
+ /** Shown when a query finds nothing. Default "No results", in the app's language. */
5118
5118
  noResultsText?: string;
5119
- /** Default "Loading…". */
5119
+ /** Default "Loading…", in the app's language. */
5120
5120
  loadingText?: string;
5121
- /** Default "Could not load the options". */
5121
+ /** Default "Could not load the options", in the app's language. */
5122
5122
  loadErrorText?: string;
5123
5123
  }
5124
5124
 
@@ -5132,11 +5132,11 @@ export type SelectBaseProps<V extends string | number = string | number> = FormC
5132
5132
  * mode) that resolves to them; only its latest answer is shown.
5133
5133
  */
5134
5134
  options: Array<SelectOption<V>> | ((query: string) => Promise<Array<SelectOption<V>>>);
5135
- /** Shown while nothing is chosen. Default "Select". */
5135
+ /** Shown while nothing is chosen. Default "Select", in the app's language. */
5136
5136
  placeholder?: string;
5137
5137
  /** The sheet's heading. Defaults to a text `label`. */
5138
5138
  title?: string;
5139
- /** Shown in the sheet when `options` is empty. Default "No options". */
5139
+ /** Shown in the sheet when `options` is empty. Default "No options", in the app's language. */
5140
5140
  emptyText?: string;
5141
5141
  closeAccessibilityLabel?: string;
5142
5142
  /** The trigger. */
@@ -5185,7 +5185,7 @@ export const Select: <V extends string | number = string | number>(
5185
5185
  onValuesChange?: (values: V[], options: Array<SelectOption<V>>) => void;
5186
5186
  /** The trigger's text when the chips do not fit. Default `${count} selected`. */
5187
5187
  selectedCountText?: (count: number) => string;
5188
- /** The sheet's confirm button. Default "Done". */
5188
+ /** The sheet's confirm button. Default "Done", in the app's language. */
5189
5189
  doneText?: string;
5190
5190
  }),
5191
5191
  ) => any;
@@ -5233,7 +5233,7 @@ export const PeoplePicker: (
5233
5233
  pageSize?: number;
5234
5234
  /** Draw an avatar before each user or group. Default true. */
5235
5235
  showAvatars?: boolean;
5236
- /** A saved value whose row is gone, or a row with no name. Default "Unknown". */
5236
+ /** A saved value whose row is gone, or a row with no name. Default "Unknown", in the app's language. */
5237
5237
  unknownText?: string;
5238
5238
  } & (
5239
5239
  | {
@@ -5298,26 +5298,26 @@ export const FilterBar: (props: {
5298
5298
  options: Array<SelectOption>;
5299
5299
  value?: string | number | null;
5300
5300
  onChange: (value: string | number) => void;
5301
- /** Default "Sort". */
5301
+ /** Default "Sort", in the app's language. */
5302
5302
  label?: string;
5303
5303
  };
5304
- /** Default "Search". */
5304
+ /** Default "Search", in the app's language. */
5305
5305
  searchPlaceholder?: string;
5306
- /** A facet with nothing picked. Default "Any". */
5306
+ /** A facet with nothing picked. Default "Any", in the app's language. */
5307
5307
  anyText?: string;
5308
- /** The narrow button and the sheet's title. Default "Filters". */
5308
+ /** The narrow button and the sheet's title. Default "Filters", in the app's language. */
5309
5309
  filtersText?: string;
5310
- /** Spoken after the button's name; `{count}` is the number applied. Default "{count} active". */
5310
+ /** Spoken after the button's name; `{count}` is the number applied. Default "{count} active", in the app's language. */
5311
5311
  activeCountText?: string | ((count: number) => string);
5312
- /** Default "Clear all". */
5312
+ /** Default "Clear all", in the app's language. */
5313
5313
  clearAllText?: string;
5314
- /** Default "Apply". */
5314
+ /** Default "Apply", in the app's language. */
5315
5315
  applyText?: string;
5316
- /** Empties the sheet's facets and puts its sort on the first option. Default "Clear". */
5316
+ /** Empties the sheet's facets and puts its sort on the first option. Default "Clear", in the app's language. */
5317
5317
  clearText?: string;
5318
- /** Names the chip group. Default "Active filters". */
5318
+ /** Names the chip group. Default "Active filters", in the app's language. */
5319
5319
  activeFiltersText?: string;
5320
- /** A chip's remove control; `{label}` is the chip. Default "Remove {label}". */
5320
+ /** A chip's remove control; `{label}` is the chip. Default "Remove {label}", in the app's language. */
5321
5321
  removeText?: string | ((label: string) => string);
5322
5322
  closeAccessibilityLabel?: string;
5323
5323
  /** The outer box; its padding is not counted into the measured width. */
@@ -5358,9 +5358,9 @@ export const SearchField: (props: FormControlProps & {
5358
5358
  iconPosition?: SearchIconPosition;
5359
5359
  /** Called after the clear control empties the field. */
5360
5360
  onClear?: () => void;
5361
- /** Default "Search". */
5361
+ /** Default "Search", in the app's language. */
5362
5362
  placeholder?: string;
5363
- /** Default "Clear search". */
5363
+ /** Default "Clear search", in the app's language. */
5364
5364
  clearAccessibilityLabel?: string;
5365
5365
  /** The input; its flex, margin, width and position keys go to the box around it. */
5366
5366
  style?: any;
@@ -5466,7 +5466,7 @@ export const Banner: (props: {
5466
5466
  action?: { label: string; onPress: () => void; accessibilityLabel?: string; testID?: string };
5467
5467
  /** Shows a close control; hide the banner in the handler. */
5468
5468
  onDismiss?: () => void;
5469
- /** Default "Dismiss". */
5469
+ /** Default "Dismiss", in the app's language. */
5470
5470
  dismissAccessibilityLabel?: string;
5471
5471
  /** For hosts rendering outside a widget context; widgets omit it. */
5472
5472
  theme?: any;
@@ -5688,11 +5688,11 @@ export const FileUpload: (props: FormControlProps & FieldRequiredProps & {
5688
5688
  onReject?: (files: PickedFile[], reason: "type" | "count") => void;
5689
5689
  /** Shows the uploading state and locks the field. */
5690
5690
  uploading?: boolean;
5691
- /** Default "Choose file", or "Choose files" when `multiple`. */
5691
+ /** Default "Choose file", or "Choose files" when `multiple`, in the app's language. */
5692
5692
  buttonLabel?: string;
5693
5693
  /** Default "outlined". */
5694
5694
  buttonVariant?: "primary" | "secondary" | "outlined";
5695
- /** Default "Uploading…". */
5695
+ /** Default "Uploading…", in the app's language. */
5696
5696
  uploadingLabel?: string;
5697
5697
  /** Shown while nothing is chosen, where no drop is possible. */
5698
5698
  emptyLabel?: string;
@@ -5758,7 +5758,7 @@ export const Menu: (props: {
5758
5758
  accessibilityLabel?: string;
5759
5759
  /** Default "bottom"; it flips at the screen edge. */
5760
5760
  placement?: PopoverPlacement;
5761
- /** The sheet backdrop's name. Default "Close". */
5761
+ /** The sheet backdrop's name. Default "Close", in the app's language. */
5762
5762
  closeAccessibilityLabel?: string;
5763
5763
  /** On the panel; the item list takes `-items`. */
5764
5764
  testID?: string;
@@ -5784,7 +5784,7 @@ export const Popover: (props: {
5784
5784
  /** Default "bottom"; it flips at the screen edge. */
5785
5785
  placement?: PopoverPlacement;
5786
5786
  accessibilityLabel?: string;
5787
- /** The sheet backdrop's name. Default "Close". */
5787
+ /** The sheet backdrop's name. Default "Close", in the app's language. */
5788
5788
  closeAccessibilityLabel?: string;
5789
5789
  /** On the panel. */
5790
5790
  testID?: string;
@@ -5818,18 +5818,18 @@ export const Tooltip: (props: {
5818
5818
  * the English default.
5819
5819
  */
5820
5820
  export interface SortableLabels {
5821
- /** The handle's name and its options' title. Default "Move {item}". */
5821
+ /** The handle's name and its options' title. Default "Move {item}", in the app's language. */
5822
5822
  handle?: string;
5823
5823
  hint?: string;
5824
5824
  moveUp?: string;
5825
5825
  moveDown?: string;
5826
5826
  moveToTop?: string;
5827
5827
  moveToBottom?: string;
5828
- /** Default "Move to {column}". */
5828
+ /** Default "Move to {column}", in the app's language. */
5829
5829
  moveToColumn?: string;
5830
- /** Default "{item} moved to position {position} of {total}". */
5830
+ /** Default "{item} moved to position {position} of {total}", in the app's language. */
5831
5831
  moved?: string;
5832
- /** Default "{item} moved to {column}, position {position}". */
5832
+ /** Default "{item} moved to {column}, position {position}", in the app's language. */
5833
5833
  movedToColumn?: string;
5834
5834
  }
5835
5835
 
package/dist/linter.cjs CHANGED
@@ -4,6 +4,7 @@
4
4
 
5
5
  const { CONTRACT, normaliseActionTriggerTypes } = require("./contract.cjs");
6
6
  const { LUCIDE_ICON_NAMES, LUCIDE_VERSION } = require("./lucideIconNames.cjs");
7
+ const { groupIdTextFindings } = require("./group-id-text.cjs");
7
8
  const { stripNonCode: _stripNonCode } = require("./source-mask.cjs");
8
9
 
9
10
  // Static-analysis linter per docs/architecture/widget-marketplace.md §3.1.
@@ -1035,46 +1036,13 @@ function _manifestActionRules(manifest) {
1035
1036
  return findings;
1036
1037
  }
1037
1038
 
1038
- // Typed group ids hide the groups and break on Copy Workspace.
1039
+ // A widget's settings hold user groups only when its source reads them.
1039
1040
  const READS_USER_GROUPS = /\bgroupIds\b|\buseGroups\s*\(/;
1040
- const GROUP_WORD = /group|grupp/i;
1041
- const ID_LIST_WORDING = /\b(?:ids?|uuids?|list)\b|comma|komma/i;
1042
- const NOT_A_GROUP_REF_NAME = /group(?:by|ing|ed)|(?:label|title|heading|header|caption|text)$/i;
1043
-
1044
- function _holdsGroupIds(name, def) {
1045
- if (GROUP_WORD.test(name) && !NOT_A_GROUP_REF_NAME.test(name)) return true;
1046
- const wording = `${def.label ?? ""} ${def.description ?? ""}`;
1047
- return GROUP_WORD.test(wording) && ID_LIST_WORDING.test(wording);
1048
- }
1049
-
1050
- function _groupIdTextFields(schema, prefix, out) {
1051
- if (!schema || typeof schema !== "object") return out;
1052
- for (const [name, def] of Object.entries(schema)) {
1053
- if (!def || typeof def !== "object") continue;
1054
- const path = prefix + name;
1055
- const items = def.items && typeof def.items === "object" ? def.items : null;
1056
- const isText = def.type === "string" || (def.type === "array" && items !== null && items.type === "string");
1057
- if (isText && _holdsGroupIds(name, def)) out.push(path);
1058
- if (def.type === "object") _groupIdTextFields(def.properties, `${path}.`, out);
1059
- if (items !== null && items.type === "object") _groupIdTextFields(items.properties, `${path}[].`, out);
1060
- }
1061
- return out;
1062
- }
1063
1041
 
1064
1042
  function _groupIdTextRules(source, manifest) {
1065
1043
  if (!manifest || typeof manifest !== "object") return [];
1066
1044
  if (!READS_USER_GROUPS.test(_stripNonCode(source))) return [];
1067
- return _groupIdTextFields(manifest.propertySchema, "", []).map((path) => ({
1068
- rule: "group-ids-as-text",
1069
- severity: "error",
1070
- label:
1071
- `propertySchema.${path} takes the app's user groups as typed text: makers cannot see which groups they chose, ` +
1072
- "and a workspace copy cannot carry them over. Declare { type: \"groupRef\", label } for one group, or " +
1073
- "{ type: \"array\", label, items: { type: \"groupRef\", label } } for several. Saved settings keep the old text, " +
1074
- "so read both forms (split a string on commas); the maker re-picks the groups in the Studio.",
1075
- line: 0,
1076
- snippet: "",
1077
- }));
1045
+ return groupIdTextFindings(manifest.propertySchema);
1078
1046
  }
1079
1047
 
1080
1048
  // sc-1366 — invalid lucide icon import gate. lucide-react-native is a vetted
package/dist/linter.js CHANGED
@@ -8,6 +8,7 @@
8
8
 
9
9
  import { CONTRACT, normaliseActionTriggerTypes } from "./contract.js";
10
10
  import { LUCIDE_ICON_NAMES, LUCIDE_VERSION } from "./lucideIconNames.js";
11
+ import { groupIdTextFindings } from "./group-id-text.js";
11
12
 
12
13
  // Per-identifier match rule, run over the whole masked source. Most banned
13
14
  // identifiers compile to a whole-word match.
@@ -1030,46 +1031,13 @@ function _manifestActionRules(manifest) {
1030
1031
  return findings;
1031
1032
  }
1032
1033
 
1033
- // Typed group ids hide the groups and break on Copy Workspace.
1034
+ // A widget's settings hold user groups only when its source reads them.
1034
1035
  const READS_USER_GROUPS = /\bgroupIds\b|\buseGroups\s*\(/;
1035
- const GROUP_WORD = /group|grupp/i;
1036
- const ID_LIST_WORDING = /\b(?:ids?|uuids?|list)\b|comma|komma/i;
1037
- const NOT_A_GROUP_REF_NAME = /group(?:by|ing|ed)|(?:label|title|heading|header|caption|text)$/i;
1038
-
1039
- function _holdsGroupIds(name, def) {
1040
- if (GROUP_WORD.test(name) && !NOT_A_GROUP_REF_NAME.test(name)) return true;
1041
- const wording = `${def.label ?? ""} ${def.description ?? ""}`;
1042
- return GROUP_WORD.test(wording) && ID_LIST_WORDING.test(wording);
1043
- }
1044
-
1045
- function _groupIdTextFields(schema, prefix, out) {
1046
- if (!schema || typeof schema !== "object") return out;
1047
- for (const [name, def] of Object.entries(schema)) {
1048
- if (!def || typeof def !== "object") continue;
1049
- const path = prefix + name;
1050
- const items = def.items && typeof def.items === "object" ? def.items : null;
1051
- const isText = def.type === "string" || (def.type === "array" && items !== null && items.type === "string");
1052
- if (isText && _holdsGroupIds(name, def)) out.push(path);
1053
- if (def.type === "object") _groupIdTextFields(def.properties, `${path}.`, out);
1054
- if (items !== null && items.type === "object") _groupIdTextFields(items.properties, `${path}[].`, out);
1055
- }
1056
- return out;
1057
- }
1058
1036
 
1059
1037
  function _groupIdTextRules(source, manifest) {
1060
1038
  if (!manifest || typeof manifest !== "object") return [];
1061
1039
  if (!READS_USER_GROUPS.test(_stripNonCode(source))) return [];
1062
- return _groupIdTextFields(manifest.propertySchema, "", []).map((path) => ({
1063
- rule: "group-ids-as-text",
1064
- severity: "error",
1065
- label:
1066
- `propertySchema.${path} takes the app's user groups as typed text: makers cannot see which groups they chose, ` +
1067
- "and a workspace copy cannot carry them over. Declare { type: \"groupRef\", label } for one group, or " +
1068
- "{ type: \"array\", label, items: { type: \"groupRef\", label } } for several. Saved settings keep the old text, " +
1069
- "so read both forms (split a string on commas); the maker re-picks the groups in the Studio.",
1070
- line: 0,
1071
- snippet: "",
1072
- }));
1040
+ return groupIdTextFindings(manifest.propertySchema);
1073
1041
  }
1074
1042
 
1075
1043
  // sc-1366 — invalid lucide icon import gate. lucide-react-native is a vetted
@@ -2,9 +2,8 @@
2
2
  // (`loading.js` / `loading.native.js`) differ only in their primitives.
3
3
 
4
4
  import React from "react";
5
- import { useHostTheme, useHostSharedText } from "./hooks.js";
5
+ import { useHostTheme, useSdkText } from "./hooks.js";
6
6
  import { DEFAULT_THEME_TOKENS } from "./_theme-tokens.js";
7
- import { CONTRACT } from "./contract.js";
8
7
  import { resolveListTokens, listRowFrame } from "./list-tokens.js";
9
8
  import { textRoleStyle } from "./text-roles.js";
10
9
  import { flattenStyle } from "./flatten-style.js";
@@ -24,7 +23,6 @@ import {
24
23
  SKELETON_LIST_ROW_LINE_WIDTHS,
25
24
  } from "./loading-tokens.js";
26
25
 
27
- const LOADING_FALLBACK = CONTRACT.sharedTranslationKeys.loading.en;
28
26
  const FILL = { position: "absolute", top: 0, right: 0, bottom: 0, left: 0 };
29
27
  const TRACK_OPACITY = 0.2;
30
28
  const HIDDEN = { "aria-hidden": true, importantForAccessibility: "no-hide-descendants" };
@@ -153,7 +151,7 @@ export function makeLoading(rn, { useNativeDriver }) {
153
151
  testID,
154
152
  }) {
155
153
  const theme = useLoadingTheme(explicitTheme);
156
- const loadingText = useHostSharedText("loading", LOADING_FALLBACK);
154
+ const loadingText = useSdkText()("loading");
157
155
  const moving = !useReducedMotion();
158
156
  useSharedLoop(turn, moving);
159
157
 
@@ -286,7 +284,7 @@ export function makeLoading(rn, { useNativeDriver }) {
286
284
  function Skeleton(props) {
287
285
  const { shape, accessibilityLabel, theme: explicitTheme, style, testID } = props;
288
286
  const theme = useLoadingTheme(explicitTheme);
289
- const loadingText = useHostSharedText("loading", LOADING_FALLBACK);
287
+ const loadingText = useSdkText()("loading");
290
288
  const nested = React.useContext(RegionContext);
291
289
  // The outermost skeleton pulses as one; the bones inside it never animate.
292
290
  const moving = !useReducedMotion() && !nested;