@colixsystems/widget-sdk 0.326.0 → 0.326.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/dist/contract.cjs +3 -1
- package/dist/contract.js +3 -1
- package/dist/group-id-text.cjs +49 -0
- package/dist/group-id-text.js +42 -0
- package/dist/linter.cjs +3 -35
- package/dist/linter.js +3 -35
- package/package.json +1 -1
- package/src/contract.js +3 -1
package/README.md
CHANGED
|
@@ -91,7 +91,11 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
|
|
|
91
91
|
|
|
92
92
|
## Status
|
|
93
93
|
|
|
94
|
-
`v0.326.
|
|
94
|
+
`v0.326.1` — pre-publish. The package surface (types, function names, export paths) is the v1 contract; runtime behaviour for some hooks is stubbed (each hook documents what's wired and what isn't). It is **not yet published to npm**.
|
|
95
|
+
|
|
96
|
+
### What's new in 0.326.1 (contract 1.265.1)
|
|
97
|
+
|
|
98
|
+
**`group-ids-as-text` passes a setting about a group.** A `string` setting whose name ends in `name`, `prefix`, `description`, `mode`, `size`, `count`, `color` / `colour`, `icon` or `type`, such as `groupName` or `groupColor`, holds no group ids, so the linter no longer refuses it.
|
|
95
99
|
|
|
96
100
|
### What's new in 0.324.0 (contract 1.264.0)
|
|
97
101
|
|
package/dist/contract.cjs
CHANGED
|
@@ -7032,7 +7032,9 @@ const CONTRACT = deepFreeze({
|
|
|
7032
7032
|
// `editable={false}` locks the field and its toolbar.
|
|
7033
7033
|
// 1.265.0: `font` is a field type, and a font named in the source is
|
|
7034
7034
|
// `no-hardcoded-design` with no licence (sc-17364).
|
|
7035
|
-
|
|
7035
|
+
// 1.265.1: narrower lint — `group-ids-as-text` passes a group's name,
|
|
7036
|
+
// prefix, description, mode, size, count, colour, icon or type.
|
|
7037
|
+
version: "1.265.1",
|
|
7036
7038
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
7037
7039
|
hooks: HOOKS,
|
|
7038
7040
|
primitives: PRIMITIVES,
|
package/dist/contract.js
CHANGED
|
@@ -7027,7 +7027,9 @@ const CONTRACT = deepFreeze({
|
|
|
7027
7027
|
// `editable={false}` locks the field and its toolbar.
|
|
7028
7028
|
// 1.265.0: `font` is a field type, and a font named in the source is
|
|
7029
7029
|
// `no-hardcoded-design` with no licence (sc-17364).
|
|
7030
|
-
|
|
7030
|
+
// 1.265.1: narrower lint — `group-ids-as-text` passes a group's name,
|
|
7031
|
+
// prefix, description, mode, size, count, colour, icon or type.
|
|
7032
|
+
version: "1.265.1",
|
|
7031
7033
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
7032
7034
|
hooks: HOOKS,
|
|
7033
7035
|
primitives: PRIMITIVES,
|
|
@@ -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/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
|
-
//
|
|
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
|
|
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
|
-
//
|
|
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
|
|
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
|
package/package.json
CHANGED
package/src/contract.js
CHANGED
|
@@ -7027,7 +7027,9 @@ const CONTRACT = deepFreeze({
|
|
|
7027
7027
|
// `editable={false}` locks the field and its toolbar.
|
|
7028
7028
|
// 1.265.0: `font` is a field type, and a font named in the source is
|
|
7029
7029
|
// `no-hardcoded-design` with no licence (sc-17364).
|
|
7030
|
-
|
|
7030
|
+
// 1.265.1: narrower lint — `group-ids-as-text` passes a group's name,
|
|
7031
|
+
// prefix, description, mode, size, count, colour, icon or type.
|
|
7032
|
+
version: "1.265.1",
|
|
7031
7033
|
sharedTranslationKeys: SHARED_TRANSLATION_KEYS,
|
|
7032
7034
|
hooks: HOOKS,
|
|
7033
7035
|
primitives: PRIMITIVES,
|