@fusion.dev/helix-core 0.165.0 → 0.166.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.
@@ -15564,6 +15564,14 @@
15564
15564
  "module": "./utils/filter-marks/filter-marks.js"
15565
15565
  }
15566
15566
  },
15567
+ {
15568
+ "kind": "js",
15569
+ "name": "filterKeeps",
15570
+ "declaration": {
15571
+ "name": "filterKeeps",
15572
+ "module": "./utils/filter-marks/filter-marks.js"
15573
+ }
15574
+ },
15567
15575
  {
15568
15576
  "kind": "js",
15569
15577
  "name": "markMatches",
@@ -27610,6 +27618,37 @@
27610
27618
  }
27611
27619
  ],
27612
27620
  "description": "Marks where `needle` matches in each of `elements`, for `owner`, without\ntouching the elements. An empty needle takes the owner's marks away, which\nis also what an owner leaving the page calls.\n\n**The Custom Highlight API paints a range, and nothing is inserted.** The\nwords are usually the consumer's own light DOM, slotted through as many as\ntwo shadow roots, and wrapping the matched part in a `<mark>` would mean\nrewriting their content: markup they wrote would come back changed. So an\noption holding a link or an icon is marked as readily as one holding a bare\nword. Listbox marks what its filter matched this way, and so every family\nthat filters through one: Select, Combobox, Command and Time Picker.\n\n**The rule that paints it lives in `base.css`**, as\n`::highlight(helix-filter-match)`, rather than in a component's styles. A\nhighlight is styled from the tree its text lives in, and that text lives in\nthe consumer's document.\n\nNothing at all where the API is missing, as on a server, in a test\nenvironment or in an older browser: the text nodes are not walked for an\nanswer nothing can paint."
27621
+ },
27622
+ {
27623
+ "kind": "function",
27624
+ "name": "filterKeeps",
27625
+ "return": {
27626
+ "type": {
27627
+ "text": "boolean"
27628
+ }
27629
+ },
27630
+ "parameters": [
27631
+ {
27632
+ "name": "text",
27633
+ "type": {
27634
+ "text": "string"
27635
+ }
27636
+ },
27637
+ {
27638
+ "name": "filter",
27639
+ "type": {
27640
+ "text": "string"
27641
+ }
27642
+ },
27643
+ {
27644
+ "name": "match",
27645
+ "optional": true,
27646
+ "type": {
27647
+ "text": "((text: string, filter: string) => boolean) | undefined"
27648
+ }
27649
+ }
27650
+ ],
27651
+ "description": "Whether a filter keeps an item: its words hold the filter, in any case, or\n`match` says so where the page gave one. An empty filter keeps everything.\n\nOne answer for every family that filters, so Listbox, Command and a\nfilterable Menu keep the same items for the same words, and a `filterMatch`\nthe page writes once means the same thing in each."
27613
27652
  }
27614
27653
  ],
27615
27654
  "exports": [
@@ -27636,6 +27675,14 @@
27636
27675
  "name": "markMatches",
27637
27676
  "module": "src/utils/filter-marks/filter-marks.ts"
27638
27677
  }
27678
+ },
27679
+ {
27680
+ "kind": "js",
27681
+ "name": "filterKeeps",
27682
+ "declaration": {
27683
+ "name": "filterKeeps",
27684
+ "module": "src/utils/filter-marks/filter-marks.ts"
27685
+ }
27639
27686
  }
27640
27687
  ]
27641
27688
  },
@@ -33264,7 +33311,7 @@
33264
33311
  "type": {
33265
33312
  "text": "string"
33266
33313
  },
33267
- "default": "'0.165.0'",
33314
+ "default": "'0.166.0'",
33268
33315
  "description": "The version of the package this file ships in.\n\n**Written by `fusion/scripts/version.mjs`** wherever it writes the package's\n`package.json`, and stamped back into the repository beside it after a\nrelease, so the two never disagree; a spec beside this holds them to it.\nNothing else in the running code knows which release it is."
33269
33316
  }
33270
33317
  ],
@@ -33824,6 +33871,6 @@
33824
33871
  ],
33825
33872
  "helix": {
33826
33873
  "package": "@fusion.dev/helix-core",
33827
- "version": "0.165.0"
33874
+ "version": "0.166.0"
33828
33875
  }
33829
33876
  }
package/dist/index.d.ts CHANGED
@@ -83,7 +83,7 @@ export { elapsedTime } from './utils/elapsed-time/elapsed-time.js';
83
83
  export { type ElementByIdOptions, elementById, searchableById, } from './utils/element-by-id/element-by-id.js';
84
84
  export { exportParts } from './utils/export-parts/export-parts.js';
85
85
  export { fillTemplate, labelWith } from './utils/fill-template/fill-template.js';
86
- export { FILTER_MARK, markMatches, rangeOf } from './utils/filter-marks/filter-marks.js';
86
+ export { FILTER_MARK, filterKeeps, markMatches, rangeOf, } from './utils/filter-marks/filter-marks.js';
87
87
  export { focusTarget } from './utils/focus-target/focus-target.js';
88
88
  export { deepActiveElement, deepContains, focusableElements, PRESSABLE, pressedOwnControl, } from './utils/focusable-elements/focusable-elements.js';
89
89
  export { afterLinkFollowed, followLink, type LinkModifiers, type LinkTarget, } from './utils/follow-link/follow-link.js';
package/dist/index.js CHANGED
@@ -83,7 +83,7 @@ export { elapsedTime } from './utils/elapsed-time/elapsed-time.js';
83
83
  export { elementById, searchableById, } from './utils/element-by-id/element-by-id.js';
84
84
  export { exportParts } from './utils/export-parts/export-parts.js';
85
85
  export { fillTemplate, labelWith } from './utils/fill-template/fill-template.js';
86
- export { FILTER_MARK, markMatches, rangeOf } from './utils/filter-marks/filter-marks.js';
86
+ export { FILTER_MARK, filterKeeps, markMatches, rangeOf, } from './utils/filter-marks/filter-marks.js';
87
87
  export { focusTarget } from './utils/focus-target/focus-target.js';
88
88
  export { deepActiveElement, deepContains, focusableElements, PRESSABLE, pressedOwnControl, } from './utils/focusable-elements/focusable-elements.js';
89
89
  export { afterLinkFollowed, followLink, } from './utils/follow-link/follow-link.js';
@@ -34,3 +34,12 @@ export declare const rangeOf: (root: Element, needle: string) => Range[];
34
34
  * answer nothing can paint.
35
35
  */
36
36
  export declare const markMatches: (owner: Element, elements: Iterable<Element>, needle: string) => void;
37
+ /**
38
+ * Whether a filter keeps an item: its words hold the filter, in any case, or
39
+ * `match` says so where the page gave one. An empty filter keeps everything.
40
+ *
41
+ * One answer for every family that filters, so Listbox, Command and a
42
+ * filterable Menu keep the same items for the same words, and a `filterMatch`
43
+ * the page writes once means the same thing in each.
44
+ */
45
+ export declare const filterKeeps: (text: string, filter: string, match?: ((text: string, filter: string) => boolean) | undefined) => boolean;
@@ -39,3 +39,4 @@ export const markMatches = (owner, elements, needle) => {
39
39
  registry.set(FILTER_MARK, new Highlight(...all));
40
40
  }
41
41
  };
42
+ export const filterKeeps = (text, filter, match) => filter === '' || (match ? match(text, filter) : text.toLowerCase().includes(filter.toLowerCase()));
package/dist/version.d.ts CHANGED
@@ -6,4 +6,4 @@
6
6
  * release, so the two never disagree; a spec beside this holds them to it.
7
7
  * Nothing else in the running code knows which release it is.
8
8
  */
9
- export declare const VERSION = "0.165.0";
9
+ export declare const VERSION = "0.166.0";
package/dist/version.js CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.165.0';
1
+ export const VERSION = '0.166.0';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@fusion.dev/helix-core",
3
3
  "description": "Helix element primitives: base classes, mixins, decorators, utilities.",
4
- "version": "0.165.0",
4
+ "version": "0.166.0",
5
5
  "license": "MIT",
6
6
  "author": "Ross Sheppard <ross.sheppard@fusion.dev>",
7
7
  "repository": {
@@ -56,11 +56,11 @@
56
56
  "bugs": "https://github.com/project-fusion/fusion/issues",
57
57
  "dependencies": {
58
58
  "@floating-ui/dom": "^1.8.0",
59
- "@fusion.dev/helix-icons": "0.165.0"
59
+ "@fusion.dev/helix-icons": "0.166.0"
60
60
  },
61
61
  "devDependencies": {
62
- "@fusion.dev/helix-cem": "0.165.0",
63
- "@fusion.dev/helix-testing": "0.165.0",
62
+ "@fusion.dev/helix-cem": "0.166.0",
63
+ "@fusion.dev/helix-testing": "0.166.0",
64
64
  "@lit-labs/ssr": "^4.1.0",
65
65
  "lit": "^3.2.1"
66
66
  },