reke-ui 0.1.2 → 0.2.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.
Files changed (78) hide show
  1. package/README.md +21 -0
  2. package/cli/install-skills.mjs +169 -0
  3. package/custom-elements.json +405 -161
  4. package/dist/__type-checks__/no-lit-in-public-types.d.ts +2 -0
  5. package/dist/__type-checks__/no-lit-in-public-types.d.ts.map +1 -0
  6. package/dist/_virtual/_@oxc-project_runtime@0.137.0/helpers/esm/decorate.js +9 -0
  7. package/dist/components/reke-alert/reke-alert.d.ts.map +1 -1
  8. package/dist/components/reke-alert/reke-alert.js +32 -40
  9. package/dist/components/reke-alert/reke-alert.styles.js +7 -10
  10. package/dist/components/reke-badge/reke-badge.js +26 -40
  11. package/dist/components/reke-badge/reke-badge.styles.js +7 -10
  12. package/dist/components/reke-button/reke-button.d.ts.map +1 -1
  13. package/dist/components/reke-button/reke-button.js +41 -52
  14. package/dist/components/reke-button/reke-button.styles.js +7 -10
  15. package/dist/components/reke-card/reke-card.d.ts.map +1 -1
  16. package/dist/components/reke-card/reke-card.js +38 -58
  17. package/dist/components/reke-card/reke-card.styles.js +7 -10
  18. package/dist/components/reke-checkbox/reke-checkbox.js +40 -47
  19. package/dist/components/reke-checkbox/reke-checkbox.styles.d.ts.map +1 -1
  20. package/dist/components/reke-checkbox/reke-checkbox.styles.js +7 -9
  21. package/dist/components/reke-chip/reke-chip.d.ts.map +1 -1
  22. package/dist/components/reke-chip/reke-chip.js +42 -50
  23. package/dist/components/reke-chip/reke-chip.styles.d.ts.map +1 -1
  24. package/dist/components/reke-chip/reke-chip.styles.js +16 -13
  25. package/dist/components/reke-date-range/reke-date-range.d.ts.map +1 -1
  26. package/dist/components/reke-date-range/reke-date-range.js +240 -260
  27. package/dist/components/reke-date-range/reke-date-range.styles.d.ts.map +1 -1
  28. package/dist/components/reke-date-range/reke-date-range.styles.js +29 -16
  29. package/dist/components/reke-dialog/reke-dialog.d.ts.map +1 -1
  30. package/dist/components/reke-dialog/reke-dialog.js +52 -65
  31. package/dist/components/reke-dialog/reke-dialog.styles.d.ts.map +1 -1
  32. package/dist/components/reke-dialog/reke-dialog.styles.js +8 -10
  33. package/dist/components/reke-file-upload/reke-file-upload.d.ts.map +1 -1
  34. package/dist/components/reke-file-upload/reke-file-upload.js +62 -86
  35. package/dist/components/reke-file-upload/reke-file-upload.styles.js +7 -10
  36. package/dist/components/reke-input/reke-input.js +42 -61
  37. package/dist/components/reke-input/reke-input.styles.d.ts.map +1 -1
  38. package/dist/components/reke-input/reke-input.styles.js +8 -10
  39. package/dist/components/reke-select/reke-select.d.ts.map +1 -1
  40. package/dist/components/reke-select/reke-select.js +66 -89
  41. package/dist/components/reke-select/reke-select.styles.d.ts.map +1 -1
  42. package/dist/components/reke-select/reke-select.styles.js +9 -11
  43. package/dist/components/reke-table/reke-table.d.ts +134 -23
  44. package/dist/components/reke-table/reke-table.d.ts.map +1 -1
  45. package/dist/components/reke-table/reke-table.js +243 -143
  46. package/dist/components/reke-table/reke-table.styles.d.ts.map +1 -1
  47. package/dist/components/reke-table/reke-table.styles.js +67 -9
  48. package/dist/components/reke-textarea/reke-textarea.js +42 -61
  49. package/dist/components/reke-textarea/reke-textarea.styles.js +6 -9
  50. package/dist/components/reke-toast/reke-toast.d.ts.map +1 -1
  51. package/dist/components/reke-toast/reke-toast.js +50 -68
  52. package/dist/components/reke-toast/reke-toast.styles.d.ts.map +1 -1
  53. package/dist/components/reke-toast/reke-toast.styles.js +13 -12
  54. package/dist/components/reke-toggle/reke-toggle.js +36 -43
  55. package/dist/components/reke-toggle/reke-toggle.styles.js +7 -10
  56. package/dist/components/reke-tooltip/reke-tooltip.js +31 -47
  57. package/dist/components/reke-tooltip/reke-tooltip.styles.js +6 -9
  58. package/dist/index.d.ts +23 -23
  59. package/dist/index.d.ts.map +1 -1
  60. package/dist/index.js +15 -33
  61. package/dist/node_modules/lit/directives/ref.js +1 -0
  62. package/dist/node_modules/lit-html/async-directive.js +55 -0
  63. package/dist/node_modules/lit-html/directive-helpers.js +5 -0
  64. package/dist/node_modules/lit-html/directive.js +28 -0
  65. package/dist/node_modules/lit-html/directives/ref.js +30 -0
  66. package/dist/node_modules/lit-html/lit-html.js +234 -0
  67. package/dist/react-bridge/table.d.ts +58 -0
  68. package/dist/react-bridge/table.d.ts.map +1 -0
  69. package/dist/react-bridge/table.js +115 -0
  70. package/dist/react.d.ts +12 -26
  71. package/dist/react.d.ts.map +1 -1
  72. package/dist/react.js +110 -146
  73. package/dist/shared/base-element.js +13 -15
  74. package/dist/shared/tailwind-styles.js +6 -6
  75. package/dist/shared/tailwind.js +4 -0
  76. package/dist/tokens/reke-tokens.css +47 -0
  77. package/package.json +40 -20
  78. package/dist/shared/tailwind.css.js +0 -4
package/README.md CHANGED
@@ -106,6 +106,8 @@ function App() {
106
106
  }
107
107
  ```
108
108
 
109
+ > **Components with render props** (e.g. `Table` with `expandedRowRender` or `columns[].render`) use a React-native bridge: return `ReactNode` (JSX), pass `getRowKey` for stable keying, and never `import { html } from 'lit'` in app code. See `README-DOC.md` → reke-table → React usage, or install the agent skills below for the full contract.
110
+
109
111
  ### Vanilla JS
110
112
 
111
113
  ```html
@@ -146,6 +148,25 @@ Override any CSS custom property to match your brand:
146
148
 
147
149
  See all available tokens in [`src/tokens/reke-tokens.css`](src/tokens/reke-tokens.css).
148
150
 
151
+ ## Agent skills
152
+
153
+ reke-ui ships **LLM-first skills** that teach AI coding agents how to consume the library correctly (3-layer token system, component APIs, React bridge contract for components with render props).
154
+
155
+ ```bash
156
+ npm install reke-ui
157
+ npx reke-ui install-skills
158
+ ```
159
+
160
+ This copies three consumer skills into your project's `.claude/skills/` directory:
161
+
162
+ - `reke-ui-consumer` — install, imports, framework integration, full component reference, React bridge contract
163
+ - `reke-design-system` — 3-layer token architecture for Tailwind v4 projects (microfrontend-safe scoping)
164
+ - `reke-bridge` — when and how to bridge web components to your framework (React today; pattern documented for Vue/Svelte)
165
+
166
+ After install, ask your agent to refresh its skill index: **"update skill registry"** (or **"actualizá las skills"**). The agent will then know how to use reke-ui idiomatically — no more guessing or copy-pasted anti-patterns.
167
+
168
+ Options: `--force` reinstalls even if versions match, `--dry-run` previews without writing files.
169
+
149
170
  ## Development
150
171
 
151
172
  ```bash
@@ -0,0 +1,169 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * reke-ui install-skills
4
+ *
5
+ * Copies consumer-facing agent skills (LLM instructions) from this package
6
+ * into the current project's `.claude/skills/` directory, so any AI agent
7
+ * working in that project knows how to consume reke-ui correctly.
8
+ *
9
+ * Why this exists:
10
+ * reke-ui ships agent skills (.claude/skills/) that document its consumer
11
+ * API, the React bridge contract, and the 3-layer token system. These skills
12
+ * are LLM-first instructions — they only help when they live in a directory
13
+ * the agent scans. Library `node_modules/.../.claude/skills/` is NEVER
14
+ * scanned automatically by skill-registry. This CLI puts them where they
15
+ * belong.
16
+ *
17
+ * What it does:
18
+ * 1. Locates the reke-ui package's bundled `.claude/skills/`.
19
+ * 2. Copies CONSUMER skills only (not internal-maintainer skills) to
20
+ * `<consumer-cwd>/.claude/skills/`.
21
+ * 3. Writes a marker file with the reke-ui version so we can detect drift.
22
+ * 4. Prints next-step instructions for the user.
23
+ *
24
+ * What it does NOT do:
25
+ * - It does not invoke skill-registry. skill-registry is an agent skill,
26
+ * not a CLI tool. The user must ask their agent to update the registry
27
+ * after install (we print the exact phrase to use).
28
+ * - It does not modify package.json, tsconfig, or any project file other
29
+ * than files under `.claude/skills/reke-ui-*` and the marker.
30
+ */
31
+ import { cpSync, existsSync, mkdirSync, readFileSync, writeFileSync, rmSync } from 'node:fs';
32
+ import { dirname, join, resolve } from 'node:path';
33
+ import { fileURLToPath } from 'node:url';
34
+
35
+ const SCRIPT_DIR = dirname(fileURLToPath(import.meta.url));
36
+ // Package root is one level up from cli/
37
+ const PKG_ROOT = resolve(SCRIPT_DIR, '..');
38
+ const SOURCE_SKILLS = join(PKG_ROOT, '.claude', 'skills');
39
+
40
+ // Skills published to consumers. Internal-maintainer skills (lit-expert,
41
+ // reke-component, test-runner, a11y-checker, update-docs) are deliberately
42
+ // excluded — those only help when working ON reke-ui itself.
43
+ const CONSUMER_SKILLS = ['reke-ui-consumer', 'reke-bridge', 'reke-design-system'];
44
+
45
+ const CWD = process.cwd();
46
+ const TARGET_DIR = join(CWD, '.claude', 'skills');
47
+ const MARKER_FILE = join(CWD, '.claude', '.reke-ui-skills-version');
48
+
49
+ const args = process.argv.slice(2);
50
+ const FORCE = args.includes('--force') || args.includes('-f');
51
+ const DRY = args.includes('--dry-run') || args.includes('-n');
52
+
53
+ function log(msg) {
54
+ process.stdout.write(`${msg}\n`);
55
+ }
56
+ function warn(msg) {
57
+ process.stderr.write(`\x1b[33m${msg}\x1b[0m\n`);
58
+ }
59
+ function err(msg) {
60
+ process.stderr.write(`\x1b[31m${msg}\x1b[0m\n`);
61
+ }
62
+
63
+ function readPkgVersion() {
64
+ try {
65
+ const pkg = JSON.parse(readFileSync(join(PKG_ROOT, 'package.json'), 'utf8'));
66
+ return pkg.version || 'unknown';
67
+ } catch {
68
+ return 'unknown';
69
+ }
70
+ }
71
+
72
+ function readMarker() {
73
+ if (!existsSync(MARKER_FILE)) return null;
74
+ try {
75
+ return JSON.parse(readFileSync(MARKER_FILE, 'utf8'));
76
+ } catch {
77
+ return null;
78
+ }
79
+ }
80
+
81
+ function writeMarker(version, skills) {
82
+ writeFileSync(
83
+ MARKER_FILE,
84
+ `${JSON.stringify(
85
+ {
86
+ package: 'reke-ui',
87
+ version,
88
+ installedAt: new Date().toISOString(),
89
+ skills,
90
+ },
91
+ null,
92
+ 2,
93
+ )}\n`,
94
+ );
95
+ }
96
+
97
+ function installSkill(name, version) {
98
+ const src = join(SOURCE_SKILLS, name);
99
+ const dst = join(TARGET_DIR, name);
100
+ if (!existsSync(src)) {
101
+ warn(` ⚠ skill missing in package: ${name} (skipping)`);
102
+ return false;
103
+ }
104
+ if (existsSync(dst) && !FORCE) {
105
+ const existing = readMarker();
106
+ const sameVersion = existing && existing.version === version;
107
+ if (sameVersion) {
108
+ log(` = ${name} (already at v${version})`);
109
+ return false;
110
+ }
111
+ log(` → ${name} (updating from v${existing?.version || '?'} to v${version})`);
112
+ } else {
113
+ log(` + ${name}`);
114
+ }
115
+ if (DRY) return true;
116
+ rmSync(dst, { recursive: true, force: true });
117
+ cpSync(src, dst, { recursive: true });
118
+ return true;
119
+ }
120
+
121
+ function main() {
122
+ log('\nreke-ui install-skills');
123
+ log('───────────────────────');
124
+
125
+ if (!existsSync(SOURCE_SKILLS)) {
126
+ err(`error: source skills not found at ${SOURCE_SKILLS}`);
127
+ err('Is this a corrupted reke-ui install?');
128
+ process.exit(1);
129
+ }
130
+
131
+ const version = readPkgVersion();
132
+ log(`reke-ui version : ${version}`);
133
+ log(`target : ${TARGET_DIR}`);
134
+ if (DRY) log('mode : DRY RUN (no files written)\n');
135
+ else log('');
136
+
137
+ if (!DRY) mkdirSync(TARGET_DIR, { recursive: true });
138
+
139
+ log('skills:');
140
+ const installed = [];
141
+ for (const name of CONSUMER_SKILLS) {
142
+ const ok = installSkill(name, version);
143
+ if (ok) installed.push(name);
144
+ }
145
+
146
+ if (!DRY && installed.length > 0) {
147
+ writeMarker(version, installed);
148
+ }
149
+
150
+ log('');
151
+ if (installed.length === 0 && !DRY) {
152
+ log('Nothing to do — skills already up to date.');
153
+ log('Run with --force to reinstall.\n');
154
+ return;
155
+ }
156
+
157
+ log('Next step:');
158
+ log(' Ask your agent to regenerate the skill registry. Phrase it as:');
159
+ log(' "actualizá las skills" / "update skill registry"\n');
160
+ log('Or run any skill-registry-aware command in this project; the agent');
161
+ log('will pick up the new skills under .claude/skills/reke-ui-*\n');
162
+ }
163
+
164
+ try {
165
+ main();
166
+ } catch (e) {
167
+ err(`fatal: ${e.message || e}`);
168
+ process.exit(1);
169
+ }