@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.js
CHANGED
|
@@ -33,6 +33,7 @@ __export(src_exports2, {
|
|
|
33
33
|
PreviewBanner: () => PreviewBanner,
|
|
34
34
|
SorbProvider: () => SorbProvider,
|
|
35
35
|
ThemeToggle: () => ThemeToggle,
|
|
36
|
+
angularMaterialTarget: () => angularMaterialTarget,
|
|
36
37
|
applyLegacyMap: () => applyLegacyMap,
|
|
37
38
|
buildModeStylesheet: () => buildModeStylesheet,
|
|
38
39
|
clearLegacyMap: () => clearLegacyMap,
|
|
@@ -41,12 +42,17 @@ __export(src_exports2, {
|
|
|
41
42
|
dataThemeDarkMode: () => dataThemeDarkMode,
|
|
42
43
|
indexLegacyMap: () => indexLegacyMap,
|
|
43
44
|
injectModeStylesheet: () => injectModeStylesheet,
|
|
45
|
+
mantineTarget: () => mantineTarget,
|
|
46
|
+
muiTarget: () => muiTarget,
|
|
44
47
|
normalizeProp: () => normalizeProp,
|
|
45
48
|
normalizeValue: () => normalizeValue,
|
|
49
|
+
primevueTarget: () => primevueTarget,
|
|
46
50
|
reactBootstrapTarget: () => reactBootstrapTarget,
|
|
47
51
|
sanitizeCssValue: () => sanitizeCssValue,
|
|
52
|
+
shadcnTarget: () => shadcnTarget,
|
|
48
53
|
sorbInit: () => sorbInit,
|
|
49
54
|
tailwindDarkMode: () => tailwindDarkMode,
|
|
55
|
+
tailwindV4Target: () => tailwindV4Target,
|
|
50
56
|
useIsPreview: () => useIsPreview,
|
|
51
57
|
usePreviewState: () => usePreviewState,
|
|
52
58
|
useTheme: () => useTheme,
|
|
@@ -223,12 +229,70 @@ var indent = (lines, level = 1) => {
|
|
|
223
229
|
// node_modules/@sorb/core/src/index.js
|
|
224
230
|
var TIERS = Object.freeze(["component", "semantic", "primitive"]);
|
|
225
231
|
var TIER_RANK = Object.freeze({ component: 0, semantic: 1, primitive: 2 });
|
|
232
|
+
var DEFAULT_ROLE_IDS = Object.freeze({
|
|
233
|
+
color: Object.freeze([
|
|
234
|
+
"color.surface",
|
|
235
|
+
"color.surface-raised",
|
|
236
|
+
"color.surface-sunken",
|
|
237
|
+
"color.ink",
|
|
238
|
+
"color.ink-muted",
|
|
239
|
+
"color.ink-on-brand",
|
|
240
|
+
"color.brand",
|
|
241
|
+
"color.brand-hover",
|
|
242
|
+
"color.brand-contrast",
|
|
243
|
+
"color.accent",
|
|
244
|
+
"color.accent-hover",
|
|
245
|
+
"color.accent-contrast",
|
|
246
|
+
"color.danger",
|
|
247
|
+
"color.danger-hover",
|
|
248
|
+
"color.success",
|
|
249
|
+
"color.success-hover",
|
|
250
|
+
"color.focus-ring",
|
|
251
|
+
"color.border",
|
|
252
|
+
"color.border-subtle",
|
|
253
|
+
"color.border-strong"
|
|
254
|
+
]),
|
|
255
|
+
radius: Object.freeze(["radius.control", "radius.card", "radius.pill"]),
|
|
256
|
+
shadow: Object.freeze(["shadow.raised", "shadow.overlay"]),
|
|
257
|
+
typography: Object.freeze([
|
|
258
|
+
"typography.display.fontSize",
|
|
259
|
+
"typography.display.fontWeight",
|
|
260
|
+
"typography.display.lineHeight",
|
|
261
|
+
"typography.heading.fontSize",
|
|
262
|
+
"typography.heading.fontWeight",
|
|
263
|
+
"typography.heading.lineHeight",
|
|
264
|
+
"typography.body.fontSize",
|
|
265
|
+
"typography.body.fontWeight",
|
|
266
|
+
"typography.body.lineHeight",
|
|
267
|
+
"typography.caption.fontSize",
|
|
268
|
+
"typography.caption.fontWeight",
|
|
269
|
+
"typography.caption.lineHeight"
|
|
270
|
+
])
|
|
271
|
+
});
|
|
272
|
+
var ALL_ROLE_IDS = Object.freeze([
|
|
273
|
+
...DEFAULT_ROLE_IDS.color,
|
|
274
|
+
...DEFAULT_ROLE_IDS.radius,
|
|
275
|
+
...DEFAULT_ROLE_IDS.shadow,
|
|
276
|
+
...DEFAULT_ROLE_IDS.typography
|
|
277
|
+
]);
|
|
226
278
|
var connectors = Object.freeze({
|
|
227
279
|
source: /* @__PURE__ */ new Map(),
|
|
228
280
|
codeSource: /* @__PURE__ */ new Map(),
|
|
229
281
|
target: /* @__PURE__ */ new Map()
|
|
230
282
|
});
|
|
231
283
|
function registerTarget(adapter) {
|
|
284
|
+
if (!adapter || typeof adapter.id !== "string" || !adapter.id) {
|
|
285
|
+
throw new Error("registerTarget: adapter.id must be a non-empty string");
|
|
286
|
+
}
|
|
287
|
+
if (typeof adapter.emitFormat !== "string" || !adapter.emitFormat) {
|
|
288
|
+
throw new Error(`registerTarget(${JSON.stringify(adapter.id)}): emitFormat must be a non-empty string`);
|
|
289
|
+
}
|
|
290
|
+
if (!Array.isArray(adapter.expectPrefixes)) {
|
|
291
|
+
throw new Error(`registerTarget(${JSON.stringify(adapter.id)}): expectPrefixes must be an array`);
|
|
292
|
+
}
|
|
293
|
+
if (connectors.target.has(adapter.id)) {
|
|
294
|
+
console.warn(`registerTarget: overwriting existing target adapter ${JSON.stringify(adapter.id)}`);
|
|
295
|
+
}
|
|
232
296
|
connectors.target.set(adapter.id, adapter);
|
|
233
297
|
return adapter;
|
|
234
298
|
}
|
|
@@ -1099,4 +1163,165 @@ var dataThemeDarkMode = {
|
|
|
1099
1163
|
darkSelector: '[data-theme="dark"]',
|
|
1100
1164
|
lightSelector: '[data-theme="light"]'
|
|
1101
1165
|
};
|
|
1166
|
+
|
|
1167
|
+
// src/targets/mantine.js
|
|
1168
|
+
var SORB_MANTINE_VARS_FORMAT_ID = "sorb/mantine-vars";
|
|
1169
|
+
var mantineTarget = {
|
|
1170
|
+
id: "mantine",
|
|
1171
|
+
emitFormat: SORB_MANTINE_VARS_FORMAT_ID,
|
|
1172
|
+
// Kit-vocab expectPrefixes (field-correction, non-negotiable): the
|
|
1173
|
+
// payload-side kit namespace, NEVER the framework's own `mantine-`
|
|
1174
|
+
// var prefix — a framework-prefix guard false-positives on every working
|
|
1175
|
+
// preview (verified P2/P3 across the demo program). Overridable via
|
|
1176
|
+
// `config.preview.expectPrefixes`.
|
|
1177
|
+
expectPrefixes: ["color-", "button-", "radius-"],
|
|
1178
|
+
// Left undefined on purpose — see file header.
|
|
1179
|
+
inject: void 0,
|
|
1180
|
+
// CONVENTION-DECLARED, NOT demo-verified — the Mantine JJ demo never built
|
|
1181
|
+
// dark mode (acid-wash is a variant push, not a mode). Mantine v7's
|
|
1182
|
+
// documented color-scheme convention sets a `data-mantine-color-scheme`
|
|
1183
|
+
// attribute (MantineProvider manages it; `useMantineColorScheme` /
|
|
1184
|
+
// `<ColorSchemeScript>` toggle it). Feeds the real-dark-mode program's D1
|
|
1185
|
+
// phase; verification lands there, not here.
|
|
1186
|
+
darkMode: {
|
|
1187
|
+
strategy: "attribute",
|
|
1188
|
+
attribute: "data-mantine-color-scheme",
|
|
1189
|
+
darkSelector: '[data-mantine-color-scheme="dark"]',
|
|
1190
|
+
lightSelector: '[data-mantine-color-scheme="light"]'
|
|
1191
|
+
}
|
|
1192
|
+
};
|
|
1193
|
+
if (typeof registerTarget === "function") {
|
|
1194
|
+
registerTarget(mantineTarget);
|
|
1195
|
+
}
|
|
1196
|
+
|
|
1197
|
+
// src/targets/tailwindV4.js
|
|
1198
|
+
var SORB_TAILWIND_FORMAT_ID = "sorb/tailwind-theme";
|
|
1199
|
+
var tailwindV4Target = {
|
|
1200
|
+
id: "tailwind-v4",
|
|
1201
|
+
emitFormat: SORB_TAILWIND_FORMAT_ID,
|
|
1202
|
+
// Payload-side KIT vocabulary (framework-targets-productization field-
|
|
1203
|
+
// correction), never a framework var prefix — a plain Sorb kit's own
|
|
1204
|
+
// token-family prefixes, matching what `@theme inline` references.
|
|
1205
|
+
expectPrefixes: ["color-", "radius-", "space-", "font-"],
|
|
1206
|
+
// Left undefined on purpose — see file header.
|
|
1207
|
+
inject: void 0,
|
|
1208
|
+
// CONVENTION-DECLARED, not demo-verified (the JJ demos never built dark
|
|
1209
|
+
// mode): Tailwind's documented `darkMode: 'class'` convention — a `.dark`
|
|
1210
|
+
// class toggled on `documentElement`. Feeds the real-dark-mode program's D1
|
|
1211
|
+
// phase; verification lands there.
|
|
1212
|
+
darkMode: tailwindDarkMode
|
|
1213
|
+
};
|
|
1214
|
+
if (typeof registerTarget === "function") {
|
|
1215
|
+
registerTarget(tailwindV4Target);
|
|
1216
|
+
}
|
|
1217
|
+
|
|
1218
|
+
// src/targets/shadcn.js
|
|
1219
|
+
var SORB_SHADCN_FORMAT_ID = "sorb/shadcn-theme";
|
|
1220
|
+
var shadcnTarget = {
|
|
1221
|
+
id: "shadcn",
|
|
1222
|
+
emitFormat: SORB_SHADCN_FORMAT_ID,
|
|
1223
|
+
// Payload-side KIT vocabulary (framework-targets-productization field-
|
|
1224
|
+
// correction), never a framework/shadcn var prefix — shadcn's own vars
|
|
1225
|
+
// (`--background`, `--primary`, …) are the OUTPUT of this format, not the
|
|
1226
|
+
// guarded payload; the guard is against the underlying Sorb kit vocab the
|
|
1227
|
+
// format's :root map references.
|
|
1228
|
+
expectPrefixes: ["color-", "radius-", "space-", "font-"],
|
|
1229
|
+
// Left undefined on purpose — see file header.
|
|
1230
|
+
inject: void 0,
|
|
1231
|
+
// CONVENTION-DECLARED, not demo-verified (the JJ demos never built dark
|
|
1232
|
+
// mode): shadcn ships on top of Tailwind's `darkMode: 'class'` convention
|
|
1233
|
+
// (a `.dark` class toggled on `documentElement`, per shadcn/ui's own
|
|
1234
|
+
// docs). Feeds the real-dark-mode program's D1 phase; verification lands
|
|
1235
|
+
// there.
|
|
1236
|
+
darkMode: tailwindDarkMode
|
|
1237
|
+
};
|
|
1238
|
+
if (typeof registerTarget === "function") {
|
|
1239
|
+
registerTarget(shadcnTarget);
|
|
1240
|
+
}
|
|
1241
|
+
|
|
1242
|
+
// src/targets/primevue.js
|
|
1243
|
+
var SORB_PRIMEVUE_PRESET_FORMAT_ID = "sorb/primevue-preset";
|
|
1244
|
+
var primevueTarget = {
|
|
1245
|
+
id: "primevue",
|
|
1246
|
+
emitFormat: SORB_PRIMEVUE_PRESET_FORMAT_ID,
|
|
1247
|
+
// Kit-vocab expectPrefixes (field-correction, non-negotiable): the
|
|
1248
|
+
// payload-side kit namespace, NEVER a PrimeVue-owned prefix (`p-`) — a
|
|
1249
|
+
// framework-prefix guard false-positives on every working preview
|
|
1250
|
+
// (verified P2/P3 across the demo program). This target's preset draws
|
|
1251
|
+
// from a wider slice of the kit vocab than Mantine/MUI (component-tier
|
|
1252
|
+
// overrides for Tag/Toast/Menubar), hence the longer list. Overridable via
|
|
1253
|
+
// `config.preview.expectPrefixes`.
|
|
1254
|
+
expectPrefixes: ["color-", "button-", "card-", "badge-", "input-", "nav-", "toast-", "radius-"],
|
|
1255
|
+
// Left undefined on purpose — see file header.
|
|
1256
|
+
inject: void 0,
|
|
1257
|
+
// CONVENTION-DECLARED, NOT demo-verified — the PrimeVue JJ demo never
|
|
1258
|
+
// built dark mode (acid-wash is a variant push, not a mode). PrimeVue v4's
|
|
1259
|
+
// documented dark-mode convention is a `.p-dark` selector class (default
|
|
1260
|
+
// `darkModeSelector` in `definePreset`/PrimeVue config), toggled on an
|
|
1261
|
+
// ancestor (typically `<html>`). Feeds the real-dark-mode program's D1
|
|
1262
|
+
// phase; verification lands there, not here.
|
|
1263
|
+
darkMode: {
|
|
1264
|
+
strategy: "class",
|
|
1265
|
+
darkSelector: ".p-dark"
|
|
1266
|
+
}
|
|
1267
|
+
};
|
|
1268
|
+
if (typeof registerTarget === "function") {
|
|
1269
|
+
registerTarget(primevueTarget);
|
|
1270
|
+
}
|
|
1271
|
+
|
|
1272
|
+
// src/targets/mui.js
|
|
1273
|
+
var SORB_MUI_VARS_FORMAT_ID = "sorb/mui-vars";
|
|
1274
|
+
var muiTarget = {
|
|
1275
|
+
id: "mui",
|
|
1276
|
+
emitFormat: SORB_MUI_VARS_FORMAT_ID,
|
|
1277
|
+
// Kit-vocab expectPrefixes (field-correction, non-negotiable): the
|
|
1278
|
+
// payload-side kit namespace, NEVER the framework's own `mui-` var
|
|
1279
|
+
// prefix — a framework-prefix guard false-positives on every working
|
|
1280
|
+
// preview (verified P2/P3 across the demo program). Overridable via
|
|
1281
|
+
// `config.preview.expectPrefixes`.
|
|
1282
|
+
expectPrefixes: ["color-", "radius-"],
|
|
1283
|
+
// Left undefined on purpose — see file header.
|
|
1284
|
+
inject: void 0,
|
|
1285
|
+
// CONVENTION-DECLARED, NOT demo-verified — the MUI JJ demo never built
|
|
1286
|
+
// dark mode (acid-wash is a variant push, not a mode). MUI v6's documented
|
|
1287
|
+
// `cssVariables: { colorSchemeSelector: 'data' }` convention sets a
|
|
1288
|
+
// `data-mui-color-scheme` attribute (`InitColorSchemeScript` / MUI's
|
|
1289
|
+
// `ThemeProvider` manage it). Feeds the real-dark-mode program's D1 phase;
|
|
1290
|
+
// verification lands there, not here.
|
|
1291
|
+
darkMode: {
|
|
1292
|
+
strategy: "attribute",
|
|
1293
|
+
attribute: "data-mui-color-scheme",
|
|
1294
|
+
darkSelector: '[data-mui-color-scheme="dark"]',
|
|
1295
|
+
lightSelector: '[data-mui-color-scheme="light"]'
|
|
1296
|
+
}
|
|
1297
|
+
};
|
|
1298
|
+
if (typeof registerTarget === "function") {
|
|
1299
|
+
registerTarget(muiTarget);
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
// src/targets/angularMaterial.js
|
|
1303
|
+
var SORB_MAT_SYS_VARS_FORMAT_ID = "sorb/mat-sys-vars";
|
|
1304
|
+
var angularMaterialTarget = {
|
|
1305
|
+
id: "angular-material",
|
|
1306
|
+
emitFormat: SORB_MAT_SYS_VARS_FORMAT_ID,
|
|
1307
|
+
// Kit-vocab expectPrefixes (field-correction, non-negotiable): the
|
|
1308
|
+
// payload-side kit namespace, NEVER Angular Material's own `mat-sys-`
|
|
1309
|
+
// var prefix — a framework-prefix guard false-positives on every working
|
|
1310
|
+
// preview (verified P2/P3 across the demo program). Overridable via
|
|
1311
|
+
// `config.preview.expectPrefixes`.
|
|
1312
|
+
expectPrefixes: ["color-", "radius-"],
|
|
1313
|
+
// Left undefined on purpose — see file header. Non-React (Angular) target;
|
|
1314
|
+
// the leaf-core inject seam stays deferred.
|
|
1315
|
+
inject: void 0,
|
|
1316
|
+
// CONVENTION-DECLARED + UNCONFIRMED — see file header "DARK MODE" section.
|
|
1317
|
+
// Best-known default given Angular Material 20's `light-dark()`/
|
|
1318
|
+
// `color-scheme` mechanism has no single canonical selector name.
|
|
1319
|
+
darkMode: {
|
|
1320
|
+
strategy: "class",
|
|
1321
|
+
darkSelector: ".dark"
|
|
1322
|
+
}
|
|
1323
|
+
};
|
|
1324
|
+
if (typeof registerTarget === "function") {
|
|
1325
|
+
registerTarget(angularMaterialTarget);
|
|
1326
|
+
}
|
|
1102
1327
|
//# sourceMappingURL=index.js.map
|