@sorb/leaf 0.3.0 → 0.4.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.
- package/dist/core.js +58 -0
- package/dist/core.js.map +2 -2
- package/dist/core.mjs +58 -0
- package/dist/core.mjs.map +2 -2
- package/dist/index.js +225 -0
- package/dist/index.js.map +3 -3
- package/dist/index.mjs +225 -0
- package/dist/index.mjs.map +3 -3
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -165,12 +165,70 @@ var indent = (lines, level = 1) => {
|
|
|
165
165
|
// node_modules/@sorb/core/src/index.js
|
|
166
166
|
var TIERS = Object.freeze(["component", "semantic", "primitive"]);
|
|
167
167
|
var TIER_RANK = Object.freeze({ component: 0, semantic: 1, primitive: 2 });
|
|
168
|
+
var DEFAULT_ROLE_IDS = Object.freeze({
|
|
169
|
+
color: Object.freeze([
|
|
170
|
+
"color.surface",
|
|
171
|
+
"color.surface-raised",
|
|
172
|
+
"color.surface-sunken",
|
|
173
|
+
"color.ink",
|
|
174
|
+
"color.ink-muted",
|
|
175
|
+
"color.ink-on-brand",
|
|
176
|
+
"color.brand",
|
|
177
|
+
"color.brand-hover",
|
|
178
|
+
"color.brand-contrast",
|
|
179
|
+
"color.accent",
|
|
180
|
+
"color.accent-hover",
|
|
181
|
+
"color.accent-contrast",
|
|
182
|
+
"color.danger",
|
|
183
|
+
"color.danger-hover",
|
|
184
|
+
"color.success",
|
|
185
|
+
"color.success-hover",
|
|
186
|
+
"color.focus-ring",
|
|
187
|
+
"color.border",
|
|
188
|
+
"color.border-subtle",
|
|
189
|
+
"color.border-strong"
|
|
190
|
+
]),
|
|
191
|
+
radius: Object.freeze(["radius.control", "radius.card", "radius.pill"]),
|
|
192
|
+
shadow: Object.freeze(["shadow.raised", "shadow.overlay"]),
|
|
193
|
+
typography: Object.freeze([
|
|
194
|
+
"typography.display.fontSize",
|
|
195
|
+
"typography.display.fontWeight",
|
|
196
|
+
"typography.display.lineHeight",
|
|
197
|
+
"typography.heading.fontSize",
|
|
198
|
+
"typography.heading.fontWeight",
|
|
199
|
+
"typography.heading.lineHeight",
|
|
200
|
+
"typography.body.fontSize",
|
|
201
|
+
"typography.body.fontWeight",
|
|
202
|
+
"typography.body.lineHeight",
|
|
203
|
+
"typography.caption.fontSize",
|
|
204
|
+
"typography.caption.fontWeight",
|
|
205
|
+
"typography.caption.lineHeight"
|
|
206
|
+
])
|
|
207
|
+
});
|
|
208
|
+
var ALL_ROLE_IDS = Object.freeze([
|
|
209
|
+
...DEFAULT_ROLE_IDS.color,
|
|
210
|
+
...DEFAULT_ROLE_IDS.radius,
|
|
211
|
+
...DEFAULT_ROLE_IDS.shadow,
|
|
212
|
+
...DEFAULT_ROLE_IDS.typography
|
|
213
|
+
]);
|
|
168
214
|
var connectors = Object.freeze({
|
|
169
215
|
source: /* @__PURE__ */ new Map(),
|
|
170
216
|
codeSource: /* @__PURE__ */ new Map(),
|
|
171
217
|
target: /* @__PURE__ */ new Map()
|
|
172
218
|
});
|
|
173
219
|
function registerTarget(adapter) {
|
|
220
|
+
if (!adapter || typeof adapter.id !== "string" || !adapter.id) {
|
|
221
|
+
throw new Error("registerTarget: adapter.id must be a non-empty string");
|
|
222
|
+
}
|
|
223
|
+
if (typeof adapter.emitFormat !== "string" || !adapter.emitFormat) {
|
|
224
|
+
throw new Error(`registerTarget(${JSON.stringify(adapter.id)}): emitFormat must be a non-empty string`);
|
|
225
|
+
}
|
|
226
|
+
if (!Array.isArray(adapter.expectPrefixes)) {
|
|
227
|
+
throw new Error(`registerTarget(${JSON.stringify(adapter.id)}): expectPrefixes must be an array`);
|
|
228
|
+
}
|
|
229
|
+
if (connectors.target.has(adapter.id)) {
|
|
230
|
+
console.warn(`registerTarget: overwriting existing target adapter ${JSON.stringify(adapter.id)}`);
|
|
231
|
+
}
|
|
174
232
|
connectors.target.set(adapter.id, adapter);
|
|
175
233
|
return adapter;
|
|
176
234
|
}
|
|
@@ -1041,11 +1099,173 @@ var dataThemeDarkMode = {
|
|
|
1041
1099
|
darkSelector: '[data-theme="dark"]',
|
|
1042
1100
|
lightSelector: '[data-theme="light"]'
|
|
1043
1101
|
};
|
|
1102
|
+
|
|
1103
|
+
// src/targets/mantine.js
|
|
1104
|
+
var SORB_MANTINE_VARS_FORMAT_ID = "sorb/mantine-vars";
|
|
1105
|
+
var mantineTarget = {
|
|
1106
|
+
id: "mantine",
|
|
1107
|
+
emitFormat: SORB_MANTINE_VARS_FORMAT_ID,
|
|
1108
|
+
// Kit-vocab expectPrefixes (field-correction, non-negotiable): the
|
|
1109
|
+
// payload-side kit namespace, NEVER the framework's own `mantine-`
|
|
1110
|
+
// var prefix — a framework-prefix guard false-positives on every working
|
|
1111
|
+
// preview (verified P2/P3 across the demo program). Overridable via
|
|
1112
|
+
// `config.preview.expectPrefixes`.
|
|
1113
|
+
expectPrefixes: ["color-", "button-", "radius-"],
|
|
1114
|
+
// Left undefined on purpose — see file header.
|
|
1115
|
+
inject: void 0,
|
|
1116
|
+
// CONVENTION-DECLARED, NOT demo-verified — the Mantine JJ demo never built
|
|
1117
|
+
// dark mode (acid-wash is a variant push, not a mode). Mantine v7's
|
|
1118
|
+
// documented color-scheme convention sets a `data-mantine-color-scheme`
|
|
1119
|
+
// attribute (MantineProvider manages it; `useMantineColorScheme` /
|
|
1120
|
+
// `<ColorSchemeScript>` toggle it). Feeds the real-dark-mode program's D1
|
|
1121
|
+
// phase; verification lands there, not here.
|
|
1122
|
+
darkMode: {
|
|
1123
|
+
strategy: "attribute",
|
|
1124
|
+
attribute: "data-mantine-color-scheme",
|
|
1125
|
+
darkSelector: '[data-mantine-color-scheme="dark"]',
|
|
1126
|
+
lightSelector: '[data-mantine-color-scheme="light"]'
|
|
1127
|
+
}
|
|
1128
|
+
};
|
|
1129
|
+
if (typeof registerTarget === "function") {
|
|
1130
|
+
registerTarget(mantineTarget);
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
// src/targets/tailwindV4.js
|
|
1134
|
+
var SORB_TAILWIND_FORMAT_ID = "sorb/tailwind-theme";
|
|
1135
|
+
var tailwindV4Target = {
|
|
1136
|
+
id: "tailwind-v4",
|
|
1137
|
+
emitFormat: SORB_TAILWIND_FORMAT_ID,
|
|
1138
|
+
// Payload-side KIT vocabulary (framework-targets-productization field-
|
|
1139
|
+
// correction), never a framework var prefix — a plain Sorb kit's own
|
|
1140
|
+
// token-family prefixes, matching what `@theme inline` references.
|
|
1141
|
+
expectPrefixes: ["color-", "radius-", "space-", "font-"],
|
|
1142
|
+
// Left undefined on purpose — see file header.
|
|
1143
|
+
inject: void 0,
|
|
1144
|
+
// CONVENTION-DECLARED, not demo-verified (the JJ demos never built dark
|
|
1145
|
+
// mode): Tailwind's documented `darkMode: 'class'` convention — a `.dark`
|
|
1146
|
+
// class toggled on `documentElement`. Feeds the real-dark-mode program's D1
|
|
1147
|
+
// phase; verification lands there.
|
|
1148
|
+
darkMode: tailwindDarkMode
|
|
1149
|
+
};
|
|
1150
|
+
if (typeof registerTarget === "function") {
|
|
1151
|
+
registerTarget(tailwindV4Target);
|
|
1152
|
+
}
|
|
1153
|
+
|
|
1154
|
+
// src/targets/shadcn.js
|
|
1155
|
+
var SORB_SHADCN_FORMAT_ID = "sorb/shadcn-theme";
|
|
1156
|
+
var shadcnTarget = {
|
|
1157
|
+
id: "shadcn",
|
|
1158
|
+
emitFormat: SORB_SHADCN_FORMAT_ID,
|
|
1159
|
+
// Payload-side KIT vocabulary (framework-targets-productization field-
|
|
1160
|
+
// correction), never a framework/shadcn var prefix — shadcn's own vars
|
|
1161
|
+
// (`--background`, `--primary`, …) are the OUTPUT of this format, not the
|
|
1162
|
+
// guarded payload; the guard is against the underlying Sorb kit vocab the
|
|
1163
|
+
// format's :root map references.
|
|
1164
|
+
expectPrefixes: ["color-", "radius-", "space-", "font-"],
|
|
1165
|
+
// Left undefined on purpose — see file header.
|
|
1166
|
+
inject: void 0,
|
|
1167
|
+
// CONVENTION-DECLARED, not demo-verified (the JJ demos never built dark
|
|
1168
|
+
// mode): shadcn ships on top of Tailwind's `darkMode: 'class'` convention
|
|
1169
|
+
// (a `.dark` class toggled on `documentElement`, per shadcn/ui's own
|
|
1170
|
+
// docs). Feeds the real-dark-mode program's D1 phase; verification lands
|
|
1171
|
+
// there.
|
|
1172
|
+
darkMode: tailwindDarkMode
|
|
1173
|
+
};
|
|
1174
|
+
if (typeof registerTarget === "function") {
|
|
1175
|
+
registerTarget(shadcnTarget);
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1178
|
+
// src/targets/primevue.js
|
|
1179
|
+
var SORB_PRIMEVUE_PRESET_FORMAT_ID = "sorb/primevue-preset";
|
|
1180
|
+
var primevueTarget = {
|
|
1181
|
+
id: "primevue",
|
|
1182
|
+
emitFormat: SORB_PRIMEVUE_PRESET_FORMAT_ID,
|
|
1183
|
+
// Kit-vocab expectPrefixes (field-correction, non-negotiable): the
|
|
1184
|
+
// payload-side kit namespace, NEVER a PrimeVue-owned prefix (`p-`) — a
|
|
1185
|
+
// framework-prefix guard false-positives on every working preview
|
|
1186
|
+
// (verified P2/P3 across the demo program). This target's preset draws
|
|
1187
|
+
// from a wider slice of the kit vocab than Mantine/MUI (component-tier
|
|
1188
|
+
// overrides for Tag/Toast/Menubar), hence the longer list. Overridable via
|
|
1189
|
+
// `config.preview.expectPrefixes`.
|
|
1190
|
+
expectPrefixes: ["color-", "button-", "card-", "badge-", "input-", "nav-", "toast-", "radius-"],
|
|
1191
|
+
// Left undefined on purpose — see file header.
|
|
1192
|
+
inject: void 0,
|
|
1193
|
+
// CONVENTION-DECLARED, NOT demo-verified — the PrimeVue JJ demo never
|
|
1194
|
+
// built dark mode (acid-wash is a variant push, not a mode). PrimeVue v4's
|
|
1195
|
+
// documented dark-mode convention is a `.p-dark` selector class (default
|
|
1196
|
+
// `darkModeSelector` in `definePreset`/PrimeVue config), toggled on an
|
|
1197
|
+
// ancestor (typically `<html>`). Feeds the real-dark-mode program's D1
|
|
1198
|
+
// phase; verification lands there, not here.
|
|
1199
|
+
darkMode: {
|
|
1200
|
+
strategy: "class",
|
|
1201
|
+
darkSelector: ".p-dark"
|
|
1202
|
+
}
|
|
1203
|
+
};
|
|
1204
|
+
if (typeof registerTarget === "function") {
|
|
1205
|
+
registerTarget(primevueTarget);
|
|
1206
|
+
}
|
|
1207
|
+
|
|
1208
|
+
// src/targets/mui.js
|
|
1209
|
+
var SORB_MUI_VARS_FORMAT_ID = "sorb/mui-vars";
|
|
1210
|
+
var muiTarget = {
|
|
1211
|
+
id: "mui",
|
|
1212
|
+
emitFormat: SORB_MUI_VARS_FORMAT_ID,
|
|
1213
|
+
// Kit-vocab expectPrefixes (field-correction, non-negotiable): the
|
|
1214
|
+
// payload-side kit namespace, NEVER the framework's own `mui-` var
|
|
1215
|
+
// prefix — a framework-prefix guard false-positives on every working
|
|
1216
|
+
// preview (verified P2/P3 across the demo program). Overridable via
|
|
1217
|
+
// `config.preview.expectPrefixes`.
|
|
1218
|
+
expectPrefixes: ["color-", "radius-"],
|
|
1219
|
+
// Left undefined on purpose — see file header.
|
|
1220
|
+
inject: void 0,
|
|
1221
|
+
// CONVENTION-DECLARED, NOT demo-verified — the MUI JJ demo never built
|
|
1222
|
+
// dark mode (acid-wash is a variant push, not a mode). MUI v6's documented
|
|
1223
|
+
// `cssVariables: { colorSchemeSelector: 'data' }` convention sets a
|
|
1224
|
+
// `data-mui-color-scheme` attribute (`InitColorSchemeScript` / MUI's
|
|
1225
|
+
// `ThemeProvider` manage it). Feeds the real-dark-mode program's D1 phase;
|
|
1226
|
+
// verification lands there, not here.
|
|
1227
|
+
darkMode: {
|
|
1228
|
+
strategy: "attribute",
|
|
1229
|
+
attribute: "data-mui-color-scheme",
|
|
1230
|
+
darkSelector: '[data-mui-color-scheme="dark"]',
|
|
1231
|
+
lightSelector: '[data-mui-color-scheme="light"]'
|
|
1232
|
+
}
|
|
1233
|
+
};
|
|
1234
|
+
if (typeof registerTarget === "function") {
|
|
1235
|
+
registerTarget(muiTarget);
|
|
1236
|
+
}
|
|
1237
|
+
|
|
1238
|
+
// src/targets/angularMaterial.js
|
|
1239
|
+
var SORB_MAT_SYS_VARS_FORMAT_ID = "sorb/mat-sys-vars";
|
|
1240
|
+
var angularMaterialTarget = {
|
|
1241
|
+
id: "angular-material",
|
|
1242
|
+
emitFormat: SORB_MAT_SYS_VARS_FORMAT_ID,
|
|
1243
|
+
// Kit-vocab expectPrefixes (field-correction, non-negotiable): the
|
|
1244
|
+
// payload-side kit namespace, NEVER Angular Material's own `mat-sys-`
|
|
1245
|
+
// var prefix — a framework-prefix guard false-positives on every working
|
|
1246
|
+
// preview (verified P2/P3 across the demo program). Overridable via
|
|
1247
|
+
// `config.preview.expectPrefixes`.
|
|
1248
|
+
expectPrefixes: ["color-", "radius-"],
|
|
1249
|
+
// Left undefined on purpose — see file header. Non-React (Angular) target;
|
|
1250
|
+
// the leaf-core inject seam stays deferred.
|
|
1251
|
+
inject: void 0,
|
|
1252
|
+
// CONVENTION-DECLARED + UNCONFIRMED — see file header "DARK MODE" section.
|
|
1253
|
+
// Best-known default given Angular Material 20's `light-dark()`/
|
|
1254
|
+
// `color-scheme` mechanism has no single canonical selector name.
|
|
1255
|
+
darkMode: {
|
|
1256
|
+
strategy: "class",
|
|
1257
|
+
darkSelector: ".dark"
|
|
1258
|
+
}
|
|
1259
|
+
};
|
|
1260
|
+
if (typeof registerTarget === "function") {
|
|
1261
|
+
registerTarget(angularMaterialTarget);
|
|
1262
|
+
}
|
|
1044
1263
|
export {
|
|
1045
1264
|
MODE_STYLESHEET_ID,
|
|
1046
1265
|
PreviewBanner,
|
|
1047
1266
|
SorbProvider,
|
|
1048
1267
|
ThemeToggle,
|
|
1268
|
+
angularMaterialTarget,
|
|
1049
1269
|
applyLegacyMap,
|
|
1050
1270
|
buildModeStylesheet,
|
|
1051
1271
|
clearLegacyMap,
|
|
@@ -1054,12 +1274,17 @@ export {
|
|
|
1054
1274
|
dataThemeDarkMode,
|
|
1055
1275
|
indexLegacyMap,
|
|
1056
1276
|
injectModeStylesheet,
|
|
1277
|
+
mantineTarget,
|
|
1278
|
+
muiTarget,
|
|
1057
1279
|
normalizeProp,
|
|
1058
1280
|
normalizeValue,
|
|
1281
|
+
primevueTarget,
|
|
1059
1282
|
reactBootstrapTarget,
|
|
1060
1283
|
sanitizeCssValue,
|
|
1284
|
+
shadcnTarget,
|
|
1061
1285
|
sorbInit,
|
|
1062
1286
|
tailwindDarkMode,
|
|
1287
|
+
tailwindV4Target,
|
|
1063
1288
|
useIsPreview,
|
|
1064
1289
|
usePreviewState,
|
|
1065
1290
|
useTheme,
|