@sableui/react 0.5.0 → 0.6.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/AGENTS.md +2 -2
- package/CHANGELOG.md +148 -0
- package/CONTRIBUTING.md +1 -1
- package/THIRD_PARTY_NOTICES.md +11 -0
- package/bin/sable-lint.mjs +2 -1
- package/bin/sable.mjs +3 -2
- package/dist/{_contract-Cn3lUpih.d.ts → _contract-C2M1SjBf.d.ts} +20 -2
- package/dist/blocks/index.js +19 -51
- package/dist/{chunk-RCLKXF2N.js → chunk-7QSDYBXO.js} +610 -30
- package/dist/{chunk-GU3T7SBA.js → chunk-EDXLM7YL.js} +1 -1
- package/dist/chunk-FKZXAFIY.js +12 -0
- package/dist/{chunk-OQACYT2D.js → chunk-NETUFI34.js} +23 -1
- package/dist/{chunk-ZBZMKOO7.js → chunk-VVW4UCDI.js} +3 -3
- package/dist/foundations/index.js +6 -0
- package/dist/index.d.ts +127 -11
- package/dist/index.js +23 -13
- package/dist/ios/index.d.ts +6 -1
- package/dist/ios/index.js +4 -3
- package/dist/ios/styles.css +9 -0
- package/dist/patterns/index.js +22 -28
- package/dist/presets/index.d.ts +108 -5
- package/dist/presets/index.js +239 -6
- package/dist/styles.css +50 -0
- package/dist/{theme-provider-CGeiusgu.d.ts → theme-provider-kQszHYji.d.ts} +1 -1
- package/dist/themes/atelier/atelier.css +31 -3
- package/dist/themes/atelier/index.d.ts +1 -1
- package/dist/themes/ember/ember.css +38 -7
- package/dist/themes/ember/index.d.ts +1 -1
- package/dist/themes/index.d.ts +2 -2
- package/dist/themes/meridian/index.d.ts +1 -1
- package/dist/themes/meridian/meridian.css +33 -4
- package/dist/themes/poppy/index.d.ts +1 -1
- package/dist/themes/poppy/poppy.css +28 -0
- package/dist/themes/prism/index.d.ts +1 -1
- package/dist/themes/prism/prism.css +26 -0
- package/dist/themes/sable/index.d.ts +1 -1
- package/dist/themes/sable/sable.css +24 -11
- package/dist/themes/verdant/index.d.ts +1 -1
- package/dist/themes/verdant/verdant.css +34 -4
- package/llms/blocks/danger-zone-block.md +1 -1
- package/llms/blocks/event-card-block.md +1 -1
- package/llms/blocks/feedback-form-block.md +1 -1
- package/llms/blocks/invite-team-block.md +1 -1
- package/llms/blocks/media-player-block.md +3 -16
- package/llms/blocks/notification-list-block.md +3 -3
- package/llms/blocks/product-card-block.md +3 -17
- package/llms/blocks/profile-card-block.md +4 -17
- package/llms/blocks/profile-form-block.md +2 -2
- package/llms/blocks/team-members-block.md +1 -1
- package/llms/blocks/testimonial-block.md +1 -1
- package/llms/components/avatar.md +13 -1
- package/llms/components/card.md +1 -1
- package/llms/components/gradient-art.md +80 -0
- package/llms/components/sheet.md +1 -1
- package/llms/foundations/accessibility.md +1 -0
- package/llms/patterns/auth-page.md +5 -19
- package/llms/patterns/brand-landing-page.md +1 -1
- package/llms/patterns/chat-panel.md +1 -1
- package/llms/patterns/dashboard-page.md +4 -4
- package/llms/patterns/feed-page.md +4 -4
- package/llms/patterns/landing-page.md +1 -1
- package/llms/patterns/list-detail-page.md +3 -2
- package/llms/patterns/settings-page.md +3 -3
- package/llms/reference/token-intent.md +9 -1
- package/llms/tasks/auditing-an-app.md +6 -0
- package/llms/tasks/building-an-ios-prototype.md +3 -1
- package/llms/tasks/converting-an-app.md +1 -1
- package/llms/tasks/creating-a-preset.md +24 -0
- package/llms/tasks/reviewing-a-design.md +9 -0
- package/llms/tasks/using-presets.md +6 -1
- package/llms-full.txt +201 -104
- package/llms.txt +3 -2
- package/package.json +9 -7
- package/registry.json +283 -30
- package/scripts/design-presets.mjs +27 -4
- package/scripts/grade.mjs +2 -1
- package/scripts/label-contrast.mjs +174 -0
- package/scripts/lint-rules.mjs +39 -2
- package/skills/sable/SKILL.md +3 -1
- package/targets/ios.json +18 -2
- package/third-party/paper-shaders-LICENSE.txt +201 -0
- package/third-party/paper-shaders-NOTICE.txt +5 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFileSync } from "node:fs"
|
|
2
2
|
import { resolve } from "node:path"
|
|
3
3
|
import { fileURLToPath } from "node:url"
|
|
4
|
-
import { parsePreset, presetCss } from "../dist/presets/index.js"
|
|
4
|
+
import { LABEL_CONTRAST_RULE, parsePreset, presetCss, presetLabelContrast } from "../dist/presets/index.js"
|
|
5
5
|
import { parseFlags } from "./design-preferences.mjs"
|
|
6
6
|
|
|
7
7
|
const packageRoot = fileURLToPath(new URL("../", import.meta.url))
|
|
@@ -39,10 +39,33 @@ try {
|
|
|
39
39
|
const file = flags.get(action)
|
|
40
40
|
if (!file || file.startsWith("--")) throw new Error(`${action} requires a preset JSON path.`)
|
|
41
41
|
const preset = parsePreset(JSON.parse(readFileSync(resolve(file), "utf8")))
|
|
42
|
-
if (action === "--check")
|
|
43
|
-
|
|
42
|
+
if (action === "--check") {
|
|
43
|
+
// Labels on brand and status fills: Sable's opinion, enforced unless the preset
|
|
44
|
+
// records that it declines it (`exceptions`), which is then reported.
|
|
45
|
+
const labels = presetLabelContrast(preset)
|
|
46
|
+
const pair = f => `${f.mode} ${f.fill}-foreground on ${f.fill}: ${f.ratio.toFixed(2)}:1, APCA Lc ${Math.abs(f.lc).toFixed(0)}`
|
|
47
|
+
if (labels.open.length) {
|
|
48
|
+
const exceptions = labels.open.map(f => JSON.stringify({ rule: LABEL_CONTRAST_RULE, mode: f.mode, token: f.fill, reason: "<why>" }))
|
|
49
|
+
const err = new Error(
|
|
50
|
+
"Labels on filled roles must clear 4.5:1 and APCA Lc 60. These fail the ratio or read muddy:\n" +
|
|
51
|
+
labels.open.map(f => ` ${pair(f)} → try ${f.fill}: ${f.suggestion.fill}; ${f.fill}-foreground: ${f.suggestion.ink}`).join("\n") +
|
|
52
|
+
`\nTo keep a pair as designed, record it in the preset: "exceptions": [${exceptions.join(", ")}]`,
|
|
53
|
+
)
|
|
54
|
+
err.code = "ERR_PRESET_CONTRAST"
|
|
55
|
+
err.data = { findings: labels.open }
|
|
56
|
+
err.suggestions = ["Apply the suggested fill/ink pairs", "Or add an exceptions entry with a reason", "sable docs creating-a-preset"]
|
|
57
|
+
throw err
|
|
58
|
+
}
|
|
59
|
+
const accepted = labels.accepted.map(f => `\n accepted: ${pair(f)} — ${f.reason}`).join("")
|
|
60
|
+
const unmeasured = labels.unmeasured.length ? `, ${labels.unmeasured.length} unmeasured (${labels.unmeasured.join(", ")})` : ""
|
|
61
|
+
emit(
|
|
62
|
+
"preset.check",
|
|
63
|
+
{ valid: true, id: preset.id, revision: preset.revision, authoredWith: preset.sableVersion, labelContrast: { measured: labels.measured, accepted: labels.accepted, unmeasured: labels.unmeasured } },
|
|
64
|
+
`Valid preset ${preset.id}, revision ${preset.revision}. Labels on filled roles: ${labels.measured} pairs measured${unmeasured}.${accepted}\nReview rendered contrast and brief fit separately.`,
|
|
65
|
+
)
|
|
66
|
+
} else { const css = presetCss(preset); emit("preset.css", { id: preset.id, revision: preset.revision, css }, css) }
|
|
44
67
|
}
|
|
45
68
|
} catch (error) {
|
|
46
|
-
process.stderr.write(JSON.stringify({ type: "error", code: "ERR_PRESET_INVALID", message: error.message, suggestions: ["sable docs using-presets", "sable preset --template"] }) + "\n")
|
|
69
|
+
process.stderr.write(JSON.stringify({ type: "error", code: error.code ?? "ERR_PRESET_INVALID", message: error.message, ...(error.data ? { data: error.data } : {}), suggestions: error.suggestions ?? ["sable docs using-presets", "sable preset --template"] }) + "\n")
|
|
47
70
|
process.exitCode = 1
|
|
48
71
|
}
|
package/scripts/grade.mjs
CHANGED
|
@@ -34,6 +34,7 @@ import { createHash } from "node:crypto"
|
|
|
34
34
|
import { dirname, extname, join, relative, resolve } from "node:path"
|
|
35
35
|
import { fileURLToPath } from "node:url"
|
|
36
36
|
import { ignoreGlob, lintText, makeRules } from "./lint-rules.mjs"
|
|
37
|
+
import { labelContrastScanner, statusTextDrift } from "./label-contrast.mjs"
|
|
37
38
|
import { skeletonize } from "./skeleton.mjs"
|
|
38
39
|
import { assessReview, reviewTemplate } from "./review-evidence.mjs"
|
|
39
40
|
|
|
@@ -108,7 +109,7 @@ const motionTokens = new Set(
|
|
|
108
109
|
REGISTRY.tokens?.motion?.scale,
|
|
109
110
|
].filter(Boolean),
|
|
110
111
|
)
|
|
111
|
-
const RULES = makeRules({ semanticTokens, motionTokens }).filter((r) => r.scope !== "package")
|
|
112
|
+
const RULES = makeRules({ semanticTokens, motionTokens, labelContrast: await labelContrastScanner(PKG_ROOT, REGISTRY.themes?.default), statusText: (css) => statusTextDrift(css, REGISTRY.themes?.default) }).filter((r) => r.scope !== "package")
|
|
112
113
|
const PROP_SURFACE = REGISTRY.propSurface?.items ?? {}
|
|
113
114
|
const ICONS = new Set(REGISTRY.iconContract?.names ?? [])
|
|
114
115
|
/**
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `label-contrast` lint rule's reader: which brand-fill tokens a stylesheet
|
|
3
|
+
* overrides, in which mode and theme, measured on top of the installed theme.
|
|
4
|
+
*
|
|
5
|
+
* The rule itself lives in lint-rules.mjs with the others; it stays dependency
|
|
6
|
+
* free by taking this scanner as an argument. The measuring is the package's own
|
|
7
|
+
* (`checkLabelledFills` from the built `presets` entry), so the linter, `sable
|
|
8
|
+
* preset --check`, Sable's theme tests and Customize cannot disagree about what
|
|
9
|
+
* reads.
|
|
10
|
+
*
|
|
11
|
+
* An app overriding `--primary` usually leaves `--primary-foreground` to the
|
|
12
|
+
* theme, and that is exactly the pair that goes wrong — so a pair is completed
|
|
13
|
+
* from the theme the selector names (`[data-sable-theme="ember"]`), or the
|
|
14
|
+
* default theme. Only pairs the stylesheet itself declares a half of are
|
|
15
|
+
* reported; the theme's own pairs are Sable's to keep.
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
import { existsSync, readFileSync } from "node:fs"
|
|
19
|
+
import { join } from "node:path"
|
|
20
|
+
import { pathToFileURL } from "node:url"
|
|
21
|
+
|
|
22
|
+
const DARK = /\.dark\b|\[data-(?:theme|mode|color-scheme)=["']?dark|prefers-color-scheme:\s*dark/
|
|
23
|
+
const LIGHT = /\.light\b|\[data-(?:theme|mode|color-scheme)=["']?light|prefers-color-scheme:\s*light/
|
|
24
|
+
const THEME = /data-sable-theme=["']?([\w-]+)/
|
|
25
|
+
|
|
26
|
+
const stripComments = (css) => css.replace(/\/\*[\s\S]*?\*\//g, (m) => m.replace(/[^\n]/g, " "))
|
|
27
|
+
|
|
28
|
+
/** Every `--name: value` inside a block, with its offset and enclosing preludes. */
|
|
29
|
+
export function customProperties(css) {
|
|
30
|
+
const out = []
|
|
31
|
+
const stack = []
|
|
32
|
+
let start = 0
|
|
33
|
+
const take = (end) => {
|
|
34
|
+
const text = css.slice(start, end)
|
|
35
|
+
const m = text.match(/^\s*--([\w-]+)\s*:\s*([\s\S]*?)\s*$/)
|
|
36
|
+
if (m && stack.length) out.push({ name: m[1], value: m[2], index: start + text.indexOf("--"), context: stack.join(" ") })
|
|
37
|
+
}
|
|
38
|
+
for (let i = 0; i < css.length; i++) {
|
|
39
|
+
const ch = css[i]
|
|
40
|
+
if (ch === "{") {
|
|
41
|
+
stack.push(css.slice(start, i).trim())
|
|
42
|
+
start = i + 1
|
|
43
|
+
} else if (ch === "}") {
|
|
44
|
+
take(i)
|
|
45
|
+
stack.pop()
|
|
46
|
+
start = i + 1
|
|
47
|
+
} else if (ch === ";") {
|
|
48
|
+
take(i)
|
|
49
|
+
start = i + 1
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return out
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const modeOf = (decl) => (DARK.test(decl.context) ? "dark" : LIGHT.test(decl.context) ? "light" : "both")
|
|
56
|
+
const applies = (decl, mode) => {
|
|
57
|
+
const m = modeOf(decl)
|
|
58
|
+
return m === "both" || m === mode
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Light and dark token maps. A declaration outside any dark scope reaches dark
|
|
63
|
+
* mode too: an app's stylesheet loads after Sable's, so `:root { --primary }`
|
|
64
|
+
* outranks the theme's equal-specificity `.dark` value.
|
|
65
|
+
*/
|
|
66
|
+
function modeMaps(decls, base) {
|
|
67
|
+
const light = { ...base?.light }
|
|
68
|
+
const dark = { ...base?.dark }
|
|
69
|
+
for (const d of decls) {
|
|
70
|
+
if (applies(d, "light")) light[d.name] = d.value
|
|
71
|
+
if (applies(d, "dark")) dark[d.name] = d.value
|
|
72
|
+
}
|
|
73
|
+
return { light, dark }
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function resolveAll(map) {
|
|
77
|
+
const resolve = (value, depth) =>
|
|
78
|
+
depth > 12
|
|
79
|
+
? value
|
|
80
|
+
: value.replace(/var\(\s*--([\w-]+)\s*(?:,\s*([^()]*))?\)/g, (m, name, fallback) =>
|
|
81
|
+
map[name] != null ? resolve(map[name], depth + 1) : fallback?.trim() || m,
|
|
82
|
+
)
|
|
83
|
+
return Object.fromEntries(Object.entries(map).map(([k, v]) => [k, resolve(v, 0)]))
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* A scanner for one stylesheet's text, or null when the package's built entry
|
|
88
|
+
* is missing (the rule then reports nothing rather than guessing).
|
|
89
|
+
*/
|
|
90
|
+
export async function labelContrastScanner(pkgRoot, defaultTheme = "sable") {
|
|
91
|
+
const entry = join(pkgRoot, "dist/presets/index.js")
|
|
92
|
+
if (!existsSync(entry)) return null
|
|
93
|
+
const { checkLabelledFills, LABELLED_FILLS } = await import(pathToFileURL(entry).href)
|
|
94
|
+
const watched = new Set(LABELLED_FILLS.flatMap((f) => [f, `${f}-foreground`]))
|
|
95
|
+
const themes = new Map()
|
|
96
|
+
const theme = (id) => {
|
|
97
|
+
if (!themes.has(id)) {
|
|
98
|
+
const file = join(pkgRoot, "dist/themes", id, `${id}.css`)
|
|
99
|
+
themes.set(id, existsSync(file) ? modeMaps(customProperties(stripComments(readFileSync(file, "utf8")))) : null)
|
|
100
|
+
}
|
|
101
|
+
return themes.get(id)
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return (css) => {
|
|
105
|
+
const decls = customProperties(css)
|
|
106
|
+
if (!decls.some((d) => watched.has(d.name))) return []
|
|
107
|
+
const byTheme = new Map()
|
|
108
|
+
for (const d of decls) {
|
|
109
|
+
const id = d.context.match(THEME)?.[1] ?? defaultTheme
|
|
110
|
+
if (!byTheme.has(id)) byTheme.set(id, [])
|
|
111
|
+
byTheme.get(id).push(d)
|
|
112
|
+
}
|
|
113
|
+
const out = []
|
|
114
|
+
// One declaration failing the same way in both modes is one finding.
|
|
115
|
+
const seen = new Map()
|
|
116
|
+
for (const [id, group] of byTheme) {
|
|
117
|
+
const maps = modeMaps(group, theme(id) ?? theme(defaultTheme))
|
|
118
|
+
const { findings } = checkLabelledFills({ light: resolveAll(maps.light), dark: resolveAll(maps.dark) })
|
|
119
|
+
for (const f of findings) {
|
|
120
|
+
const own = group.filter((d) => (d.name === f.fill || d.name === `${f.fill}-foreground`) && applies(d, f.mode))
|
|
121
|
+
if (!own.length) continue
|
|
122
|
+
const at = own.findLast((d) => d.name === `${f.fill}-foreground`) ?? own.at(-1)
|
|
123
|
+
const pair = `--${f.fill}-foreground on --${f.fill} is ${f.ratio.toFixed(2)}:1, APCA Lc ${Math.abs(f.lc).toFixed(0)}`
|
|
124
|
+
const fix = ` → try --${f.fill}: ${f.suggestion.fill}; --${f.fill}-foreground: ${f.suggestion.ink}`
|
|
125
|
+
const key = `${at.index}|${pair}${fix}`
|
|
126
|
+
const twin = seen.get(key)
|
|
127
|
+
if (twin) {
|
|
128
|
+
twin.match = `light and dark: ${pair}${fix}`
|
|
129
|
+
continue
|
|
130
|
+
}
|
|
131
|
+
const finding = { index: at.index, match: `${f.mode}: ${pair}${fix}` }
|
|
132
|
+
seen.set(key, finding)
|
|
133
|
+
out.push(finding)
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
return out
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** Status fills and the token a status colour drawn on a surface reads instead. */
|
|
141
|
+
const STATUS_TEXT = { destructive: "destructive-text", success: "success-text", "tone-warning": "tone-warning-text", "tone-info": "tone-info-text" }
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* The `status-text-drift` rule's reader. Since 0.6, `text-destructive`,
|
|
145
|
+
* `border-destructive`, `ring-destructive` and the rest read `--destructive-text`;
|
|
146
|
+
* only `bg-destructive` reads the fill. An app that retunes `--destructive` and
|
|
147
|
+
* stops there gets a button in its red and error text, borders and focus rings in
|
|
148
|
+
* the theme's — and nothing on screen says which is which. CSS cannot notice "the
|
|
149
|
+
* fill moved and the text did not", so the stylesheet is read for it: a status
|
|
150
|
+
* fill set, in a theme and mode, with no `-text` set beside it there.
|
|
151
|
+
*
|
|
152
|
+
* Pure: it needs the declarations only, not the built package, so it reports
|
|
153
|
+
* even where `label-contrast` cannot measure.
|
|
154
|
+
*/
|
|
155
|
+
export function statusTextDrift(css, defaultTheme = "sable") {
|
|
156
|
+
const decls = customProperties(stripComments(css))
|
|
157
|
+
const fills = decls.filter((d) => d.name in STATUS_TEXT)
|
|
158
|
+
if (!fills.length) return []
|
|
159
|
+
const themeOf = (d) => d.context.match(THEME)?.[1] ?? defaultTheme
|
|
160
|
+
const out = []
|
|
161
|
+
for (const d of fills) {
|
|
162
|
+
const text = STATUS_TEXT[d.name]
|
|
163
|
+
const missing = ["light", "dark"].filter(
|
|
164
|
+
(mode) => applies(d, mode) && !decls.some((t) => t.name === text && themeOf(t) === themeOf(d) && applies(t, mode)),
|
|
165
|
+
)
|
|
166
|
+
if (!missing.length) continue
|
|
167
|
+
const modes = missing.length === 2 ? "light and dark" : missing[0]
|
|
168
|
+
out.push({
|
|
169
|
+
index: d.index,
|
|
170
|
+
match: `--${d.name} is set without --${text} (${modes}): text-${d.name}, borders and rings keep the theme's colour → set --${text} too`,
|
|
171
|
+
})
|
|
172
|
+
}
|
|
173
|
+
return out
|
|
174
|
+
}
|
package/scripts/lint-rules.mjs
CHANGED
|
@@ -118,9 +118,12 @@ function classTokens(expr) {
|
|
|
118
118
|
/**
|
|
119
119
|
* Build the rule table against a token contract.
|
|
120
120
|
*
|
|
121
|
-
* @param {{ semanticTokens: Set<string>, motionTokens: Set<string
|
|
121
|
+
* @param {{ semanticTokens: Set<string>, motionTokens: Set<string>, labelContrast?: ((css: string) => { index: number, match: string }[]) | null, statusText?: ((css: string) => { index: number, match: string }[]) | null }} contract
|
|
122
|
+
* `labelContrast` and `statusText` are the stylesheet scanners from
|
|
123
|
+
* label-contrast.mjs. They are passed in so this table stays dependency free;
|
|
124
|
+
* without one its rule is listed and reports nothing.
|
|
122
125
|
*/
|
|
123
|
-
export function makeRules({ semanticTokens, motionTokens }) {
|
|
126
|
+
export function makeRules({ semanticTokens, motionTokens, labelContrast = null, statusText = null }) {
|
|
124
127
|
// Easing utility names = the theme's motion-ease-* tokens + Tailwind built-ins.
|
|
125
128
|
const easeNames = new Set([
|
|
126
129
|
...[...motionTokens]
|
|
@@ -525,6 +528,40 @@ export function makeRules({ semanticTokens, motionTokens }) {
|
|
|
525
528
|
return out
|
|
526
529
|
},
|
|
527
530
|
},
|
|
531
|
+
{
|
|
532
|
+
id: "label-contrast",
|
|
533
|
+
/* CONSUMER-scoped. An app retunes `--primary` and keeps the theme's
|
|
534
|
+
* label — and a red lifted for dark mode lands where dark ink passes
|
|
535
|
+
* the ratio and reads muddy, and white fails it. Sable's themes are
|
|
536
|
+
* held to this in themes.test.ts; an app is told and offered the fix,
|
|
537
|
+
* and keeps its own choice with a reasoned disable. */
|
|
538
|
+
scope: "consumer",
|
|
539
|
+
since: "0.6.0",
|
|
540
|
+
file: true,
|
|
541
|
+
code: true,
|
|
542
|
+
why:
|
|
543
|
+
"A label on a filled role — brand (`--primary`, `--sidebar-primary`, `--highlight`) or status (`--destructive`, `--success`, `--tone-warning`, `--tone-info`), each with its `-foreground` — should clear 4.5:1 AND APCA Lc 60. A pair can pass the ratio and still read muddy (dark ink on a bright red-orange, Lc 42). The finding names the nearest pair that reads, with the fill's lightness moved and hue kept, keeping the ink its light-mode colour takes. A status colour drawn on a surface (`text-destructive`, borders, rings) reads `--<status>-text`, so moving the fill does not move the page's text. " +
|
|
544
|
+
"If the pair is your brand's deliberate choice, keep it on the record: `/* design-lint-disable-next-line label-contrast -- <reason> */` above the declaration.",
|
|
545
|
+
scan(text, ctx) {
|
|
546
|
+
return ctx?.isStylesheet && labelContrast ? labelContrast(text) : []
|
|
547
|
+
},
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
id: "status-text-drift",
|
|
551
|
+
/* CONSUMER-scoped. 0.6 split each status colour into a fill and a
|
|
552
|
+
* `-text`; an app that retunes only the fill paints its buttons in its
|
|
553
|
+
* own red and its error text, borders and rings in the theme's. Nothing
|
|
554
|
+
* on screen says which is which, so the stylesheet is read for it. */
|
|
555
|
+
scope: "consumer",
|
|
556
|
+
since: "0.6.1",
|
|
557
|
+
file: true,
|
|
558
|
+
code: true,
|
|
559
|
+
why:
|
|
560
|
+
"A status colour has two tokens: the fill (`--destructive`, `--success`, `--tone-warning`, `--tone-info`), which `bg-*` paints, and its `-text` (`--destructive-text` …), which `text-*`, `border-*`, `ring-*`, `outline-*`, `fill-*` and `stroke-*` read. Setting the fill alone leaves the text on the theme's colour, so a retuned red button sits beside the theme's red error message. Set the `-text` in the same theme and mode: the fill itself where it already reads on your surfaces, or a step of it moved away from them (lighter in dark mode) so it clears 4.5:1 on a card.",
|
|
561
|
+
scan(text, ctx) {
|
|
562
|
+
return ctx?.isStylesheet && statusText ? statusText(text) : []
|
|
563
|
+
},
|
|
564
|
+
},
|
|
528
565
|
{
|
|
529
566
|
id: "hand-derived-surface",
|
|
530
567
|
/* CONSUMER-scoped. Mixing ink into a surface by hand is what the
|
package/skills/sable/SKILL.md
CHANGED
|
@@ -168,7 +168,9 @@ gaps. A visual-only review leaves code and unobserved behavior untested. For
|
|
|
168
168
|
|
|
169
169
|
Every build includes `sable docs reviewing-a-design`, `sable doctor`,
|
|
170
170
|
`sable lint <source paths> --json`, and the project's build/type checks. Repair
|
|
171
|
-
findings instead of suppressing them to finish.
|
|
171
|
+
findings instead of suppressing them to finish. `label-contrast` is Sable's opinion
|
|
172
|
+
on a user's colour: offer its suggested pair, and when the user chose the pair
|
|
173
|
+
deliberately, keep it with a reasoned disable or preset `exceptions` entry. Inspect real desktop/mobile
|
|
172
174
|
layouts, operate the primary task and recovery path, check keyboard/touch and
|
|
173
175
|
loading/empty/error/success states, font loading, focus, and reduced motion.
|
|
174
176
|
Audit source ownership as well as lint: identify the Sable components and composed
|
package/targets/ios.json
CHANGED
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
"target": "ios",
|
|
4
4
|
"platformVersion": "27",
|
|
5
5
|
"verifiedOn": "2026-10-10",
|
|
6
|
+
"status": "beta",
|
|
7
|
+
"statusNote": "Early preview. The web components are the mature surface; the iOS adapter and these decisions are still being iterated, so expect layout rules and chrome to change between releases. Report what looks wrong rather than patching around it.",
|
|
6
8
|
"designPolicy": {
|
|
7
9
|
"principle": "Sable first. Every screen is built from Sable components in the chosen preset. The adapter supplies only the iOS system chrome Sable has no equivalent for: the app frame and status bar, the navigation bar, the tab bar and sheet presentation.",
|
|
8
10
|
"chrome": [
|
|
@@ -20,7 +22,12 @@
|
|
|
20
22
|
"all content, typography and imagery"
|
|
21
23
|
],
|
|
22
24
|
"rule": "Never import from konsta. Chrome comes from @sableui/react/ios; anything else is a Sable component. If Sable lacks something a screen needs, report it as a library gap rather than reaching for a native control.",
|
|
23
|
-
"styling": "One document: Tailwind, Sable styles.css, the preset, then @sableui/react/ios/styles.css. The chrome reads the preset; Sable content follows it as on the web. Align content to px-(--ios-inset)."
|
|
25
|
+
"styling": "One document: Tailwind, Sable styles.css, the preset, then @sableui/react/ios/styles.css. The chrome reads the preset; Sable content follows it as on the web. Align content to px-(--ios-inset).",
|
|
26
|
+
"layout": [
|
|
27
|
+
"A sheet owns what a card owns on a page: the surface, the edge padding and the actions. IosSheet provides a \"sheet\" PresentationProvider, and Sable lays its content out for it; do not restyle it by hand.",
|
|
28
|
+
"Actions: mark a footer that holds only buttons with <CardFooter actions>. In a sheet it becomes a full-width stack pinned to the bottom, the primary on top, every button at the cta height. A footer with a caption, a price or a list affordance stays unmarked.",
|
|
29
|
+
"Surface: pass framed={false} to a block in a sheet; a flat card there bleeds its padding so its content lines up with the sheet. Use background=\"opaque\" for a form at the medium detent; keep glass for short, read-only content."
|
|
30
|
+
]
|
|
24
31
|
},
|
|
25
32
|
"implementation": {
|
|
26
33
|
"package": "konsta",
|
|
@@ -446,6 +453,15 @@
|
|
|
446
453
|
],
|
|
447
454
|
"guidance": "Use the Sable component as it is, in the preset. Adapt layout and touch targets to the phone; do not swap in a native lookalike or restyle it."
|
|
448
455
|
},
|
|
456
|
+
"GradientArt": {
|
|
457
|
+
"source": "GradientArt",
|
|
458
|
+
"strategy": "preserve",
|
|
459
|
+
"importFrom": "@sableui/react",
|
|
460
|
+
"components": [
|
|
461
|
+
"GradientArt"
|
|
462
|
+
],
|
|
463
|
+
"guidance": "Use the Sable component as it is, in the preset. Adapt layout and touch targets to the phone; do not swap in a native lookalike or restyle it."
|
|
464
|
+
},
|
|
449
465
|
"InlineStatus": {
|
|
450
466
|
"source": "InlineStatus",
|
|
451
467
|
"strategy": "preserve",
|
|
@@ -814,7 +830,7 @@
|
|
|
814
830
|
"components": [
|
|
815
831
|
"IosSheet"
|
|
816
832
|
],
|
|
817
|
-
"guidance": "IosSheet presents and dismisses (detents, drag, Escape, focus). Everything inside it is Sable: Form, Field, Input, Button."
|
|
833
|
+
"guidance": "IosSheet presents and dismisses (detents, drag, Escape, focus). Everything inside it is Sable: Form, Field, Input, Button. The sheet owns the surface, edge padding and actions: put a block in with framed={false}, and a form at the medium detent with background=\"opaque\"."
|
|
818
834
|
},
|
|
819
835
|
"ShowMore": {
|
|
820
836
|
"source": "ShowMore",
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|