@astryxdesign/cli 0.7.9-canary.e657e2e → 0.7.9-canary.eaea67d

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 (53) hide show
  1. package/README.md +1 -1
  2. package/api/component/__fixtures__/resolutions/modules.txt +5 -5
  3. package/api/search/_candidate-score.mjs +25 -23
  4. package/api/search/_words.d.mts +44 -7
  5. package/api/search/_words.mjs +113 -21
  6. package/api/swizzle/copy/copy.d.mts +17 -1
  7. package/api/swizzle/copy/copy.mjs +240 -5
  8. package/api/swizzle/swizzle.doc.mjs +1 -1
  9. package/api/swizzle/swizzle.type.mjs +1 -1
  10. package/api/theme/build/build.mjs +342 -72
  11. package/api/theme/build/core-interception.mjs +92 -29
  12. package/api/theme/build/icon-imports.d.mts +35 -4
  13. package/api/theme/build/icon-imports.mjs +299 -38
  14. package/assets/discover/official-packages.json +4 -0
  15. package/assets/docs/author-a-theme.doc.mjs +3 -1
  16. package/assets/docs/icons.doc.mjs +29 -0
  17. package/assets/docs/motion.doc.mjs +1 -1
  18. package/assets/templates/blocks/components/Calendar/useCalendarDaysHookUsage.doc.mjs +14 -0
  19. package/assets/templates/blocks/components/Calendar/useCalendarDaysHookUsage.tsx +71 -0
  20. package/assets/templates/blocks/components/Hooks/useInputContainerHookUsage.doc.mjs +15 -0
  21. package/assets/templates/blocks/components/Hooks/useInputContainerHookUsage.tsx +93 -0
  22. package/assets/templates/blocks/components/Hooks/useMergedRefsHookUsage.doc.mjs +14 -0
  23. package/assets/templates/blocks/components/Hooks/useMergedRefsHookUsage.tsx +78 -0
  24. package/assets/templates/blocks/components/Hooks/useScrollLockHookUsage.doc.mjs +14 -0
  25. package/assets/templates/blocks/components/Hooks/useScrollLockHookUsage.tsx +80 -0
  26. package/assets/templates/blocks/components/Hooks/useScrollOverflowHookUsage.doc.mjs +14 -0
  27. package/assets/templates/blocks/components/Hooks/useScrollOverflowHookUsage.tsx +94 -0
  28. package/assets/templates/blocks/components/Icon/useIconHookUsage.doc.mjs +19 -0
  29. package/assets/templates/blocks/components/Icon/useIconHookUsage.tsx +68 -0
  30. package/assets/templates/blocks/components/Link/useLinkComponentHookUsage.doc.mjs +14 -0
  31. package/assets/templates/blocks/components/Link/useLinkComponentHookUsage.tsx +89 -0
  32. package/assets/templates/blocks/components/Overlay/useOverlayHookUsage.doc.mjs +21 -0
  33. package/assets/templates/blocks/components/Overlay/useOverlayHookUsage.tsx +49 -0
  34. package/assets/templates/blocks/components/Table/useTableSortableStateHookUsage.doc.mjs +14 -0
  35. package/assets/templates/blocks/components/Table/useTableSortableStateHookUsage.tsx +61 -0
  36. package/assets/templates/blocks/components/usePanGesture/PanDraggableBox.doc.mjs +15 -0
  37. package/assets/templates/blocks/components/usePanGesture/PanDraggableBox.tsx +98 -0
  38. package/assets/templates/blocks/components/usePanGesture/PanPlayingCard.doc.mjs +14 -0
  39. package/assets/templates/blocks/components/usePanGesture/PanPlayingCard.tsx +147 -0
  40. package/assets/theme.template.ts +14 -2
  41. package/authoring/doctypes/base/type.ts +41 -0
  42. package/authoring/doctypes/component/component.doc.mjs +7 -1
  43. package/authoring/doctypes/component/type.ts +5 -0
  44. package/authoring/index.d.ts +2 -0
  45. package/clients/cli/commands/swizzle.mjs +10 -0
  46. package/clients/cli/lib/component-format.mjs +49 -0
  47. package/foundation/discovery/component-discovery.mjs +17 -6
  48. package/foundation/integrations/manifest-writer.d.mts +3 -4
  49. package/foundation/integrations/manifest-writer.mjs +5 -3
  50. package/foundation/response/response-types.doc.mjs +1 -1
  51. package/foundation/text/levenshtein.d.mts +4 -1
  52. package/foundation/text/levenshtein.mjs +44 -1
  53. package/package.json +9 -9
@@ -262,7 +262,7 @@ export const doc = {
262
262
  {
263
263
  value: 'swizzle.copy',
264
264
  description:
265
- "An eject receipt: component name, owning package, output directory, files-copied count, the written file names, whether any file uses StyleX, and, when the owner has an issues URL, feedback ({issuesUrl, ghCommand?}): where to report the gap that led to swizzling. The envelope's package names the same owning package.",
265
+ "An eject receipt: component name, owning package, output directory, files-copied count, the copied file names (relative to the component folder; owner modules copied beside it start with ../), whether any file uses StyleX, and, when the owner has an issues URL, feedback ({issuesUrl, ghCommand?}): where to report the gap that led to swizzling. The envelope's package names the same owning package.",
266
266
  },
267
267
 
268
268
  // gap reports
@@ -16,6 +16,9 @@
16
16
  /**
17
17
  * @param {string} a
18
18
  * @param {string} b
19
+ * @param {number} [max] - The largest distance the caller can use. When
20
+ * given, a larger distance answers `max + 1`, and only the cells within
21
+ * `max` of the diagonal are computed.
19
22
  * @returns {number}
20
23
  */
21
- export function levenshteinDistance(a: string, b: string): number;
24
+ export function levenshteinDistance(a: string, b: string, max?: number): number;
@@ -16,9 +16,13 @@
16
16
  /**
17
17
  * @param {string} a
18
18
  * @param {string} b
19
+ * @param {number} [max] - The largest distance the caller can use. When
20
+ * given, a larger distance answers `max + 1`, and only the cells within
21
+ * `max` of the diagonal are computed.
19
22
  * @returns {number}
20
23
  */
21
- export function levenshteinDistance(a, b) {
24
+ export function levenshteinDistance(a, b, max) {
25
+ if (max !== undefined) return distanceWithin(a, b, max);
22
26
  const m = a.length, n = b.length;
23
27
  // Early exit: the distance is always ≥ |m − n|, so once the length gap
24
28
  // exceeds the loosest fuzzy-match threshold any caller uses (the hook
@@ -39,3 +43,42 @@ export function levenshteinDistance(a, b) {
39
43
  }
40
44
  return dp[m][n];
41
45
  }
46
+
47
+ /**
48
+ * The edit distance between `a` and `b` when it is at most `max`, or
49
+ * `max + 1` when it is more. A path through a cell more than `max` from the
50
+ * diagonal costs more than `max`, so only that band is computed.
51
+ * @param {string} a
52
+ * @param {string} b
53
+ * @param {number} max
54
+ * @returns {number}
55
+ */
56
+ function distanceWithin(a, b, max) {
57
+ const over = max + 1;
58
+ if (Math.abs(a.length - b.length) > max) return over;
59
+ let previous = new Array(b.length + 1).fill(over);
60
+ let current = new Array(b.length + 1).fill(over);
61
+ for (let j = 0; j <= Math.min(b.length, max); j++) previous[j] = j;
62
+ for (let i = 1; i <= a.length; i++) {
63
+ current.fill(over);
64
+ const from = Math.max(1, i - max);
65
+ const to = Math.min(b.length, i + max);
66
+ if (i <= max) current[0] = i;
67
+ let rowMin = current[0];
68
+ for (let j = from; j <= to; j++) {
69
+ const cost = a[i - 1] === b[j - 1] ? 0 : 1;
70
+ const value = Math.min(
71
+ previous[j - 1] + cost,
72
+ previous[j] + 1,
73
+ current[j - 1] + 1,
74
+ over,
75
+ );
76
+ current[j] = value;
77
+ if (value < rowMin) rowMin = value;
78
+ }
79
+ // Every later cell costs at least this row's least.
80
+ if (rowMin >= over) return over;
81
+ [previous, current] = [current, previous];
82
+ }
83
+ return Math.min(previous[b.length], over);
84
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.7.9-canary.e657e2e",
3
+ "version": "0.7.9-canary.eaea67d",
4
4
  "displayName": "CLI",
5
5
  "description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
6
6
  "author": "Meta Open Source",
@@ -124,10 +124,10 @@
124
124
  "zod": "^4.4.3"
125
125
  },
126
126
  "peerDependencies": {
127
- "@astryxdesign/charts": "0.7.9-canary.e657e2e",
128
- "@astryxdesign/core": "0.7.9-canary.e657e2e",
129
- "@astryxdesign/lab": "0.7.9-canary.e657e2e",
130
- "@astryxdesign/theme-neutral": "0.7.9-canary.e657e2e"
127
+ "@astryxdesign/charts": "0.7.9-canary.eaea67d",
128
+ "@astryxdesign/core": "0.7.9-canary.eaea67d",
129
+ "@astryxdesign/lab": "0.7.9-canary.eaea67d",
130
+ "@astryxdesign/theme-neutral": "0.7.9-canary.eaea67d"
131
131
  },
132
132
  "peerDependenciesMeta": {
133
133
  "@astryxdesign/charts": {
@@ -144,10 +144,10 @@
144
144
  }
145
145
  },
146
146
  "devDependencies": {
147
- "@astryxdesign/charts": "0.7.9-canary.e657e2e",
148
- "@astryxdesign/core": "0.7.9-canary.e657e2e",
149
- "@astryxdesign/lab": "0.7.9-canary.e657e2e",
150
- "@astryxdesign/theme-neutral": "0.7.9-canary.e657e2e",
147
+ "@astryxdesign/charts": "0.7.9-canary.eaea67d",
148
+ "@astryxdesign/core": "0.7.9-canary.eaea67d",
149
+ "@astryxdesign/lab": "0.7.9-canary.eaea67d",
150
+ "@astryxdesign/theme-neutral": "0.7.9-canary.eaea67d",
151
151
  "@heroicons/react": "^2.2.0",
152
152
  "@stylexjs/stylex": "^0.19.0",
153
153
  "@types/babel__core": "^7.20.5",