linecraft 0.2.4 → 0.2.6

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 (79) hide show
  1. package/LICENSE +59 -21
  2. package/README.md +51 -8
  3. package/lib/components/code-debug.d.ts +2 -0
  4. package/lib/components/code-debug.d.ts.map +1 -1
  5. package/lib/components/code-debug.js +205 -266
  6. package/lib/components/code-debug.js.map +1 -1
  7. package/lib/components/code-debug.test.d.ts +2 -0
  8. package/lib/components/code-debug.test.d.ts.map +1 -0
  9. package/lib/components/code-debug.test.js +245 -0
  10. package/lib/components/code-debug.test.js.map +1 -0
  11. package/lib/components/fill.d.ts +2 -1
  12. package/lib/components/fill.d.ts.map +1 -1
  13. package/lib/components/fill.js.map +1 -1
  14. package/lib/components/progress-bar-grid.d.ts.map +1 -1
  15. package/lib/components/progress-bar-grid.js +5 -3
  16. package/lib/components/progress-bar-grid.js.map +1 -1
  17. package/lib/components/prompt.js +1 -1
  18. package/lib/components/prompt.js.map +1 -1
  19. package/lib/components/section.js +1 -1
  20. package/lib/components/section.js.map +1 -1
  21. package/lib/components/segments.js +4 -4
  22. package/lib/components/segments.js.map +1 -1
  23. package/lib/components/spinner.d.ts +2 -1
  24. package/lib/components/spinner.d.ts.map +1 -1
  25. package/lib/components/spinner.js +1 -1
  26. package/lib/components/spinner.js.map +1 -1
  27. package/lib/components/styled.d.ts +4 -2
  28. package/lib/components/styled.d.ts.map +1 -1
  29. package/lib/components/styled.js +37 -8
  30. package/lib/components/styled.js.map +1 -1
  31. package/lib/index.d.ts +2 -0
  32. package/lib/index.d.ts.map +1 -1
  33. package/lib/index.js +1 -0
  34. package/lib/index.js.map +1 -1
  35. package/lib/layout/grid.d.ts +3 -2
  36. package/lib/layout/grid.d.ts.map +1 -1
  37. package/lib/layout/grid.js +94 -47
  38. package/lib/layout/grid.js.map +1 -1
  39. package/lib/layout/grid.test.js +67 -0
  40. package/lib/layout/grid.test.js.map +1 -1
  41. package/lib/native/diff.test.js.map +1 -1
  42. package/lib/native/region-renderer.d.ts +1 -0
  43. package/lib/native/region-renderer.d.ts.map +1 -1
  44. package/lib/native/region-renderer.js +31 -1
  45. package/lib/native/region-renderer.js.map +1 -1
  46. package/lib/native/region.test.js +1 -1
  47. package/lib/native/region.test.js.map +1 -1
  48. package/lib/region-resize.test.js +3 -3
  49. package/lib/region-resize.test.js.map +1 -1
  50. package/lib/region.d.ts.map +1 -1
  51. package/lib/region.js +0 -46
  52. package/lib/region.js.map +1 -1
  53. package/lib/types.d.ts +6 -5
  54. package/lib/types.d.ts.map +1 -1
  55. package/lib/utils/colors.d.ts.map +1 -1
  56. package/lib/utils/colors.js +50 -8
  57. package/lib/utils/colors.js.map +1 -1
  58. package/lib/utils/colors.test.js.map +1 -1
  59. package/lib/utils/cursor-position.d.ts.map +1 -1
  60. package/lib/utils/cursor-position.js +4 -13
  61. package/lib/utils/cursor-position.js.map +1 -1
  62. package/lib/utils/debug-log.js +1 -1
  63. package/lib/utils/debug-log.js.map +1 -1
  64. package/lib/utils/terminal-theme.d.ts +17 -28
  65. package/lib/utils/terminal-theme.d.ts.map +1 -1
  66. package/lib/utils/terminal-theme.js +66 -38
  67. package/lib/utils/terminal-theme.js.map +1 -1
  68. package/lib/utils/text.d.ts +64 -2
  69. package/lib/utils/text.d.ts.map +1 -1
  70. package/lib/utils/text.js +619 -103
  71. package/lib/utils/text.js.map +1 -1
  72. package/lib/utils/text.test.d.ts +2 -0
  73. package/lib/utils/text.test.d.ts.map +1 -0
  74. package/lib/utils/text.test.js +237 -0
  75. package/lib/utils/text.test.js.map +1 -0
  76. package/lib/utils/wait-for-spacebar.d.ts.map +1 -1
  77. package/lib/utils/wait-for-spacebar.js +1 -8
  78. package/lib/utils/wait-for-spacebar.js.map +1 -1
  79. package/package.json +8 -2
package/LICENSE CHANGED
@@ -1,21 +1,59 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Linecraft Contributors
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ Fair Labor License (FLL) v1.2
2
+
3
+ © 2026 Linecraft Contributors
4
+
5
+ SPDX-License-Identifier: LicenseRef-FLL-1.2
6
+
7
+ 1. Purpose
8
+ The Fair Labor License exists to ensure that free and open software does not contribute to extreme labor inequality. When organizations compensate their workers fairly, this software is free to use. When they do not, they must purchase a license — ensuring that value created through labor is not taken without accountability.
9
+
10
+ 2. License Grant
11
+ Subject to the conditions in this license, the author(s) grant permission to any individual or organization to use, reproduce, modify, and distribute this software.
12
+
13
+ 3. Evaluation Use Exception
14
+ Anyone may download, install, and use the software solely for evaluation and testing purposes. Evaluation use may not exceed 90 days and may not include operational, commercial, or production use.
15
+
16
+ 4. Fair Compensation Condition (Eligibility for Free Use)
17
+ This software is free to use for any individual or organization that meets at least one of the following conditions at the time of operational use:
18
+
19
+ a. Individuals
20
+ The individual's net worth is under 5 million USD.
21
+
22
+ b. Organizations
23
+ The organization is Fair Labor Compliant, defined as:
24
+ - The CEO's (or highest-paid executive's) total annual compensation is no more than fifteen (15) times the total annual compensation of the organization's median employee, and
25
+ - Eligibility is assessed on a consolidated basis, including all parent and subsidiary entities under common control or brand identity.
26
+
27
+ Definitions
28
+ - "Total annual compensation" includes wages, bonuses, overtime, equity or stock-based compensation, and employer-provided benefits.
29
+ - "Median employee" refers to the worker whose compensation is the exact midpoint of all workers, including part-time and contract labor when they constitute a majority of operational personnel.
30
+ - "Operational use" means deployment or use of the software in any product, system, or service that provides business value, revenue, or ongoing internal operations beyond evaluation, whether used directly or indirectly, including when incorporated as a dependency or component of another product, system, or service.
31
+
32
+ 5. Paid License Requirement
33
+ If an individual or organization does not meet the Fair Compensation Condition at the time of operational use, they must obtain a paid license from the author(s) or an authorized licensing provider such as fllicense.org before such use begins.
34
+
35
+ Unauthorized operational use constitutes copyright infringement.
36
+
37
+ 6. Self-Attestation and Documentation
38
+ Licensees utilizing the software under the free-use provisions must self-attest compliance and maintain documentation supporting eligibility. Upon request by the author(s) or a licensing provider, documentation must be provided within 30 days.
39
+
40
+ Failure to provide documentation is considered a material breach of this license.
41
+
42
+ 7. Change in Eligibility / Cure Period
43
+ If a licensee's eligibility changes, they must:
44
+ - Either purchase a paid license within 30 days, or
45
+ - Immediately cease operational use of the software.
46
+
47
+ Restoring eligibility restores the rights granted under this license.
48
+
49
+ 8. No Misrepresentation
50
+ Licensees may not claim to be Fair Labor Compliant, nor use the Fair Labor License name or abbreviations in sales, marketing, or investor materials, unless they meet the Fair Compensation Condition.
51
+
52
+ 9. No Warranty
53
+ This software is provided "as is", without warranty of any kind, express or implied, including merchantability, fitness for a particular purpose, and noninfringement. Use is at your own risk.
54
+
55
+ 10. Limitation of Liability
56
+ In no event shall the author(s) be liable for any claim, damages, or other liability arising from the software or its use.
57
+
58
+ 11. Governing Law
59
+ This license is governed by the copyright law applicable in the jurisdiction of the author(s).
package/README.md CHANGED
@@ -142,6 +142,36 @@ ref.delete(); // Remove it
142
142
  r.destroy(true); // Clean up and restore terminal (true = clear first)
143
143
  ```
144
144
 
145
+ ## Semantic Themes
146
+
147
+ Linecraft includes a built-in semantic theme system that automatically adapts colors based on whether the terminal is in light or dark mode. Instead of hardcoding ANSI colors, you can use semantic tokens:
148
+
149
+ - `base`: The default text color (gray in both themes)
150
+ - `muted`: Dimmed text for line numbers or separators (dimmed white on dark, dimmed gray on light)
151
+ - `highlight`: Emphasized text (white on dark, bold black on light)
152
+ - `accent`: Primary accent color (bold blue in both themes)
153
+ - `location`: For file paths and locations (magenta in both themes)
154
+ - `success`: Success messages (bright green on dark, green on light)
155
+ - `warning`: Warning messages (bright yellow on dark, bright magenta on light)
156
+ - `error`: Error messages (bright red on dark, red on light)
157
+ - `info`: Informational messages (blue in both themes)
158
+
159
+ You can use these tokens anywhere a `Color` is expected:
160
+
161
+ ```typescript
162
+ import { Styled } from 'linecraft';
163
+
164
+ // Automatically uses appropriate color based on terminal theme
165
+ const text = Styled({ color: 'base' }, 'Auto-themed text');
166
+ const error = Styled({ color: 'error' }, 'Error message');
167
+ const path = Styled({ color: 'location' }, '/path/to/file.ts');
168
+
169
+ // You can also resolve them manually if needed
170
+ import { autoColor, autoStyle } from 'linecraft';
171
+ const color = autoColor('warning'); // Returns just the color
172
+ const style = autoStyle('accent'); // Returns full TextStyle (color, bold, etc.)
173
+ ```
174
+
145
175
  ## Components
146
176
 
147
177
  ### Styled
@@ -193,7 +223,7 @@ r.set(Section(
193
223
 
194
224
  ### CodeDebug
195
225
 
196
- Display code errors and warnings with line numbers, context, and clickable file paths.
226
+ Display code errors and warnings with line numbers, context, and clickable file paths. Perfect for linters, compilers, and development tools that need to show diagnostic information.
197
227
 
198
228
  ![CodeDebug Example](https://raw.githubusercontent.com/matthew-dean/linecraft/main/docs/examples/code-debug.gif)
199
229
 
@@ -209,6 +239,8 @@ r.set(CodeDebug({
209
239
  lineBefore: ' async function load() {',
210
240
  lineAfter: ' return process(result);',
211
241
  message: 'Type error: fetchData is not defined',
242
+ errorCode: 'typescript(2304)', // Optional: error code with underline
243
+ shortMessage: 'not defined', // Optional: short message connected to underline
212
244
  filePath: 'src/loaders/data.ts',
213
245
  fullPath: '/absolute/path/to/src/loaders/data.ts',
214
246
  baseDir: process.cwd(),
@@ -217,12 +249,14 @@ r.set(CodeDebug({
217
249
  ```
218
250
 
219
251
  **Features:**
220
- - Automatic line number coloring (adapts to dark/light terminals)
221
- - Responsive truncation with ellipsis
222
- - Curved underlines for error ranges
223
- - Message wrapping
224
- - Clickable file paths (OSC 8 links)
225
- - Context lines (before/after)
252
+ - **OSC 8 Hyperlinks**: File paths are clickable in modern terminals (VS Code, iTerm2, etc.). Ctrl+Click (or Cmd+Click) opens the file at the correct line and column.
253
+ - **Smart Line Overflow**: Long code lines automatically truncate with ellipsis while keeping the error range visible. Supports ellipsis at start, end, or both sides.
254
+ - **Error Range Highlighting**: The error range (startColumn to endColumn) is highlighted with a brighter color for easy identification.
255
+ - **Context Lines**: Show lines before and after the error for better context (slightly dimmed for visual hierarchy).
256
+ - **Message Wrapping**: Long error messages wrap across multiple lines while preserving ANSI styling and color codes.
257
+ - **Terminal Theme Adaptation**: Line numbers and colors adapt to dark/light terminal themes automatically.
258
+ - **Curved Underlines**: Visual indicators with curved edges (┖─┚) point to the exact error location, with optional T-bar for short messages.
259
+ - **Responsive Layout**: Automatically adjusts to terminal width, truncating paths and code as needed.
226
260
 
227
261
  ### Spinner
228
262
 
@@ -424,6 +458,15 @@ Contributions welcome! Please open an issue or PR.
424
458
 
425
459
  ## License
426
460
 
427
- This project is licensed under the **MIT License**.
461
+ This project is licensed under the **Fair Labor License (FLL) v1.2**.
462
+
463
+ - If you are an individual with a net worth under **$5M USD**, or
464
+ - Your organization is **Fair Labor Compliant** (your CEO or highest-paid executive makes no more than **15×** your median employee's total annual compensation),
465
+
466
+ then you may use this software **for free**, subject to the terms of the license.
467
+
468
+ If you do **not** meet these conditions and use this software in production or for business value, you must obtain a **paid license**, for example via [fllicense.org](https://fllicense.org).
469
+
470
+ You may freely evaluate and test this software for up to **90 days** before deciding.
428
471
 
429
472
  See the full license text in [`LICENSE`](./LICENSE).
@@ -21,6 +21,8 @@ export interface CodeDebugOptions {
21
21
  errorCode?: string;
22
22
  /** Short message to show connected to underline (optional) */
23
23
  shortMessage?: string;
24
+ /** Placement of short message: 'left' or 'right' (default: 'right', auto: 'left' when target is near end of long line) */
25
+ shortMessagePlacement?: 'left' | 'right' | 'auto';
24
26
  /** Short file path to display */
25
27
  filePath: string;
26
28
  /** Full resolved file path for clickable link */
@@ -1 +1 @@
1
- {"version":3,"file":"code-debug.d.ts","sourceRoot":"","sources":["../../src/components/code-debug.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAiB,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAWhE,MAAM,MAAM,aAAa,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAEzD,MAAM,WAAW,gBAAgB;IAC/B,+CAA+C;IAC/C,SAAS,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,WAAW,EAAE,MAAM,CAAC;IACpB,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,wDAAwD;IACxD,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,sCAAsC;IACtC,SAAS,EAAE,MAAM,CAAC;IAClB,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,2DAA2D;IAC3D,OAAO,EAAE,MAAM,CAAC;IAChB,qHAAqH;IACrH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8DAA8D;IAC9D,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iCAAiC;IACjC,QAAQ,EAAE,MAAM,CAAC;IACjB,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,mDAAmD;IACnD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,6CAA6C;IAC7C,IAAI,CAAC,EAAE,aAAa,C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