@colixsystems/widget-sdk 0.277.0 → 0.277.2
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 +9 -1
- package/dist/linter.cjs +11 -2
- package/dist/linter.js +11 -2
- package/dist/markdown-editor-css.js +4 -1
- package/dist/markdown-editor-html.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -86,7 +86,15 @@ See the design reference for the full architecture: [`docs/architecture/widget-m
|
|
|
86
86
|
|
|
87
87
|
## Status
|
|
88
88
|
|
|
89
|
-
`v0.277.
|
|
89
|
+
`v0.277.2` — 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**.
|
|
90
|
+
|
|
91
|
+
### What's new in 0.277.2
|
|
92
|
+
|
|
93
|
+
**`<MarkdownInput>` shows list numbers and bullets on web.** The editor declares its own list markers, so a host page whose stylesheet resets list styles no longer hides them.
|
|
94
|
+
|
|
95
|
+
### What's new in 0.277.1
|
|
96
|
+
|
|
97
|
+
**`hand-rolled-write-gate` no longer fires on `theme.typography.roles`.** The rule looked for `.roles` / `.groupIds` anywhere in the file, so a writing widget that called `useUser()` and styled its text with `theme.typography.roles[name]` was flagged on the `useUser()` line and, through the publish gate, refused. It now reads only the value `useUser()` returns: the identifier it is assigned to (`user.roles`, `user?.groupIds`), a destructured `{ roles }` or `{ groupIds }`, or `useUser().roles` inline. Gating a write on `user.roles` without `useCanWrite` still warns.
|
|
90
98
|
|
|
91
99
|
### What's new in 0.277.0
|
|
92
100
|
|
package/dist/linter.cjs
CHANGED
|
@@ -1589,13 +1589,22 @@ function _rawUseMemoIntoDatastoreQueryRules(source) {
|
|
|
1589
1589
|
// `.roles` re-implements the table ACL client-side and drifts from it the
|
|
1590
1590
|
// moment the ACL changes; `useCanWrite(tableId)` reads the same rule the
|
|
1591
1591
|
// write endpoint enforces. Flags only when the file has NOT already reached
|
|
1592
|
-
// for it.
|
|
1592
|
+
// for it, and only on useUser()'s own value: `theme.typography.roles` is a
|
|
1593
|
+
// style read (sc-15204).
|
|
1594
|
+
function _readsUserRoles(code) {
|
|
1595
|
+
const named = /\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*useUser\s*\(\s*\)/.exec(code);
|
|
1596
|
+
if (named && new RegExp(`\\b${named[1].replace(/\$/g, "\\$")}\\??\\.(groupIds|roles)\\b`).test(code)) return true;
|
|
1597
|
+
const destructured = /\b(?:const|let|var)\s*\{([^}]*)\}\s*=\s*useUser\s*\(\s*\)/.exec(code);
|
|
1598
|
+
if (destructured && /\b(groupIds|roles)\b/.test(destructured[1])) return true;
|
|
1599
|
+
return /\buseUser\s*\(\s*\)\s*\??\.(groupIds|roles)\b/.test(code);
|
|
1600
|
+
}
|
|
1601
|
+
|
|
1593
1602
|
function _handRolledWriteGateRules(source) {
|
|
1594
1603
|
const code = _stripNonCode(source);
|
|
1595
1604
|
if (/\buseCanWrite\s*\(/.test(code)) return [];
|
|
1596
1605
|
const userCall = /\buseUser\s*\(\s*\)/.exec(code);
|
|
1597
1606
|
if (!userCall) return [];
|
|
1598
|
-
if (
|
|
1607
|
+
if (!_readsUserRoles(code)) return [];
|
|
1599
1608
|
const hasWrite =
|
|
1600
1609
|
/\.(create|update)\s*\(/.test(code) ||
|
|
1601
1610
|
/\buseDatastoreMutation\s*\(/.test(code);
|
package/dist/linter.js
CHANGED
|
@@ -1584,13 +1584,22 @@ function _rawUseMemoIntoDatastoreQueryRules(source) {
|
|
|
1584
1584
|
// `.roles` re-implements the table ACL client-side and drifts from it the
|
|
1585
1585
|
// moment the ACL changes; `useCanWrite(tableId)` reads the same rule the
|
|
1586
1586
|
// write endpoint enforces. Flags only when the file has NOT already reached
|
|
1587
|
-
// for it.
|
|
1587
|
+
// for it, and only on useUser()'s own value: `theme.typography.roles` is a
|
|
1588
|
+
// style read (sc-15204).
|
|
1589
|
+
function _readsUserRoles(code) {
|
|
1590
|
+
const named = /\b(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*useUser\s*\(\s*\)/.exec(code);
|
|
1591
|
+
if (named && new RegExp(`\\b${named[1].replace(/\$/g, "\\$")}\\??\\.(groupIds|roles)\\b`).test(code)) return true;
|
|
1592
|
+
const destructured = /\b(?:const|let|var)\s*\{([^}]*)\}\s*=\s*useUser\s*\(\s*\)/.exec(code);
|
|
1593
|
+
if (destructured && /\b(groupIds|roles)\b/.test(destructured[1])) return true;
|
|
1594
|
+
return /\buseUser\s*\(\s*\)\s*\??\.(groupIds|roles)\b/.test(code);
|
|
1595
|
+
}
|
|
1596
|
+
|
|
1588
1597
|
function _handRolledWriteGateRules(source) {
|
|
1589
1598
|
const code = _stripNonCode(source);
|
|
1590
1599
|
if (/\buseCanWrite\s*\(/.test(code)) return [];
|
|
1591
1600
|
const userCall = /\buseUser\s*\(\s*\)/.exec(code);
|
|
1592
1601
|
if (!userCall) return [];
|
|
1593
|
-
if (
|
|
1602
|
+
if (!_readsUserRoles(code)) return [];
|
|
1594
1603
|
const hasWrite =
|
|
1595
1604
|
/\.(create|update)\s*\(/.test(code) ||
|
|
1596
1605
|
/\buseDatastoreMutation\s*\(/.test(code);
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
//
|
|
3
3
|
// Kept apart from the editor module so the web host can style the field
|
|
4
4
|
// before the lazily loaded editor arrives, and the native WebView page can
|
|
5
|
-
// paint the same rules from the tokens it is sent.
|
|
5
|
+
// paint the same rules from the tokens it is sent. List markers are declared
|
|
6
|
+
// outright: a host stylesheet reset (Tailwind preflight) strips them.
|
|
6
7
|
|
|
7
8
|
// Theme values are written into a stylesheet, so nothing may close the rule.
|
|
8
9
|
const clean = (value) => String(value == null ? "" : value).replace(/[{}<>;\\]/g, "");
|
|
@@ -30,6 +31,8 @@ ${s} .ProseMirror h1{font-size:${px(t.headingSizes[1])};line-height:1.3}
|
|
|
30
31
|
${s} .ProseMirror h2{font-size:${px(t.headingSizes[2])};line-height:1.3}
|
|
31
32
|
${s} .ProseMirror h3{font-size:${px(t.headingSizes[3])};line-height:1.3}
|
|
32
33
|
${s} .ProseMirror ul,${s} .ProseMirror ol{margin:0 0 ${px(t.blockGap)};padding-left:1.4em}
|
|
34
|
+
${s} .ProseMirror ul{list-style-type:disc}
|
|
35
|
+
${s} .ProseMirror ol{list-style-type:decimal}
|
|
33
36
|
${s} .ProseMirror li p{margin:0}
|
|
34
37
|
${s} .ProseMirror code{font-family:ui-monospace,Menlo,monospace;font-size:${px(t.codeSize)};color:${t.mutedColor}}
|
|
35
38
|
${s} .ProseMirror pre{margin:0 0 ${px(t.blockGap)};padding:${px(t.blockGap)};border:1px solid ${t.border};border-radius:${px(t.radius)};white-space:pre-wrap}
|