@sprawlify/primitives 0.0.51 → 0.0.52

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 (101) hide show
  1. package/dist/{collection-C85P2ZDW.mjs → collection-CjwZd09Z.mjs} +7 -1
  2. package/dist/{collection-C5tUixCe.cjs → collection-Q52RkxUe.cjs} +7 -1
  3. package/dist/collection.cjs +1 -1
  4. package/dist/collection.d.cts +3 -3
  5. package/dist/collection.d.mts +3 -3
  6. package/dist/collection.mjs +1 -1
  7. package/dist/date-utils.d.mts +1 -1
  8. package/dist/{index-BqhWpjZh.d.mts → index-ExuT65LJ.d.mts} +5 -5
  9. package/dist/{list-collection-DettiQL3.d.cts → list-collection-BvMwDNHf.d.cts} +1 -1
  10. package/dist/{list-collection-BbgocToA.d.mts → list-collection-CTt1eong.d.mts} +1 -1
  11. package/dist/machines/angle-slider/index.d.cts +1 -1
  12. package/dist/machines/angle-slider/index.d.mts +1 -1
  13. package/dist/machines/carousel/index.d.cts +1 -1
  14. package/dist/machines/carousel/index.d.mts +1 -1
  15. package/dist/machines/checkbox/index.d.cts +1 -1
  16. package/dist/machines/checkbox/index.d.mts +1 -1
  17. package/dist/machines/clipboard/index.d.cts +1 -1
  18. package/dist/machines/clipboard/index.d.mts +1 -1
  19. package/dist/machines/collapsible/index.d.cts +1 -1
  20. package/dist/machines/collapsible/index.d.mts +1 -1
  21. package/dist/machines/color-picker/index.d.cts +1 -1
  22. package/dist/machines/color-picker/index.d.mts +1 -1
  23. package/dist/machines/combobox/index.cjs +1 -1
  24. package/dist/machines/combobox/index.d.cts +2 -2
  25. package/dist/machines/combobox/index.d.mts +2 -2
  26. package/dist/machines/combobox/index.mjs +1 -1
  27. package/dist/machines/date-picker/index.d.cts +1 -1
  28. package/dist/machines/date-picker/index.d.mts +2 -2
  29. package/dist/machines/dialog/index.d.cts +1 -1
  30. package/dist/machines/dialog/index.d.mts +1 -1
  31. package/dist/machines/editable/index.d.cts +1 -1
  32. package/dist/machines/editable/index.d.mts +1 -1
  33. package/dist/machines/file-upload/index.d.cts +1 -1
  34. package/dist/machines/file-upload/index.d.mts +1 -1
  35. package/dist/machines/floating-panel/index.d.cts +1 -1
  36. package/dist/machines/floating-panel/index.d.mts +1 -1
  37. package/dist/machines/hover-card/index.d.cts +1 -1
  38. package/dist/machines/hover-card/index.d.mts +1 -1
  39. package/dist/machines/image-cropper/index.d.cts +1 -1
  40. package/dist/machines/image-cropper/index.d.mts +1 -1
  41. package/dist/machines/listbox/index.cjs +1 -1
  42. package/dist/machines/listbox/index.d.cts +3 -3
  43. package/dist/machines/listbox/index.d.mts +3 -3
  44. package/dist/machines/listbox/index.mjs +1 -1
  45. package/dist/machines/marquee/index.d.cts +3 -3
  46. package/dist/machines/marquee/index.d.mts +3 -3
  47. package/dist/machines/menu/index.d.cts +1 -1
  48. package/dist/machines/menu/index.d.mts +1 -1
  49. package/dist/machines/navigation-menu/index.d.cts +1 -1
  50. package/dist/machines/navigation-menu/index.d.mts +1 -1
  51. package/dist/machines/number-input/index.d.cts +1 -1
  52. package/dist/machines/number-input/index.d.mts +1 -1
  53. package/dist/machines/pagination/index.d.cts +1 -1
  54. package/dist/machines/pagination/index.d.mts +1 -1
  55. package/dist/machines/password-input/index.d.cts +1 -1
  56. package/dist/machines/password-input/index.d.mts +1 -1
  57. package/dist/machines/pin-input/index.d.cts +1 -1
  58. package/dist/machines/pin-input/index.d.mts +1 -1
  59. package/dist/machines/popover/index.d.cts +1 -1
  60. package/dist/machines/popover/index.d.mts +1 -1
  61. package/dist/machines/progress/index.d.cts +1 -1
  62. package/dist/machines/progress/index.d.mts +1 -1
  63. package/dist/machines/rating-group/index.d.cts +1 -1
  64. package/dist/machines/rating-group/index.d.mts +1 -1
  65. package/dist/machines/scroll-area/index.d.cts +1 -1
  66. package/dist/machines/scroll-area/index.d.mts +1 -1
  67. package/dist/machines/select/index.cjs +1 -1
  68. package/dist/machines/select/index.d.cts +2 -2
  69. package/dist/machines/select/index.d.mts +2 -2
  70. package/dist/machines/select/index.mjs +1 -1
  71. package/dist/machines/signature-pad/index.d.cts +1 -1
  72. package/dist/machines/signature-pad/index.d.mts +1 -1
  73. package/dist/machines/slider/index.d.cts +1 -1
  74. package/dist/machines/slider/index.d.mts +1 -1
  75. package/dist/machines/splitter/index.d.cts +1 -1
  76. package/dist/machines/splitter/index.d.mts +1 -1
  77. package/dist/machines/steps/index.d.cts +1 -1
  78. package/dist/machines/steps/index.d.mts +1 -1
  79. package/dist/machines/switch/index.d.cts +1 -1
  80. package/dist/machines/switch/index.d.mts +1 -1
  81. package/dist/machines/tabs/index.d.cts +1 -1
  82. package/dist/machines/tabs/index.d.mts +1 -1
  83. package/dist/machines/tags-input/index.d.cts +1 -1
  84. package/dist/machines/tags-input/index.d.mts +1 -1
  85. package/dist/machines/timer/index.d.cts +1 -1
  86. package/dist/machines/timer/index.d.mts +1 -1
  87. package/dist/machines/toast/index.d.cts +1 -1
  88. package/dist/machines/toast/index.d.mts +1 -1
  89. package/dist/machines/tooltip/index.d.cts +1 -1
  90. package/dist/machines/tooltip/index.d.mts +1 -1
  91. package/dist/machines/tour/index.d.cts +1 -1
  92. package/dist/machines/tour/index.d.mts +1 -1
  93. package/dist/machines/tree-view/index.cjs +11 -6
  94. package/dist/machines/tree-view/index.d.cts +2 -2
  95. package/dist/machines/tree-view/index.d.mts +2 -2
  96. package/dist/machines/tree-view/index.mjs +11 -6
  97. package/dist/{selection-CTaapzrB.d.mts → selection-JDFmyke7.d.mts} +1 -1
  98. package/dist/{selection-D3b3yV_x.d.cts → selection-vng1guNc.d.cts} +1 -1
  99. package/dist/{tree-collection-Dlv1BAsc.d.cts → tree-collection-CmehimuO.d.cts} +1 -1
  100. package/dist/{tree-collection-DYIVkVee.d.mts → tree-collection-CqXQBHwY.d.mts} +1 -1
  101. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  const require_create_anatomy = require('../../create-anatomy-CDsIFUXg.cjs');
2
2
  const require_dom_query = require('../../dom-query-ClqjTSZC.cjs');
3
3
  const require_utils = require('../../utils-B4_qn2dt.cjs');
4
- const require_collection = require('../../collection-C5tUixCe.cjs');
4
+ const require_collection = require('../../collection-Q52RkxUe.cjs');
5
5
  const require_core = require('../../core-NCx2blZX.cjs');
6
6
  const require_create_props = require('../../create-props-l5q5b8Wo.cjs');
7
7
 
@@ -76,18 +76,21 @@ function connect(service, normalize) {
76
76
  const focusedValue = context.get("focusedValue");
77
77
  const loadingStatus = context.get("loadingStatus");
78
78
  const renamingValue = context.get("renamingValue");
79
+ const skip = ({ indexPath }) => {
80
+ return collection$1.getValuePath(indexPath).slice(0, -1).some((value) => !expandedValue.includes(value));
81
+ };
82
+ const firstNode = collection$1.getFirstNode(void 0, { skip });
83
+ const firstNodeValue = firstNode ? collection$1.getNodeValue(firstNode) : null;
79
84
  function getNodeState(props$1) {
80
85
  const { node, indexPath } = props$1;
81
86
  const value = collection$1.getNodeValue(node);
82
- const firstNode = collection$1.getFirstNode();
83
- const firstNodeValue = firstNode ? collection$1.getNodeValue(firstNode) : null;
84
87
  return {
85
88
  id: getNodeId(scope, value),
86
89
  value,
87
90
  indexPath,
88
91
  valuePath: collection$1.getValuePath(indexPath),
89
92
  disabled: Boolean(node.disabled),
90
- focused: focusedValue == null ? firstNodeValue == value : focusedValue === value,
93
+ focused: focusedValue == null ? firstNodeValue === value : focusedValue === value,
91
94
  selected: selectedValue.includes(value),
92
95
  expanded: expandedValue.includes(value),
93
96
  loading: loadingStatus[value] === "loading",
@@ -971,7 +974,8 @@ const machine = require_core.createMachine({
971
974
  focusTreeFirstNode(params) {
972
975
  const { prop, scope } = params;
973
976
  const collection$1 = prop("collection");
974
- const firstNode = collection$1.getFirstNode();
977
+ const firstNode = collection$1.getFirstNode(void 0, { skip: skipFn(params) });
978
+ if (!firstNode) return;
975
979
  const firstValue = collection$1.getNodeValue(firstNode);
976
980
  if (scrollToNode(params, firstValue)) require_dom_query.raf(() => focusNode(scope, firstValue));
977
981
  else focusNode(scope, firstValue);
@@ -988,7 +992,8 @@ const machine = require_core.createMachine({
988
992
  const { event, prop, scope } = params;
989
993
  const collection$1 = prop("collection");
990
994
  const branchNode = collection$1.findNode(event.id);
991
- const firstNode = collection$1.getFirstNode(branchNode);
995
+ const firstNode = collection$1.getFirstNode(branchNode, { skip: skipFn(params) });
996
+ if (!firstNode) return;
992
997
  const firstValue = collection$1.getNodeValue(firstNode);
993
998
  if (scrollToNode(params, firstValue)) require_dom_query.raf(() => focusNode(scope, firstValue));
994
999
  else focusNode(scope, firstValue);
@@ -1,12 +1,12 @@
1
1
  import { n as AnatomyInstance } from "../../create-anatomy-smWrirg1.cjs";
2
2
  import { f as TreeCollectionOptions, g as ValuePath, p as TreeNode, s as FilePathTreeNode, u as IndexPath } from "../../types-CADkcKtr.cjs";
3
- import { t as TreeCollection } from "../../tree-collection-Dlv1BAsc.cjs";
3
+ import { t as TreeCollection } from "../../tree-collection-CmehimuO.cjs";
4
4
  import { p as Machine, y as Service } from "../../types-DejIu60O.cjs";
5
5
  import { b as NormalizeProps, g as RequiredBy, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-Bqw3r34-.cjs";
6
6
  import { n as TypeaheadState } from "../../typeahead-BdNwVP09.cjs";
7
7
 
8
8
  //#region src/machines/tree-view/tree-view.anatomy.d.ts
9
- declare const anatomy: AnatomyInstance<"root" | "label" | "item" | "itemIndicator" | "branch" | "branchContent" | "branchControl" | "branchIndentGuide" | "branchIndicator" | "branchText" | "branchTrigger" | "itemText" | "nodeCheckbox" | "nodeRenameInput" | "tree">;
9
+ declare const anatomy: AnatomyInstance<"root" | "label" | "item" | "itemText" | "itemIndicator" | "branch" | "branchContent" | "branchControl" | "branchIndentGuide" | "branchIndicator" | "branchText" | "branchTrigger" | "nodeCheckbox" | "nodeRenameInput" | "tree">;
10
10
  //#endregion
11
11
  //#region src/machines/tree-view/tree-view.collection.d.ts
12
12
  declare const collection: {
@@ -1,12 +1,12 @@
1
1
  import { n as AnatomyInstance } from "../../create-anatomy-DHVOqZET.mjs";
2
2
  import { f as TreeCollectionOptions, g as ValuePath, p as TreeNode, s as FilePathTreeNode, u as IndexPath } from "../../types-Df8ZhdY-.mjs";
3
- import { t as TreeCollection } from "../../tree-collection-DYIVkVee.mjs";
3
+ import { t as TreeCollection } from "../../tree-collection-CqXQBHwY.mjs";
4
4
  import { p as Machine, y as Service } from "../../types-DL5AIQk5.mjs";
5
5
  import { b as NormalizeProps, g as RequiredBy, r as DirectionProperty, t as CommonProperties, x as PropTypes } from "../../index-BuUzJjaP.mjs";
6
6
  import { n as TypeaheadState } from "../../typeahead-DMSwLv1e.mjs";
7
7
 
8
8
  //#region src/machines/tree-view/tree-view.anatomy.d.ts
9
- declare const anatomy: AnatomyInstance<"root" | "label" | "item" | "itemIndicator" | "branch" | "branchContent" | "branchControl" | "branchIndentGuide" | "branchIndicator" | "branchText" | "branchTrigger" | "itemText" | "nodeCheckbox" | "nodeRenameInput" | "tree">;
9
+ declare const anatomy: AnatomyInstance<"root" | "label" | "item" | "itemText" | "itemIndicator" | "branch" | "branchContent" | "branchControl" | "branchIndentGuide" | "branchIndicator" | "branchText" | "branchTrigger" | "nodeCheckbox" | "nodeRenameInput" | "tree">;
10
10
  //#endregion
11
11
  //#region src/machines/tree-view/tree-view.collection.d.ts
12
12
  declare const collection: {
@@ -1,7 +1,7 @@
1
1
  import { t as createAnatomy } from "../../create-anatomy-CArN8dVu.mjs";
2
2
  import { W as raf, bt as isLeftClick, cn as isEditableElement, ht as isComposingEvent, on as isAnchorElement, ot as setElementValue, pt as getEventTarget, s as getByTypeahead, ut as getEventKey, vn as ariaAttr, xt as isModifierKey, yn as dataAttr } from "../../dom-query-BwpPRIas.mjs";
3
3
  import { At as remove, Dt as partition, Mt as toArray, Nt as uniq, _t as diff, ft as isEqual, mt as addOrRemove, nt as isArray, pt as add, t as ensure, u as createSplitProps, vt as first, wt as last } from "../../utils-DSBXwmDm.mjs";
4
- import { n as filePathToTree, t as TreeCollection } from "../../collection-C85P2ZDW.mjs";
4
+ import { n as filePathToTree, t as TreeCollection } from "../../collection-CjwZd09Z.mjs";
5
5
  import { a as createMachine, i as createGuards } from "../../core-BjksCLhs.mjs";
6
6
  import { t as createProps } from "../../create-props-SRSjdUTq.mjs";
7
7
 
@@ -76,18 +76,21 @@ function connect(service, normalize) {
76
76
  const focusedValue = context.get("focusedValue");
77
77
  const loadingStatus = context.get("loadingStatus");
78
78
  const renamingValue = context.get("renamingValue");
79
+ const skip = ({ indexPath }) => {
80
+ return collection$1.getValuePath(indexPath).slice(0, -1).some((value) => !expandedValue.includes(value));
81
+ };
82
+ const firstNode = collection$1.getFirstNode(void 0, { skip });
83
+ const firstNodeValue = firstNode ? collection$1.getNodeValue(firstNode) : null;
79
84
  function getNodeState(props$1) {
80
85
  const { node, indexPath } = props$1;
81
86
  const value = collection$1.getNodeValue(node);
82
- const firstNode = collection$1.getFirstNode();
83
- const firstNodeValue = firstNode ? collection$1.getNodeValue(firstNode) : null;
84
87
  return {
85
88
  id: getNodeId(scope, value),
86
89
  value,
87
90
  indexPath,
88
91
  valuePath: collection$1.getValuePath(indexPath),
89
92
  disabled: Boolean(node.disabled),
90
- focused: focusedValue == null ? firstNodeValue == value : focusedValue === value,
93
+ focused: focusedValue == null ? firstNodeValue === value : focusedValue === value,
91
94
  selected: selectedValue.includes(value),
92
95
  expanded: expandedValue.includes(value),
93
96
  loading: loadingStatus[value] === "loading",
@@ -971,7 +974,8 @@ const machine = createMachine({
971
974
  focusTreeFirstNode(params) {
972
975
  const { prop, scope } = params;
973
976
  const collection$1 = prop("collection");
974
- const firstNode = collection$1.getFirstNode();
977
+ const firstNode = collection$1.getFirstNode(void 0, { skip: skipFn(params) });
978
+ if (!firstNode) return;
975
979
  const firstValue = collection$1.getNodeValue(firstNode);
976
980
  if (scrollToNode(params, firstValue)) raf(() => focusNode(scope, firstValue));
977
981
  else focusNode(scope, firstValue);
@@ -988,7 +992,8 @@ const machine = createMachine({
988
992
  const { event, prop, scope } = params;
989
993
  const collection$1 = prop("collection");
990
994
  const branchNode = collection$1.findNode(event.id);
991
- const firstNode = collection$1.getFirstNode(branchNode);
995
+ const firstNode = collection$1.getFirstNode(branchNode, { skip: skipFn(params) });
996
+ if (!firstNode) return;
992
997
  const firstValue = collection$1.getNodeValue(firstNode);
993
998
  if (scrollToNode(params, firstValue)) raf(() => focusNode(scope, firstValue));
994
999
  else focusNode(scope, firstValue);
@@ -1,5 +1,5 @@
1
1
  import { r as CollectionOptions, t as CollectionItem } from "./types-Df8ZhdY-.mjs";
2
- import { t as ListCollection } from "./list-collection-BbgocToA.mjs";
2
+ import { t as ListCollection } from "./list-collection-CTt1eong.mjs";
3
3
 
4
4
  //#region src/shared/collection/grid-collection.d.ts
5
5
  interface GridCollectionOptions<T> extends CollectionOptions<T> {
@@ -1,5 +1,5 @@
1
1
  import { r as CollectionOptions, t as CollectionItem } from "./types-CADkcKtr.cjs";
2
- import { t as ListCollection } from "./list-collection-DettiQL3.cjs";
2
+ import { t as ListCollection } from "./list-collection-BvMwDNHf.cjs";
3
3
 
4
4
  //#region src/shared/collection/grid-collection.d.ts
5
5
  interface GridCollectionOptions<T> extends CollectionOptions<T> {
@@ -27,7 +27,7 @@ declare class TreeCollection<T = TreeNode> {
27
27
  getNodeDisabled: (node: T) => boolean;
28
28
  stringify: (value: string) => string | null;
29
29
  stringifyNode: (node: T) => string;
30
- getFirstNode: (rootNode?: T) => T | undefined;
30
+ getFirstNode: (rootNode?: T, opts?: TreeSkipOptions<T>) => T | undefined;
31
31
  getLastNode: (rootNode?: T, opts?: TreeSkipOptions<T>) => T | undefined;
32
32
  at: (indexPath: IndexPath) => T | undefined;
33
33
  findNode: (value: string, rootNode?: T) => T | undefined;
@@ -27,7 +27,7 @@ declare class TreeCollection<T = TreeNode> {
27
27
  getNodeDisabled: (node: T) => boolean;
28
28
  stringify: (value: string) => string | null;
29
29
  stringifyNode: (node: T) => string;
30
- getFirstNode: (rootNode?: T) => T | undefined;
30
+ getFirstNode: (rootNode?: T, opts?: TreeSkipOptions<T>) => T | undefined;
31
31
  getLastNode: (rootNode?: T, opts?: TreeSkipOptions<T>) => T | undefined;
32
32
  at: (indexPath: IndexPath) => T | undefined;
33
33
  findNode: (value: string, rootNode?: T) => T | undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sprawlify/primitives",
3
- "version": "0.0.51",
3
+ "version": "0.0.52",
4
4
  "type": "module",
5
5
  "description": "A set of primitive components for building user interfaces.",
6
6
  "author": "sprawlify <npm@sprawlify.com>",