mlola-ui 1.1.0 → 1.1.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/package.json +1 -1
- package/registry/agents.json +1 -1
- package/registry/agents.md +4 -1
- package/registry/contract.json +5 -0
- package/registry/index.json +45 -45
- package/src/cli.js +25 -6
- package/src/pro.js +25 -5
package/package.json
CHANGED
package/registry/agents.json
CHANGED
package/registry/agents.md
CHANGED
|
@@ -42,7 +42,8 @@ Set `data-theme` and `data-mode` on any ancestor. Nothing else changes.
|
|
|
42
42
|
| `aerogel` | Aerogel Glass |
|
|
43
43
|
| `nordic` | Nordic Earth |
|
|
44
44
|
|
|
45
|
-
`data-mode` is `light` or `
|
|
45
|
+
`data-mode` is `light`, `dark`, or `system`, which follows the reader's own setting.
|
|
46
|
+
The themes' type reads `--font-inter`, `--font-newsreader` and `--font-jetbrains` before its fallbacks: load those fonts (next/font's `variable` option, or @font-face) and set the variables on the root, or the page uses the system's fonts.
|
|
46
47
|
|
|
47
48
|
A project defines its own theme in one file, `mlola.theme.json`, which
|
|
48
49
|
overrides fonts, colors, geometry, the spacing and type scale, and any
|
|
@@ -129,6 +130,7 @@ component, so a page built from them themes with the rest.
|
|
|
129
130
|
|
|
130
131
|
`.ml-actions` `.ml-brand` `.ml-brand-mark` `.ml-brand-name` `.ml-chart` `.ml-chart-bar` `.ml-chart-bars` `.ml-chart-heading` `.ml-check-list` `.ml-cluster` `.ml-definition-list` `.ml-display` `.ml-divider` `.ml-empty-state` `.ml-eyebrow` `.ml-filter-chip` `.ml-filter-group` `.ml-fine-print` `.ml-form` `.ml-form-message` `.ml-form-options` `.ml-grid` `.ml-heading` `.ml-icon-chip` `.ml-inline-form` `.ml-inline-form-field` `.ml-label` `.ml-lede` `.ml-link` `.ml-page-shell` `.ml-person` `.ml-person-copy` `.ml-positive` `.ml-price` `.ml-required-mark` `.ml-section` `.ml-section-description` `.ml-section-header` `.ml-section-header-centered` `.ml-section-muted` `.ml-section-shell` `.ml-stack` `.ml-stat` `.ml-stat-card` `.ml-stat-grid` `.ml-stat-list` `.ml-stat-meta` `.ml-stat-value` `.ml-text-primary` `.ml-value`
|
|
131
132
|
|
|
133
|
+
- `.ml-brand-mark` — A brand's own logo takes the mark's place: no chip, the text color, the mark's size.
|
|
132
134
|
- `.ml-check-list` — A list of benefits, each after a check. Pricing tiers and feature rows share it.
|
|
133
135
|
- `.ml-link` — A glyph inside a link flows with the text instead of breaking the line.
|
|
134
136
|
- `.ml-page-shell` — The navigation, main and footer are grid items; they may be narrower than their widest content (a table that scrolls), so the page never does.
|
|
@@ -151,6 +153,7 @@ correct. This table is read out of the stylesheet, so it is never stale.
|
|
|
151
153
|
| `.ml-badge` | `data-size` | `lg`, `sm` |
|
|
152
154
|
| `.ml-badge` | `data-tone` | `danger`, `info`, `primary`, `success`, `warning` |
|
|
153
155
|
| `.ml-badge` | `data-variant` | `outline`, `solid` |
|
|
156
|
+
| `.ml-brand-mark` | `data-kind` | `logo` |
|
|
154
157
|
| `.ml-breadcrumb-item` | `data-collapse-indicator` | _presence only_ |
|
|
155
158
|
| `.ml-breadcrumb-item` | `data-collapsible` | _presence only_ |
|
|
156
159
|
| `.ml-button` | `aria-disabled` | `true` |
|
package/registry/contract.json
CHANGED
package/registry/index.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"$schema": "./schema/registry-index.schema.json",
|
|
3
3
|
"schemaVersion": 2,
|
|
4
4
|
"name": "mlola-ui",
|
|
5
|
-
"version": "1.1.
|
|
5
|
+
"version": "1.1.2",
|
|
6
6
|
"homepage": "https://ui.mlola.com",
|
|
7
7
|
"themeContract": {
|
|
8
8
|
"attribute": "data-theme",
|
|
@@ -177,8 +177,8 @@
|
|
|
177
177
|
},
|
|
178
178
|
"registryDependencies": [],
|
|
179
179
|
"engineDependencies": {
|
|
180
|
-
"@mlola-ui/behavior": "^1.1.
|
|
181
|
-
"@mlola-ui/icons": "^1.1.
|
|
180
|
+
"@mlola-ui/behavior": "^1.1.2",
|
|
181
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
182
182
|
},
|
|
183
183
|
"options": [
|
|
184
184
|
{
|
|
@@ -239,7 +239,7 @@
|
|
|
239
239
|
},
|
|
240
240
|
"registryDependencies": [],
|
|
241
241
|
"engineDependencies": {
|
|
242
|
-
"@mlola-ui/icons": "^1.1.
|
|
242
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
243
243
|
},
|
|
244
244
|
"options": [
|
|
245
245
|
{
|
|
@@ -399,7 +399,7 @@
|
|
|
399
399
|
},
|
|
400
400
|
"registryDependencies": [],
|
|
401
401
|
"engineDependencies": {
|
|
402
|
-
"@mlola-ui/icons": "^1.1.
|
|
402
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
403
403
|
},
|
|
404
404
|
"options": [
|
|
405
405
|
{
|
|
@@ -491,7 +491,7 @@
|
|
|
491
491
|
},
|
|
492
492
|
"registryDependencies": [],
|
|
493
493
|
"engineDependencies": {
|
|
494
|
-
"@mlola-ui/icons": "^1.1.
|
|
494
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
495
495
|
},
|
|
496
496
|
"options": [],
|
|
497
497
|
"variants": [],
|
|
@@ -544,7 +544,7 @@
|
|
|
544
544
|
"spinner"
|
|
545
545
|
],
|
|
546
546
|
"engineDependencies": {
|
|
547
|
-
"@mlola-ui/motion": "^1.1.
|
|
547
|
+
"@mlola-ui/motion": "^1.1.2"
|
|
548
548
|
},
|
|
549
549
|
"options": [
|
|
550
550
|
{
|
|
@@ -708,8 +708,8 @@
|
|
|
708
708
|
},
|
|
709
709
|
"registryDependencies": [],
|
|
710
710
|
"engineDependencies": {
|
|
711
|
-
"@mlola-ui/behavior": "^1.1.
|
|
712
|
-
"@mlola-ui/icons": "^1.1.
|
|
711
|
+
"@mlola-ui/behavior": "^1.1.2",
|
|
712
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
713
713
|
},
|
|
714
714
|
"options": [
|
|
715
715
|
{
|
|
@@ -777,7 +777,7 @@
|
|
|
777
777
|
},
|
|
778
778
|
"registryDependencies": [],
|
|
779
779
|
"engineDependencies": {
|
|
780
|
-
"@mlola-ui/icons": "^1.1.
|
|
780
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
781
781
|
},
|
|
782
782
|
"options": [],
|
|
783
783
|
"variants": [],
|
|
@@ -832,7 +832,7 @@
|
|
|
832
832
|
"modal"
|
|
833
833
|
],
|
|
834
834
|
"engineDependencies": {
|
|
835
|
-
"@mlola-ui/icons": "^1.1.
|
|
835
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
836
836
|
},
|
|
837
837
|
"options": [],
|
|
838
838
|
"variants": [],
|
|
@@ -895,8 +895,8 @@
|
|
|
895
895
|
},
|
|
896
896
|
"registryDependencies": [],
|
|
897
897
|
"engineDependencies": {
|
|
898
|
-
"@mlola-ui/behavior": "^1.1.
|
|
899
|
-
"@mlola-ui/icons": "^1.1.
|
|
898
|
+
"@mlola-ui/behavior": "^1.1.2",
|
|
899
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
900
900
|
},
|
|
901
901
|
"options": [
|
|
902
902
|
{
|
|
@@ -960,7 +960,7 @@
|
|
|
960
960
|
"input"
|
|
961
961
|
],
|
|
962
962
|
"engineDependencies": {
|
|
963
|
-
"@mlola-ui/icons": "^1.1.
|
|
963
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
964
964
|
},
|
|
965
965
|
"options": [],
|
|
966
966
|
"variants": [],
|
|
@@ -1184,8 +1184,8 @@
|
|
|
1184
1184
|
},
|
|
1185
1185
|
"registryDependencies": [],
|
|
1186
1186
|
"engineDependencies": {
|
|
1187
|
-
"@mlola-ui/behavior": "^1.1.
|
|
1188
|
-
"@mlola-ui/icons": "^1.1.
|
|
1187
|
+
"@mlola-ui/behavior": "^1.1.2",
|
|
1188
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
1189
1189
|
},
|
|
1190
1190
|
"options": [
|
|
1191
1191
|
{
|
|
@@ -1335,7 +1335,7 @@
|
|
|
1335
1335
|
},
|
|
1336
1336
|
"registryDependencies": [],
|
|
1337
1337
|
"engineDependencies": {
|
|
1338
|
-
"@mlola-ui/icons": "^1.1.
|
|
1338
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
1339
1339
|
},
|
|
1340
1340
|
"options": [],
|
|
1341
1341
|
"variants": [],
|
|
@@ -1386,7 +1386,7 @@
|
|
|
1386
1386
|
},
|
|
1387
1387
|
"registryDependencies": [],
|
|
1388
1388
|
"engineDependencies": {
|
|
1389
|
-
"@mlola-ui/behavior": "^1.1.
|
|
1389
|
+
"@mlola-ui/behavior": "^1.1.2"
|
|
1390
1390
|
},
|
|
1391
1391
|
"options": [
|
|
1392
1392
|
{
|
|
@@ -1761,7 +1761,7 @@
|
|
|
1761
1761
|
},
|
|
1762
1762
|
"registryDependencies": [],
|
|
1763
1763
|
"engineDependencies": {
|
|
1764
|
-
"@mlola-ui/behavior": "^1.1.
|
|
1764
|
+
"@mlola-ui/behavior": "^1.1.2"
|
|
1765
1765
|
},
|
|
1766
1766
|
"options": [],
|
|
1767
1767
|
"variants": [],
|
|
@@ -1814,8 +1814,8 @@
|
|
|
1814
1814
|
"input"
|
|
1815
1815
|
],
|
|
1816
1816
|
"engineDependencies": {
|
|
1817
|
-
"@mlola-ui/behavior": "^1.1.
|
|
1818
|
-
"@mlola-ui/icons": "^1.1.
|
|
1817
|
+
"@mlola-ui/behavior": "^1.1.2",
|
|
1818
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
1819
1819
|
},
|
|
1820
1820
|
"options": [
|
|
1821
1821
|
{
|
|
@@ -1892,8 +1892,8 @@
|
|
|
1892
1892
|
},
|
|
1893
1893
|
"registryDependencies": [],
|
|
1894
1894
|
"engineDependencies": {
|
|
1895
|
-
"@mlola-ui/behavior": "^1.1.
|
|
1896
|
-
"@mlola-ui/icons": "^1.1.
|
|
1895
|
+
"@mlola-ui/behavior": "^1.1.2",
|
|
1896
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
1897
1897
|
},
|
|
1898
1898
|
"options": [
|
|
1899
1899
|
{
|
|
@@ -2039,7 +2039,7 @@
|
|
|
2039
2039
|
"input"
|
|
2040
2040
|
],
|
|
2041
2041
|
"engineDependencies": {
|
|
2042
|
-
"@mlola-ui/behavior": "^1.1.
|
|
2042
|
+
"@mlola-ui/behavior": "^1.1.2"
|
|
2043
2043
|
},
|
|
2044
2044
|
"options": [
|
|
2045
2045
|
{
|
|
@@ -2184,7 +2184,7 @@
|
|
|
2184
2184
|
},
|
|
2185
2185
|
"registryDependencies": [],
|
|
2186
2186
|
"engineDependencies": {
|
|
2187
|
-
"@mlola-ui/behavior": "^1.1.
|
|
2187
|
+
"@mlola-ui/behavior": "^1.1.2"
|
|
2188
2188
|
},
|
|
2189
2189
|
"options": [
|
|
2190
2190
|
{
|
|
@@ -2316,7 +2316,7 @@
|
|
|
2316
2316
|
},
|
|
2317
2317
|
"registryDependencies": [],
|
|
2318
2318
|
"engineDependencies": {
|
|
2319
|
-
"@mlola-ui/icons": "^1.1.
|
|
2319
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
2320
2320
|
},
|
|
2321
2321
|
"options": [
|
|
2322
2322
|
{
|
|
@@ -2402,7 +2402,7 @@
|
|
|
2402
2402
|
"spinner"
|
|
2403
2403
|
],
|
|
2404
2404
|
"engineDependencies": {
|
|
2405
|
-
"@mlola-ui/icons": "^1.1.
|
|
2405
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
2406
2406
|
},
|
|
2407
2407
|
"options": [
|
|
2408
2408
|
{
|
|
@@ -2545,7 +2545,7 @@
|
|
|
2545
2545
|
},
|
|
2546
2546
|
"registryDependencies": [],
|
|
2547
2547
|
"engineDependencies": {
|
|
2548
|
-
"@mlola-ui/behavior": "^1.1.
|
|
2548
|
+
"@mlola-ui/behavior": "^1.1.2"
|
|
2549
2549
|
},
|
|
2550
2550
|
"options": [
|
|
2551
2551
|
{
|
|
@@ -2684,7 +2684,7 @@
|
|
|
2684
2684
|
},
|
|
2685
2685
|
"registryDependencies": [],
|
|
2686
2686
|
"engineDependencies": {
|
|
2687
|
-
"@mlola-ui/icons": "^1.1.
|
|
2687
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
2688
2688
|
},
|
|
2689
2689
|
"options": [
|
|
2690
2690
|
{
|
|
@@ -2756,7 +2756,7 @@
|
|
|
2756
2756
|
"popover"
|
|
2757
2757
|
],
|
|
2758
2758
|
"engineDependencies": {
|
|
2759
|
-
"@mlola-ui/icons": "^1.1.
|
|
2759
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
2760
2760
|
},
|
|
2761
2761
|
"options": [
|
|
2762
2762
|
{
|
|
@@ -2826,7 +2826,7 @@
|
|
|
2826
2826
|
"popover"
|
|
2827
2827
|
],
|
|
2828
2828
|
"engineDependencies": {
|
|
2829
|
-
"@mlola-ui/icons": "^1.1.
|
|
2829
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
2830
2830
|
},
|
|
2831
2831
|
"options": [],
|
|
2832
2832
|
"variants": [],
|
|
@@ -3024,7 +3024,7 @@
|
|
|
3024
3024
|
"input"
|
|
3025
3025
|
],
|
|
3026
3026
|
"engineDependencies": {
|
|
3027
|
-
"@mlola-ui/icons": "^1.1.
|
|
3027
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
3028
3028
|
},
|
|
3029
3029
|
"options": [
|
|
3030
3030
|
{
|
|
@@ -3101,7 +3101,7 @@
|
|
|
3101
3101
|
"input"
|
|
3102
3102
|
],
|
|
3103
3103
|
"engineDependencies": {
|
|
3104
|
-
"@mlola-ui/icons": "^1.1.
|
|
3104
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
3105
3105
|
},
|
|
3106
3106
|
"options": [],
|
|
3107
3107
|
"variants": [],
|
|
@@ -3156,7 +3156,7 @@
|
|
|
3156
3156
|
"input"
|
|
3157
3157
|
],
|
|
3158
3158
|
"engineDependencies": {
|
|
3159
|
-
"@mlola-ui/icons": "^1.1.
|
|
3159
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
3160
3160
|
},
|
|
3161
3161
|
"options": [],
|
|
3162
3162
|
"variants": [],
|
|
@@ -3219,7 +3219,7 @@
|
|
|
3219
3219
|
"popover"
|
|
3220
3220
|
],
|
|
3221
3221
|
"engineDependencies": {
|
|
3222
|
-
"@mlola-ui/icons": "^1.1.
|
|
3222
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
3223
3223
|
},
|
|
3224
3224
|
"options": [
|
|
3225
3225
|
{
|
|
@@ -3289,7 +3289,7 @@
|
|
|
3289
3289
|
},
|
|
3290
3290
|
"registryDependencies": [],
|
|
3291
3291
|
"engineDependencies": {
|
|
3292
|
-
"@mlola-ui/icons": "^1.1.
|
|
3292
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
3293
3293
|
},
|
|
3294
3294
|
"options": [
|
|
3295
3295
|
{
|
|
@@ -3408,8 +3408,8 @@
|
|
|
3408
3408
|
},
|
|
3409
3409
|
"registryDependencies": [],
|
|
3410
3410
|
"engineDependencies": {
|
|
3411
|
-
"@mlola-ui/behavior": "^1.1.
|
|
3412
|
-
"@mlola-ui/icons": "^1.1.
|
|
3411
|
+
"@mlola-ui/behavior": "^1.1.2",
|
|
3412
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
3413
3413
|
},
|
|
3414
3414
|
"options": [],
|
|
3415
3415
|
"variants": [],
|
|
@@ -3473,7 +3473,7 @@
|
|
|
3473
3473
|
},
|
|
3474
3474
|
"registryDependencies": [],
|
|
3475
3475
|
"engineDependencies": {
|
|
3476
|
-
"@mlola-ui/behavior": "^1.1.
|
|
3476
|
+
"@mlola-ui/behavior": "^1.1.2"
|
|
3477
3477
|
},
|
|
3478
3478
|
"options": [
|
|
3479
3479
|
{
|
|
@@ -3560,8 +3560,8 @@
|
|
|
3560
3560
|
},
|
|
3561
3561
|
"registryDependencies": [],
|
|
3562
3562
|
"engineDependencies": {
|
|
3563
|
-
"@mlola-ui/behavior": "^1.1.
|
|
3564
|
-
"@mlola-ui/icons": "^1.1.
|
|
3563
|
+
"@mlola-ui/behavior": "^1.1.2",
|
|
3564
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
3565
3565
|
},
|
|
3566
3566
|
"options": [],
|
|
3567
3567
|
"variants": [],
|
|
@@ -3635,7 +3635,7 @@
|
|
|
3635
3635
|
"sheet"
|
|
3636
3636
|
],
|
|
3637
3637
|
"engineDependencies": {
|
|
3638
|
-
"@mlola-ui/icons": "^1.1.
|
|
3638
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
3639
3639
|
},
|
|
3640
3640
|
"options": [],
|
|
3641
3641
|
"variants": [],
|
|
@@ -3758,7 +3758,7 @@
|
|
|
3758
3758
|
"button"
|
|
3759
3759
|
],
|
|
3760
3760
|
"engineDependencies": {
|
|
3761
|
-
"@mlola-ui/icons": "^1.1.
|
|
3761
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
3762
3762
|
},
|
|
3763
3763
|
"options": [
|
|
3764
3764
|
{
|
|
@@ -3861,8 +3861,8 @@
|
|
|
3861
3861
|
"input"
|
|
3862
3862
|
],
|
|
3863
3863
|
"engineDependencies": {
|
|
3864
|
-
"@mlola-ui/behavior": "^1.1.
|
|
3865
|
-
"@mlola-ui/icons": "^1.1.
|
|
3864
|
+
"@mlola-ui/behavior": "^1.1.2",
|
|
3865
|
+
"@mlola-ui/icons": "^1.1.2"
|
|
3866
3866
|
},
|
|
3867
3867
|
"options": [
|
|
3868
3868
|
{
|
package/src/cli.js
CHANGED
|
@@ -11,7 +11,7 @@ import { addAssets, assetHint, loadAssetIndex } from "./assets.js";
|
|
|
11
11
|
import { runDoctor } from "./doctor.js";
|
|
12
12
|
import { collectEngineDependencies, installItems } from "./installer.js";
|
|
13
13
|
import { loadCatalogNames, loadRegistry, resolveItems } from "./registry.js";
|
|
14
|
-
import { clearCredentials, fetchProItems, GUIDE_FILENAME, hostFrom, readCredentials, saveCredentials, verifyToken, writeProGuide, writeProStyles } from "./pro.js";
|
|
14
|
+
import { catalogStylesheets, clearCredentials, fetchProItems, GUIDE_FILENAME, hostFrom, readCredentials, saveCredentials, verifyToken, writeProGuide, writeProStyles } from "./pro.js";
|
|
15
15
|
import { serveMcp } from "./mcp.js";
|
|
16
16
|
import { pullTheme } from "./theme-pull.js";
|
|
17
17
|
import { buildTheme } from "./theme-build.js";
|
|
@@ -86,15 +86,33 @@ function declaredPackages(cwd) {
|
|
|
86
86
|
const filename = path.join(cwd, "package.json");
|
|
87
87
|
if (!fs.existsSync(filename)) return null;
|
|
88
88
|
const manifest = JSON.parse(fs.readFileSync(filename, "utf8"));
|
|
89
|
-
return new
|
|
89
|
+
return new Map(Object.entries({ ...manifest.peerDependencies, ...manifest.devDependencies, ...manifest.dependencies }));
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
/** The lowest version a plain range (1.2.3, ^1.2.3, ~1.2.3, >=1.2.3) allows, or null for anything else. */
|
|
93
|
+
function lowestVersion(range) {
|
|
94
|
+
const match = /^\s*(?:\^|~|>=|=)?\s*v?(\d+)\.(\d+)\.(\d+)\s*$/.exec(String(range));
|
|
95
|
+
return match ? match.slice(1, 4).map(Number) : null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/** Whether a declared range lets in versions older than the required range does. */
|
|
99
|
+
function isBehind(declared, required) {
|
|
100
|
+
const have = lowestVersion(declared);
|
|
101
|
+
const need = lowestVersion(required);
|
|
102
|
+
if (!have || !need) return false; // workspace:, file:, tags and compound ranges are the project's call.
|
|
103
|
+
for (let index = 0; index < 3; index += 1) if (have[index] !== need[index]) return have[index] < need[index];
|
|
104
|
+
return false;
|
|
90
105
|
}
|
|
91
106
|
|
|
92
107
|
// Installs the packages the copied code imports and package.json does not
|
|
93
|
-
// declare
|
|
94
|
-
//
|
|
108
|
+
// declare, or declares at an older range than the copied code needs, with the
|
|
109
|
+
// project's own package manager. Without a package.json (a plain HTML site)
|
|
110
|
+
// or with --no-install it only names them.
|
|
95
111
|
function ensurePackages(cwd, dependencies, { skip, output, installer }) {
|
|
96
112
|
const declared = declaredPackages(cwd);
|
|
97
|
-
const missing = [...dependencies]
|
|
113
|
+
const missing = [...dependencies]
|
|
114
|
+
.filter(([name, range]) => !declared?.has(name) || isBehind(declared.get(name), range))
|
|
115
|
+
.map(([name, range]) => `${name}@${range}`);
|
|
98
116
|
if (!missing.length) return 0;
|
|
99
117
|
const [command, baseArgs] = packageManager(cwd);
|
|
100
118
|
const line = `${command} ${[...baseArgs, ...missing].join(" ")}`;
|
|
@@ -151,6 +169,7 @@ export async function run(argv, options = {}) {
|
|
|
151
169
|
output.log(
|
|
152
170
|
`Set data-theme="${config.theme}" on your document root and import ${stylesResult.relative}.`,
|
|
153
171
|
);
|
|
172
|
+
output.log(`Add data-mode="system" to follow the reader's light or dark setting, and load the theme's fonts: https://ui.mlola.com/docs#fonts-and-mode`);
|
|
154
173
|
if (!hasFlag(args, "--no-agents")) reportAgents(writeAgentFiles(cwd), output);
|
|
155
174
|
return ensurePackages(cwd, new Map([[config.engine.engine ?? "@mlola-ui/engine", `^${CLI_VERSION}`]]), install);
|
|
156
175
|
}
|
|
@@ -273,7 +292,7 @@ export async function run(argv, options = {}) {
|
|
|
273
292
|
|
|
274
293
|
const items = resolveItems(registry, names, catalogNames);
|
|
275
294
|
const result = installItems(cwd, registry, items, config, { overwrite });
|
|
276
|
-
const styleResult = writeProStyles(cwd, config, styles, { overwrite });
|
|
295
|
+
const styleResult = writeProStyles(cwd, config, styles, { overwrite, imports: catalogStylesheets(cwd, config, items) });
|
|
277
296
|
result.written.push(...styleResult.written);
|
|
278
297
|
result.unchanged.push(...styleResult.unchanged);
|
|
279
298
|
result.conflicts.push(...styleResult.conflicts);
|
package/src/pro.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import fs from "node:fs";
|
|
2
2
|
import os from "node:os";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { targetRoot } from "./config.js";
|
|
4
|
+
import { interpolateTarget, targetRoot } from "./config.js";
|
|
5
5
|
import { sha256 } from "./registry.js";
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -120,11 +120,24 @@ export function writeProGuide(cwd, guide, { overwrite = false } = {}) {
|
|
|
120
120
|
return { status: "written" };
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
+
/**
|
|
124
|
+
* The stylesheets that blocks, pages and templates carry beside their source
|
|
125
|
+
* (navbar.css beside navbar.tsx), as files the index can import.
|
|
126
|
+
*/
|
|
127
|
+
export function catalogStylesheets(cwd, config, items) {
|
|
128
|
+
return items
|
|
129
|
+
.filter((item) => ["registry:block", "registry:page", "registry:template"].includes(item.type))
|
|
130
|
+
.flatMap((item) => item.files.filter((file) => file.target.endsWith(".css")))
|
|
131
|
+
.map((file) => path.join(cwd, interpolateTarget(file.target, config)));
|
|
132
|
+
}
|
|
133
|
+
|
|
123
134
|
/**
|
|
124
135
|
* Pro stylesheets land in <styles>/mlola-pro/<name>.css, gathered by
|
|
125
136
|
* <styles>/mlola-pro.css, which the project imports once after the engine.
|
|
137
|
+
* The stylesheets of installed blocks, pages and templates are gathered there
|
|
138
|
+
* too, where they are, so importing the index styles everything installed.
|
|
126
139
|
*/
|
|
127
|
-
export function writeProStyles(cwd, config, styles, { overwrite = false } = {}) {
|
|
140
|
+
export function writeProStyles(cwd, config, styles, { overwrite = false, imports = [] } = {}) {
|
|
128
141
|
const root = targetRoot(config, "styles");
|
|
129
142
|
const written = [];
|
|
130
143
|
const unchanged = [];
|
|
@@ -151,8 +164,15 @@ export function writeProStyles(cwd, config, styles, { overwrite = false } = {})
|
|
|
151
164
|
const indexFile = path.join(cwd, indexRelative);
|
|
152
165
|
let index = fs.existsSync(indexFile) ? fs.readFileSync(indexFile, "utf8") : "/* Mlola Pro styles. Import this file once, after the engine stylesheet. */\n";
|
|
153
166
|
let changed = false;
|
|
154
|
-
|
|
155
|
-
|
|
167
|
+
const indexDirectory = path.dirname(indexFile);
|
|
168
|
+
const lines = [
|
|
169
|
+
...styles.map((style) => `@import "./mlola-pro/${style.name}.css";`),
|
|
170
|
+
...imports.map((file) => {
|
|
171
|
+
const relative = path.relative(indexDirectory, file).split(path.sep).join("/");
|
|
172
|
+
return `@import "${relative.startsWith(".") ? relative : `./${relative}`}";`;
|
|
173
|
+
}),
|
|
174
|
+
];
|
|
175
|
+
for (const line of lines) {
|
|
156
176
|
if (!index.includes(line)) {
|
|
157
177
|
index += `${line}\n`;
|
|
158
178
|
changed = true;
|
|
@@ -162,5 +182,5 @@ export function writeProStyles(cwd, config, styles, { overwrite = false } = {})
|
|
|
162
182
|
fs.mkdirSync(path.dirname(indexFile), { recursive: true });
|
|
163
183
|
fs.writeFileSync(indexFile, index);
|
|
164
184
|
}
|
|
165
|
-
return { written, unchanged, conflicts, index:
|
|
185
|
+
return { written, unchanged, conflicts, index: lines.length ? indexRelative : null };
|
|
166
186
|
}
|