mlola-ui 1.5.0 → 1.5.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mlola-ui",
3
- "version": "1.5.0",
3
+ "version": "1.5.1",
4
4
  "mcpName": "io.github.mlolahq/mlola-ui",
5
5
  "description": "Source-copy CLI that writes framework-free Mlola UI items into your project",
6
6
  "type": "module",
@@ -110,8 +110,7 @@
110
110
  "marketing-site",
111
111
  "docs-site",
112
112
  "finance",
113
- "smart-home",
114
- "islamic-finance"
113
+ "smart-home"
115
114
  ],
116
115
  "items": [
117
116
  {
@@ -1523,23 +1522,6 @@
1523
1522
  "dashboard",
1524
1523
  "premium"
1525
1524
  ]
1526
- },
1527
- {
1528
- "name": "islamic-finance",
1529
- "type": "registry:template",
1530
- "title": "Islamic Finance",
1531
- "description": "Sharia finance for a household: zakat reckoned on what is held a lunar year against the nisab in gold or silver and given to the eight who may receive it, dates on the Hijri calendar, sadaqah and waqf endowments, sukuk that pay a share of what their assets earn, and a home bought by murabahah at a price agreed once",
1532
- "category": "application",
1533
- "tags": [
1534
- "template",
1535
- "finance",
1536
- "islamic-finance",
1537
- "zakat",
1538
- "sukuk",
1539
- "waqf",
1540
- "murabahah",
1541
- "premium"
1542
- ]
1543
1525
  }
1544
1526
  ]
1545
1527
  }
@@ -2,7 +2,7 @@
2
2
  "$schema": "./schema/registry-index.schema.json",
3
3
  "schemaVersion": 2,
4
4
  "name": "mlola-ui",
5
- "version": "1.5.0",
5
+ "version": "1.5.1",
6
6
  "homepage": "https://ui.mlola.com",
7
7
  "themeContract": {
8
8
  "attribute": "data-theme",
@@ -178,8 +178,8 @@
178
178
  },
179
179
  "registryDependencies": [],
180
180
  "engineDependencies": {
181
- "@mlola-ui/behavior": "^1.5.0",
182
- "@mlola-ui/icons": "^1.5.0"
181
+ "@mlola-ui/behavior": "^1.5.1",
182
+ "@mlola-ui/icons": "^1.5.1"
183
183
  },
184
184
  "options": [
185
185
  {
@@ -240,7 +240,7 @@
240
240
  },
241
241
  "registryDependencies": [],
242
242
  "engineDependencies": {
243
- "@mlola-ui/icons": "^1.5.0"
243
+ "@mlola-ui/icons": "^1.5.1"
244
244
  },
245
245
  "options": [
246
246
  {
@@ -402,7 +402,7 @@
402
402
  },
403
403
  "registryDependencies": [],
404
404
  "engineDependencies": {
405
- "@mlola-ui/icons": "^1.5.0"
405
+ "@mlola-ui/icons": "^1.5.1"
406
406
  },
407
407
  "options": [
408
408
  {
@@ -494,7 +494,7 @@
494
494
  },
495
495
  "registryDependencies": [],
496
496
  "engineDependencies": {
497
- "@mlola-ui/icons": "^1.5.0"
497
+ "@mlola-ui/icons": "^1.5.1"
498
498
  },
499
499
  "options": [],
500
500
  "variants": [],
@@ -547,7 +547,7 @@
547
547
  "spinner"
548
548
  ],
549
549
  "engineDependencies": {
550
- "@mlola-ui/motion": "^1.5.0"
550
+ "@mlola-ui/motion": "^1.5.1"
551
551
  },
552
552
  "options": [
553
553
  {
@@ -715,8 +715,8 @@
715
715
  },
716
716
  "registryDependencies": [],
717
717
  "engineDependencies": {
718
- "@mlola-ui/behavior": "^1.5.0",
719
- "@mlola-ui/icons": "^1.5.0"
718
+ "@mlola-ui/behavior": "^1.5.1",
719
+ "@mlola-ui/icons": "^1.5.1"
720
720
  },
721
721
  "options": [
722
722
  {
@@ -785,7 +785,7 @@
785
785
  },
786
786
  "registryDependencies": [],
787
787
  "engineDependencies": {
788
- "@mlola-ui/icons": "^1.5.0"
788
+ "@mlola-ui/icons": "^1.5.1"
789
789
  },
790
790
  "options": [],
791
791
  "variants": [],
@@ -840,7 +840,7 @@
840
840
  "modal"
841
841
  ],
842
842
  "engineDependencies": {
843
- "@mlola-ui/icons": "^1.5.0"
843
+ "@mlola-ui/icons": "^1.5.1"
844
844
  },
845
845
  "options": [],
846
846
  "variants": [],
@@ -904,8 +904,8 @@
904
904
  },
905
905
  "registryDependencies": [],
906
906
  "engineDependencies": {
907
- "@mlola-ui/behavior": "^1.5.0",
908
- "@mlola-ui/icons": "^1.5.0"
907
+ "@mlola-ui/behavior": "^1.5.1",
908
+ "@mlola-ui/icons": "^1.5.1"
909
909
  },
910
910
  "options": [
911
911
  {
@@ -994,7 +994,7 @@
994
994
  "input"
995
995
  ],
996
996
  "engineDependencies": {
997
- "@mlola-ui/icons": "^1.5.0"
997
+ "@mlola-ui/icons": "^1.5.1"
998
998
  },
999
999
  "options": [],
1000
1000
  "variants": [],
@@ -1219,8 +1219,8 @@
1219
1219
  },
1220
1220
  "registryDependencies": [],
1221
1221
  "engineDependencies": {
1222
- "@mlola-ui/behavior": "^1.5.0",
1223
- "@mlola-ui/icons": "^1.5.0"
1222
+ "@mlola-ui/behavior": "^1.5.1",
1223
+ "@mlola-ui/icons": "^1.5.1"
1224
1224
  },
1225
1225
  "options": [
1226
1226
  {
@@ -1371,7 +1371,7 @@
1371
1371
  },
1372
1372
  "registryDependencies": [],
1373
1373
  "engineDependencies": {
1374
- "@mlola-ui/icons": "^1.5.0"
1374
+ "@mlola-ui/icons": "^1.5.1"
1375
1375
  },
1376
1376
  "options": [],
1377
1377
  "variants": [],
@@ -1422,7 +1422,7 @@
1422
1422
  },
1423
1423
  "registryDependencies": [],
1424
1424
  "engineDependencies": {
1425
- "@mlola-ui/behavior": "^1.5.0"
1425
+ "@mlola-ui/behavior": "^1.5.1"
1426
1426
  },
1427
1427
  "options": [
1428
1428
  {
@@ -1800,7 +1800,7 @@
1800
1800
  },
1801
1801
  "registryDependencies": [],
1802
1802
  "engineDependencies": {
1803
- "@mlola-ui/behavior": "^1.5.0"
1803
+ "@mlola-ui/behavior": "^1.5.1"
1804
1804
  },
1805
1805
  "options": [],
1806
1806
  "variants": [],
@@ -1853,8 +1853,8 @@
1853
1853
  "input"
1854
1854
  ],
1855
1855
  "engineDependencies": {
1856
- "@mlola-ui/behavior": "^1.5.0",
1857
- "@mlola-ui/icons": "^1.5.0"
1856
+ "@mlola-ui/behavior": "^1.5.1",
1857
+ "@mlola-ui/icons": "^1.5.1"
1858
1858
  },
1859
1859
  "options": [
1860
1860
  {
@@ -1932,8 +1932,8 @@
1932
1932
  },
1933
1933
  "registryDependencies": [],
1934
1934
  "engineDependencies": {
1935
- "@mlola-ui/behavior": "^1.5.0",
1936
- "@mlola-ui/icons": "^1.5.0"
1935
+ "@mlola-ui/behavior": "^1.5.1",
1936
+ "@mlola-ui/icons": "^1.5.1"
1937
1937
  },
1938
1938
  "options": [
1939
1939
  {
@@ -2079,7 +2079,7 @@
2079
2079
  "input"
2080
2080
  ],
2081
2081
  "engineDependencies": {
2082
- "@mlola-ui/behavior": "^1.5.0"
2082
+ "@mlola-ui/behavior": "^1.5.1"
2083
2083
  },
2084
2084
  "options": [
2085
2085
  {
@@ -2147,7 +2147,7 @@
2147
2147
  "input"
2148
2148
  ],
2149
2149
  "engineDependencies": {
2150
- "@mlola-ui/behavior": "^1.5.0"
2150
+ "@mlola-ui/behavior": "^1.5.1"
2151
2151
  },
2152
2152
  "options": [
2153
2153
  {
@@ -2307,7 +2307,7 @@
2307
2307
  },
2308
2308
  "registryDependencies": [],
2309
2309
  "engineDependencies": {
2310
- "@mlola-ui/behavior": "^1.5.0"
2310
+ "@mlola-ui/behavior": "^1.5.1"
2311
2311
  },
2312
2312
  "options": [
2313
2313
  {
@@ -2439,7 +2439,7 @@
2439
2439
  },
2440
2440
  "registryDependencies": [],
2441
2441
  "engineDependencies": {
2442
- "@mlola-ui/icons": "^1.5.0"
2442
+ "@mlola-ui/icons": "^1.5.1"
2443
2443
  },
2444
2444
  "options": [
2445
2445
  {
@@ -2527,8 +2527,8 @@
2527
2527
  "spinner"
2528
2528
  ],
2529
2529
  "engineDependencies": {
2530
- "@mlola-ui/behavior": "^1.5.0",
2531
- "@mlola-ui/icons": "^1.5.0"
2530
+ "@mlola-ui/behavior": "^1.5.1",
2531
+ "@mlola-ui/icons": "^1.5.1"
2532
2532
  },
2533
2533
  "options": [
2534
2534
  {
@@ -2683,7 +2683,7 @@
2683
2683
  },
2684
2684
  "registryDependencies": [],
2685
2685
  "engineDependencies": {
2686
- "@mlola-ui/behavior": "^1.5.0"
2686
+ "@mlola-ui/behavior": "^1.5.1"
2687
2687
  },
2688
2688
  "options": [
2689
2689
  {
@@ -2760,7 +2760,7 @@
2760
2760
  },
2761
2761
  "registryDependencies": [],
2762
2762
  "engineDependencies": {
2763
- "@mlola-ui/behavior": "^1.5.0"
2763
+ "@mlola-ui/behavior": "^1.5.1"
2764
2764
  },
2765
2765
  "options": [
2766
2766
  {
@@ -2842,7 +2842,7 @@
2842
2842
  },
2843
2843
  "registryDependencies": [],
2844
2844
  "engineDependencies": {
2845
- "@mlola-ui/icons": "^1.5.0"
2845
+ "@mlola-ui/icons": "^1.5.1"
2846
2846
  },
2847
2847
  "options": [
2848
2848
  {
@@ -2914,7 +2914,7 @@
2914
2914
  "popover"
2915
2915
  ],
2916
2916
  "engineDependencies": {
2917
- "@mlola-ui/icons": "^1.5.0"
2917
+ "@mlola-ui/icons": "^1.5.1"
2918
2918
  },
2919
2919
  "options": [
2920
2920
  {
@@ -2984,7 +2984,7 @@
2984
2984
  "popover"
2985
2985
  ],
2986
2986
  "engineDependencies": {
2987
- "@mlola-ui/icons": "^1.5.0"
2987
+ "@mlola-ui/icons": "^1.5.1"
2988
2988
  },
2989
2989
  "options": [],
2990
2990
  "variants": [],
@@ -3182,8 +3182,8 @@
3182
3182
  "input"
3183
3183
  ],
3184
3184
  "engineDependencies": {
3185
- "@mlola-ui/behavior": "^1.5.0",
3186
- "@mlola-ui/icons": "^1.5.0"
3185
+ "@mlola-ui/behavior": "^1.5.1",
3186
+ "@mlola-ui/icons": "^1.5.1"
3187
3187
  },
3188
3188
  "options": [
3189
3189
  {
@@ -3272,7 +3272,7 @@
3272
3272
  "input"
3273
3273
  ],
3274
3274
  "engineDependencies": {
3275
- "@mlola-ui/icons": "^1.5.0"
3275
+ "@mlola-ui/icons": "^1.5.1"
3276
3276
  },
3277
3277
  "options": [],
3278
3278
  "variants": [],
@@ -3327,7 +3327,7 @@
3327
3327
  "input"
3328
3328
  ],
3329
3329
  "engineDependencies": {
3330
- "@mlola-ui/icons": "^1.5.0"
3330
+ "@mlola-ui/icons": "^1.5.1"
3331
3331
  },
3332
3332
  "options": [],
3333
3333
  "variants": [],
@@ -3390,7 +3390,7 @@
3390
3390
  "popover"
3391
3391
  ],
3392
3392
  "engineDependencies": {
3393
- "@mlola-ui/icons": "^1.5.0"
3393
+ "@mlola-ui/icons": "^1.5.1"
3394
3394
  },
3395
3395
  "options": [
3396
3396
  {
@@ -3461,7 +3461,7 @@
3461
3461
  },
3462
3462
  "registryDependencies": [],
3463
3463
  "engineDependencies": {
3464
- "@mlola-ui/icons": "^1.5.0"
3464
+ "@mlola-ui/icons": "^1.5.1"
3465
3465
  },
3466
3466
  "options": [
3467
3467
  {
@@ -3580,8 +3580,8 @@
3580
3580
  },
3581
3581
  "registryDependencies": [],
3582
3582
  "engineDependencies": {
3583
- "@mlola-ui/behavior": "^1.5.0",
3584
- "@mlola-ui/icons": "^1.5.0"
3583
+ "@mlola-ui/behavior": "^1.5.1",
3584
+ "@mlola-ui/icons": "^1.5.1"
3585
3585
  },
3586
3586
  "options": [],
3587
3587
  "variants": [],
@@ -3645,7 +3645,7 @@
3645
3645
  },
3646
3646
  "registryDependencies": [],
3647
3647
  "engineDependencies": {
3648
- "@mlola-ui/behavior": "^1.5.0"
3648
+ "@mlola-ui/behavior": "^1.5.1"
3649
3649
  },
3650
3650
  "options": [
3651
3651
  {
@@ -3732,8 +3732,8 @@
3732
3732
  },
3733
3733
  "registryDependencies": [],
3734
3734
  "engineDependencies": {
3735
- "@mlola-ui/behavior": "^1.5.0",
3736
- "@mlola-ui/icons": "^1.5.0"
3735
+ "@mlola-ui/behavior": "^1.5.1",
3736
+ "@mlola-ui/icons": "^1.5.1"
3737
3737
  },
3738
3738
  "options": [],
3739
3739
  "variants": [],
@@ -3807,7 +3807,7 @@
3807
3807
  "sheet"
3808
3808
  ],
3809
3809
  "engineDependencies": {
3810
- "@mlola-ui/icons": "^1.5.0"
3810
+ "@mlola-ui/icons": "^1.5.1"
3811
3811
  },
3812
3812
  "options": [],
3813
3813
  "variants": [],
@@ -3930,7 +3930,7 @@
3930
3930
  "button"
3931
3931
  ],
3932
3932
  "engineDependencies": {
3933
- "@mlola-ui/icons": "^1.5.0"
3933
+ "@mlola-ui/icons": "^1.5.1"
3934
3934
  },
3935
3935
  "options": [
3936
3936
  {
@@ -4034,8 +4034,8 @@
4034
4034
  "input"
4035
4035
  ],
4036
4036
  "engineDependencies": {
4037
- "@mlola-ui/behavior": "^1.5.0",
4038
- "@mlola-ui/icons": "^1.5.0"
4037
+ "@mlola-ui/behavior": "^1.5.1",
4038
+ "@mlola-ui/icons": "^1.5.1"
4039
4039
  },
4040
4040
  "options": [
4041
4041
  {
package/src/knowledge.js CHANGED
@@ -256,10 +256,83 @@ function handSpacing(text) {
256
256
 
257
257
  const SPACING_FIX = "Measure with the scale: var(--ml-space-2), var(--ml-space-4)… (get_tokens spacing), or a calc() of its steps; space that grows with the window is var(--ml-space-fluid-sm)… to -xl. An em tuned to the font is fine; a length invented between the steps is not.";
258
258
 
259
+ /** One opening tag, the whole of it: its name and its attributes. */
260
+ const OPENING_TAG = /^<([A-Za-z][\w.-]*)((?:\s+(?:[^\s"'>={}]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|\{(?:[^{}]|\{[^{}]*\})*\}))?))*)\s*\/?>$/;
261
+ /** The longest an opening tag may run before it is taken to be text. */
262
+ const MAX_TAG = 8192;
263
+
264
+ /**
265
+ * Where each candidate opening tag starts and ends, found in one pass:
266
+ * quotes and JSX braces are skipped over, a tag ends at the first ">"
267
+ * outside them, and a "<" outside them means the one before was not a tag.
268
+ * The pattern above then reads each candidate on its own. Markup is anyone's
269
+ * input (a pasted page, a fetched site), so nothing here rescans what it has
270
+ * passed: a tag left open costs no more than its own length.
271
+ */
272
+ function* tagSpans(markup) {
273
+ let start = markup.indexOf("<");
274
+ while (start >= 0) {
275
+ if (!/[A-Za-z]/.test(markup[start + 1] ?? "")) {
276
+ start = markup.indexOf("<", start + 1);
277
+ continue;
278
+ }
279
+ let quote = "";
280
+ let depth = 0;
281
+ let end = -1;
282
+ let next = -1;
283
+ let at = start + 1;
284
+ for (; at < markup.length && at - start <= MAX_TAG; at += 1) {
285
+ const char = markup[at];
286
+ if (quote) {
287
+ if (char === quote) quote = "";
288
+ } else if (depth > 0) {
289
+ if (char === "{") depth += 1;
290
+ else if (char === "}") depth -= 1;
291
+ } else if (char === '"' || char === "'") quote = char;
292
+ else if (char === "{") depth = 1;
293
+ else if (char === ">") {
294
+ end = at;
295
+ break;
296
+ } else if (char === "<") {
297
+ next = at;
298
+ break;
299
+ }
300
+ }
301
+ if (end >= 0) {
302
+ yield [start, end + 1];
303
+ start = markup.indexOf("<", end + 1);
304
+ } else start = next >= 0 ? next : markup.indexOf("<", at);
305
+ }
306
+ }
307
+
308
+ /**
309
+ * Each <style> block, shaped like a match ([whole, body], index), found with
310
+ * indexOf so a block left open costs one scan to the end and no more.
311
+ */
312
+ function* styleBlocks(markup) {
313
+ const lower = markup.toLowerCase();
314
+ let from = 0;
315
+ while (from < markup.length) {
316
+ const open = lower.indexOf("<style", from);
317
+ if (open < 0) return;
318
+ const opened = markup.indexOf(">", open);
319
+ if (opened < 0) return;
320
+ const close = lower.indexOf("</style>", opened + 1);
321
+ if (close < 0) return;
322
+ const block = [markup.slice(open, close + 8), markup.slice(opened + 1, close)];
323
+ block.index = open;
324
+ yield block;
325
+ from = close + 8;
326
+ }
327
+ }
328
+
259
329
  /** Every opening tag in HTML or JSX, with its string-valued attributes. */
260
330
  export function tagsOf(markup) {
261
331
  const tags = [];
262
- for (const match of markup.matchAll(/<([A-Za-z][\w.-]*)((?:\s+(?:[^\s"'>={}]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|\{(?:[^{}]|\{[^{}]*\})*\}))?))*)\s*\/?>/g)) {
332
+ for (const [from, to] of tagSpans(markup)) {
333
+ const match = OPENING_TAG.exec(markup.slice(from, to));
334
+ if (!match) continue;
335
+ match.index = from;
263
336
  const attributes = new Map();
264
337
  for (const attribute of match[2].matchAll(/([^\s"'>={}]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|(\{(?:[^{}]|\{[^{}]*\})*\})))?/g)) {
265
338
  const [, name, double, single, expression] = attribute;
@@ -474,7 +547,7 @@ export function checkMarkup(markup, { themes: ownThemes = [], contract: installe
474
547
  }
475
548
 
476
549
  // The page's own stylesheet: the same rules hold in a <style> block.
477
- for (const block of markup.matchAll(/<style[^>]*>([\s\S]*?)<\/style>/gi)) {
550
+ for (const block of styleBlocks(markup)) {
478
551
  // Comments become blanks of the same length, so every offset still points into the markup.
479
552
  const css = block[1].replace(/\/\*[\s\S]*?\*\//g, (comment) => comment.replace(/[^\n]/g, " "));
480
553
  let offset = block.index + block[0].indexOf(">") + 1;