tosijs-ui 1.16.21 → 1.16.23

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +85 -0
  2. package/README.md +2 -2
  3. package/bin/make-icon-data.js +1 -1
  4. package/dist/caption-icon.d.ts +2 -0
  5. package/dist/caption-icon.js +12 -0
  6. package/dist/code-editor.js +2 -3
  7. package/dist/data-table.js +1 -1
  8. package/dist/doc-browser.d.ts +4 -0
  9. package/dist/doc-browser.js +46 -101
  10. package/dist/doc-system/doc-system-styles.js +11 -0
  11. package/dist/doc-system/doc-system.js +1 -1
  12. package/dist/doc-system/highlight-styles.js +11 -16
  13. package/dist/doc-system/routing.d.ts +9 -0
  14. package/dist/doc-system/routing.js +22 -6
  15. package/dist/doc-system/site/build-warnings.d.ts +10 -0
  16. package/dist/doc-system/site/build-warnings.js +24 -0
  17. package/dist/doc-system/site/dev-auth.d.ts +13 -0
  18. package/dist/doc-system/site/dev-auth.js +40 -2
  19. package/dist/doc-system/site/dev-server.js +13 -1
  20. package/dist/doc-system/site/docs.d.ts +14 -0
  21. package/dist/doc-system/site/docs.js +61 -81
  22. package/dist/doc-system/site/epub.js +6 -2
  23. package/dist/doc-system/site/generate-site.js +15 -5
  24. package/dist/doc-system/site/orchestrator.js +1 -0
  25. package/dist/doc-system/site/site-config.d.ts +25 -0
  26. package/dist/editable-rect.js +1 -3
  27. package/dist/highlight-block.js +3 -10
  28. package/dist/icon-rules.d.ts +17 -1
  29. package/dist/icon-rules.js +33 -6
  30. package/dist/icon-svg.js +17 -20
  31. package/dist/icons.js +31 -15
  32. package/dist/iife.js +91 -95
  33. package/dist/iife.js.map +27 -26
  34. package/dist/index.d.ts +1 -0
  35. package/dist/index.js +1 -0
  36. package/dist/live-example/component.js +3 -4
  37. package/dist/menu.js +2 -2
  38. package/dist/natural-compare.js +6 -2
  39. package/dist/password-strength.js +1 -1
  40. package/dist/pocket-bar.js +2 -2
  41. package/dist/segmented.js +3 -4
  42. package/dist/select.js +2 -1
  43. package/dist/size-break.js +4 -3
  44. package/dist/track-drag.js +1 -1
  45. package/dist/version.d.ts +1 -1
  46. package/dist/version.js +1 -1
  47. package/llms.txt +12 -8
  48. package/package.json +1 -1
package/dist/icons.js CHANGED
@@ -1,3 +1,4 @@
1
+ /*{ "parent": "Components" }*/
1
2
  /*#
2
3
  # icons
3
4
 
@@ -8,8 +9,8 @@
8
9
  </div>
9
10
 
10
11
  `icons` is a proxy that generates an `ElementCreator` for a given icon on demand,
11
- e.g. `icons.chevronDown()` produces an `<svg>` element containing a downward-pointing chevron
12
- icon with the class `icon-chevron-down`.
12
+ e.g. `icons.chevronDown()` produces an `<svg>` element (class `tosi-icon`) containing a
13
+ downward-pointing chevron.
13
14
 
14
15
  Most of the built-in icons come from [Feather](https://feathericons.com). If you want more
15
16
  icons in the same style, [lucide](https://lucide.dev) is a fork and expansion of Feather and a
@@ -200,12 +201,12 @@ test('filter input and prefix select exist', () => {
200
201
  })
201
202
  ```
202
203
 
203
- These icons are completely unstyled and can be colored using the css `fill` property. This will
204
- probably be broken out as a standalone library to allow the use of whatever icons you like
205
- (its source data is currently generated from an [icomoon](https://icomoon.com/app)
206
- `selection.json` file, but could just as easily be generated from a directory full of SVGs).
204
+ Icons take their colour from the text around them (`currentColor`). Override fill and stroke
205
+ with `--tosi-icon-fill` and `--tosi-icon-stroke`, or per icon with the `F` and `S` suffixes
206
+ (see [Icon modifier suffixes](#icon-modifier-suffixes)). The icon data is generated from a
207
+ directory of SVGs (see [Building icon data](#building-icon-data)).
207
208
 
208
- ### Need More Icons?
209
+ ## Need More Icons?
209
210
 
210
211
  [lucide](https://lucide.dev) is a fork and expansion of feather that maintains the style and
211
212
  adds a lot more options. Obviously it's completely compatible with this icon system and generously licensed. A
@@ -441,6 +442,24 @@ The overlay rules are just string rewrites — for example, `unFoo`
441
442
  becomes `slash25o$foo75s75o`. **Overlay icons should have a square
442
443
  viewBox** for best results on non-square base icons.
443
444
 
445
+ #### Explicit rules: `rule:icon`
446
+
447
+ `checkSquare` is ambiguous: it is a registered icon, and it also reads as
448
+ the `check` rule over `square`. A registered icon wins, so it draws the
449
+ icon. Put a `:` at the boundary to ask for the rule: `check:square`,
450
+ `un:lock`, `spin90:loader`. The explicit form applies the rule (unless
451
+ you `defineIcons` that exact name, which warns), needs no capital letter
452
+ after the prefix, and takes suffixes and stacking
453
+ as usual (`spin90:loader40s`, `un:lock$shield`). A `:` is not valid in a
454
+ JavaScript identifier, so write `icons['check:square']()`, or
455
+ `<tosi-icon icon="check:square">`.
456
+
457
+ ```html
458
+ <tosi-icon icon="checkSquare" size="48"></tosi-icon>
459
+ <tosi-icon icon="check:square" size="48"></tosi-icon>
460
+ <tosi-icon icon="un:lock" size="48"></tosi-icon>
461
+ ```
462
+
444
463
  ### Custom rules
445
464
 
446
465
  `iconRules` is a mutable array. Each rule has a `prefix` (string or
@@ -571,7 +590,7 @@ copies or substantial portions of the Software.
571
590
  import { elements, svgElements, Color, vars, varDefault, withAttributes, } from 'tosijs';
572
591
  import iconData from './icon-data.js';
573
592
  import { splitSuffixes, suffixNumber } from './icon-suffixes.js';
574
- import { iconRules, spinRule, matchRule, canResolve } from './icon-rules.js';
593
+ import { iconRules, spinRule, matchRule, canResolve, suffixedIcon, } from './icon-rules.js';
575
594
  export { iconRules } from './icon-rules.js';
576
595
  export const defineIcons = (newIcons) => {
577
596
  const data = iconData;
@@ -592,6 +611,7 @@ export const defineIcons = (newIcons) => {
592
611
  if (matched == null || !canResolve(matched.baseName))
593
612
  return false;
594
613
  return (typeof rule.prefix !== 'string' ||
614
+ name.includes(':') ||
595
615
  /[A-Z]/.test(name[rule.prefix.length]));
596
616
  });
597
617
  if (readsAsRule) {
@@ -901,14 +921,10 @@ export function resolveIcon(prop, parts) {
901
921
  });
902
922
  return wrapIcon(prop, parts, base, ...overlays);
903
923
  }
904
- /*
905
- Style suffixes on a registered icon win over a composition rule (#3295): `checkCircle90r`
906
- is `checkCircle` turned, not the `check` rule over `circle90r`. A rule still applies
907
- when its suffixes are on an icon that only the rule makes (`spin90Loader50o`).
908
- */
924
+ // Suffixes on a registered icon win over a rule (suffixedIcon, #3295). A rule still
925
+ // applies when its suffixes are on an icon only the rule makes (`spin90Loader50o`).
909
926
  const parsed = parseStyleSuffixes(prop);
910
- const native = parsed != null && iconData[parsed.baseName];
911
- if (!native) {
927
+ if (!suffixedIcon(prop)) {
912
928
  const composed = composeIcon(prop, parts);
913
929
  if (composed)
914
930
  return composed;