@_linked/react 0.0.1 → 1.0.0-next.20260212050543

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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,17 @@
1
+ # Changelog
2
+
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - [#1](https://github.com/Semantu/linked-react/pull/1) [`4ef2ccf`](https://github.com/Semantu/linked-react/commit/4ef2ccf954629e43b6ddc995766d8e26244130ca) Thanks [@flyon](https://github.com/flyon)! - update to major
8
+
9
+ ### 1.0.0 (from LINCD.js)
10
+
11
+ Initial extraction from the LINCD monolith. Moves React-specific linked component wrappers into a standalone package.
12
+
13
+ - `linkedComponent(...)` and `linkedSetComponent(...)` extracted from `lincd`.
14
+ - `LinkedComponentClass` base class for class-based linked components.
15
+ - `useStyles(...)` hook for component styling.
16
+ - Pagination API (`nextPage`, `previousPage`, `setPage`, `setLimit`) on linked set components.
17
+ - `_refresh(updatedProps?)` for optimistic UI updates on linked components.
package/README.md CHANGED
@@ -239,12 +239,4 @@ npm test
239
239
 
240
240
  ## Changelog
241
241
 
242
- ### 1.0.0 (from LINCD.js)
243
-
244
- Initial extraction from the LINCD monolith. Moves React-specific linked component wrappers into a standalone package.
245
-
246
- - `linkedComponent(...)` and `linkedSetComponent(...)` extracted from `lincd`.
247
- - `LinkedComponentClass` base class for class-based linked components.
248
- - `useStyles(...)` hook for component styling.
249
- - Pagination API (`nextPage`, `previousPage`, `setPage`, `setLimit`) on linked set components.
250
- - `_refresh(updatedProps?)` for optimistic UI updates on linked components.
242
+ See [CHANGELOG.md](./CHANGELOG.md).
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@_linked/react",
3
- "version": "0.0.1",
3
+ "version": "1.0.0-next.20260212050543",
4
4
  "license": "MIT",
5
5
  "description": "React bindings for @_linked/core",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/Semantu/linked-react.git"
9
+ },
6
10
  "main": "lib/cjs/index.js",
7
11
  "module": "lib/esm/index.js",
8
12
  "exports": {
@@ -24,6 +28,16 @@
24
28
  ]
25
29
  }
26
30
  },
31
+ "publishConfig": {
32
+ "access": "public",
33
+ "provenance": true
34
+ },
35
+ "files": [
36
+ "lib",
37
+ "README.md",
38
+ "CHANGELOG.md",
39
+ "LICENSE"
40
+ ],
27
41
  "scripts": {
28
42
  "build": "npx rimraf ./lib && npx tsc -p tsconfig-cjs.json && npx tsc -p tsconfig-esm.json && node ./scripts/dual-package.js",
29
43
  "compile": "echo '💫 Compiling CJS' && npx tsc -p tsconfig-cjs.json && echo '💫 Compiling ESM' && npx tsc -p tsconfig-esm.json",
@@ -38,6 +52,8 @@
38
52
  "react-usestateref": "^1.0.8"
39
53
  },
40
54
  "devDependencies": {
55
+ "@changesets/changelog-github": "^0.5.2",
56
+ "@changesets/cli": "^2.29.8",
41
57
  "@_linked/core": "^1.0.0",
42
58
  "@_linked/rdf-mem-store": "^1.0.0",
43
59
  "@testing-library/react": "^14.2.1",
@@ -1,20 +0,0 @@
1
- /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
2
- module.exports = {
3
- preset: 'ts-jest',
4
- testEnvironment: 'jsdom',
5
- rootDir: '../src/tests',
6
- testMatch: ['**/*.test.ts', '**/*.test.tsx'],
7
- transform: {
8
- '^.+\\.(ts|tsx)$': [
9
- 'ts-jest',
10
- {
11
- tsconfig: '<rootDir>/../../.context/tsconfig-repro-bundler.json',
12
- },
13
- ],
14
- },
15
- moduleNameMapper: {
16
- '^(\\.{1,2}/.*)\\.js$': '$1',
17
- '^@_linked/react/(.*)$': '<rootDir>/../$1',
18
- '^@_linked/react$': '<rootDir>/../index',
19
- },
20
- };
@@ -1,20 +0,0 @@
1
- /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
2
- module.exports = {
3
- preset: 'ts-jest',
4
- testEnvironment: 'jsdom',
5
- rootDir: '../src/tests',
6
- testMatch: ['**/*.test.ts', '**/*.test.tsx'],
7
- transform: {
8
- '^.+\\.(ts|tsx)$': [
9
- 'ts-jest',
10
- {
11
- tsconfig: '<rootDir>/../../.context/tsconfig-repro-node-modules-paths.json',
12
- },
13
- ],
14
- },
15
- moduleNameMapper: {
16
- '^(\\.{1,2}/.*)\\.js$': '$1',
17
- '^@_linked/react/(.*)$': '<rootDir>/../$1',
18
- '^@_linked/react$': '<rootDir>/../index',
19
- },
20
- };
package/.context/notes.md DELETED
File without changes
package/.context/todos.md DELETED
File without changes
@@ -1,14 +0,0 @@
1
- {
2
- "extends": "../tsconfig.json",
3
- "compilerOptions": {
4
- "baseUrl": "../",
5
- "module": "esnext",
6
- "moduleResolution": "bundler",
7
- "paths": {
8
- "@_linked/react": ["./src/index"],
9
- "@_linked/react/*": ["./src/*"]
10
- }
11
- },
12
- "include": ["../src/**/*.ts", "../src/**/*.tsx"],
13
- "exclude": []
14
- }
@@ -1,12 +0,0 @@
1
- {
2
- "extends": "../tsconfig.json",
3
- "compilerOptions": {
4
- "baseUrl": "../",
5
- "paths": {
6
- "@_linked/react": ["./src/index"],
7
- "@_linked/react/*": ["./src/*"]
8
- }
9
- },
10
- "include": ["../src/tests/react-component-integration.test.tsx"],
11
- "exclude": []
12
- }
@@ -1,16 +0,0 @@
1
- {
2
- "extends": "../tsconfig.json",
3
- "compilerOptions": {
4
- "baseUrl": "../",
5
- "paths": {
6
- "@_linked/core": ["./node_modules/@_linked/core/lib/esm/index.d.ts"],
7
- "@_linked/core/*": ["./node_modules/@_linked/core/lib/esm/*"],
8
- "@_linked/rdf-mem-store": ["./node_modules/@_linked/rdf-mem-store/lib/esm/index.d.ts"],
9
- "@_linked/rdf-mem-store/*": ["./node_modules/@_linked/rdf-mem-store/lib/esm/*"],
10
- "@_linked/react": ["./src/index"],
11
- "@_linked/react/*": ["./src/*"]
12
- }
13
- },
14
- "include": ["../src/tests/react-component-integration.test.tsx"],
15
- "exclude": []
16
- }
@@ -1,14 +0,0 @@
1
- {
2
- "extends": "../tsconfig.json",
3
- "compilerOptions": {
4
- "baseUrl": "../",
5
- "module": "Node16",
6
- "moduleResolution": "Node16",
7
- "paths": {
8
- "@_linked/react": ["./src/index"],
9
- "@_linked/react/*": ["./src/*"]
10
- }
11
- },
12
- "include": ["../src/tests/react-component-integration.test.tsx"],
13
- "exclude": []
14
- }
package/AGENTS.md DELETED
@@ -1,59 +0,0 @@
1
- # AGENTS.md — @_linked/react repository
2
-
3
- ## Repository structure
4
-
5
- Single-package repository for `@_linked/react` (React bindings such as `linkedComponent` and `linkedSetComponent`). Runtime dependency target is `@_linked/core`; tests may also use `@_linked/rdf-mem-store`.
6
-
7
- Tests: `npm test`
8
-
9
- ## Agent docs (`docs/`)
10
-
11
- Files are numbered with a 3-digit prefix for ordering. Names should be explicit about contents (lowercase-dash format). Every file starts with YAML frontmatter:
12
-
13
- ```yaml
14
- ---
15
- summary: One-line description of what this document covers
16
- packages: [core, react]
17
- ---
18
- ```
19
-
20
- ```bash
21
- ls docs/ # list all docs
22
- head -4 docs/*.md # get summaries (or replace * with a specific file)
23
- ```
24
-
25
- Each package also has a `README.md` with API docs and a `## Changelog` at the bottom.
26
-
27
- ## Planning and implementation workflow
28
-
29
- ### When to plan
30
-
31
- Any task that requires significant code changes requires a plan. Simple checks, info gathering, and discussions do not. If it's not clear (small code changes), ask the user if he wants to plan first.
32
-
33
- ### Creating a plan
34
-
35
- 1. **Inspect the relevant code thoroughly** before writing anything. Read the source files, tests, and existing docs that relate to the task.
36
- 2. Create a new doc in `docs/` with the next 3-digit prefix (e.g. `005-add-filter-support.md`). Start with YAML frontmatter.
37
- 3. Write the plan with these sections:
38
- - **Key considerations and choices** — tradeoffs, open questions, alternatives
39
- - **Potential problems** — what could go wrong, edge cases
40
- - **Phases** — ordered list of implementation steps. Each phase has a clear scope and describes how it will be validated. Small tasks: 1-2 phases. Larger tasks: more.
41
- 4. **Ask the user to review the plan before implementing.**
42
-
43
- ### Implementing phases
44
-
45
- - **One commit per phase.** Include the plan doc update (marking the phase complete) in the same commit.
46
- - **Every phase must be validated** — at minimum one relevant passing test.
47
- - **After each phase, report to the user:**
48
- - What was done
49
- - Any deviations from the plan
50
- - Problems encountered
51
- - Validation results (pass/fail counts and what was tested)
52
- - What you plan to do next
53
-
54
- ### Wrapping up
55
-
56
- Before committing final changes or preparing a PR:
57
-
58
- 1. **Consolidate the plan doc** — collapse alternatives into the choices that were made, summarize implementation details and breaking changes, keep a brief problems section if relevant, remove anything redundant for future readers.
59
- 2. **Update `## Changelog`** in each affected package's `README.md` — user-facing entry covering behavior changes, new APIs, breaking changes, and migration steps.
@@ -1,361 +0,0 @@
1
- ---
2
- summary: Extract @_linked/react from the LINCD monolith. Covers linkedComponent, linkedSetComponent, LinkedComponentClass, useStyles, and React-specific tests.
3
- packages: [react]
4
- ---
5
-
6
- # @_linked/react — extraction plan (rewrite)
7
-
8
- ## Goal
9
-
10
- Create a new package at `rebrand/react` named `@_linked/react` that contains the React-specific functionality from legacy `src/`, while keeping behavior as close as possible to 1:1.
11
-
12
- Scope for this extraction:
13
- - `linkedComponent` / `linkedSetComponent` and their types/helpers.
14
- - `LinkedComponentClass`.
15
- - React utilities/hooks that belong with component integration.
16
- - React-focused tests from `src/tests/utils/query-tests.tsx` (at minimum the React integration section), plus additional tests for uncovered React behavior.
17
-
18
- Hard constraints:
19
- - Runtime dependency target: `@_linked/core` only.
20
- - Tests may use in-memory store package (`@_linked/in-mem-store` requested; current repo package is `@_linked/rdf-mem-store`).
21
- - No intentional functionality changes without explicit user approval.
22
-
23
- ## Source Inventory (Legacy to Extract)
24
-
25
- Primary source files in root `src/`:
26
- - `src/utils/LinkedComponent.ts`
27
- - `src/utils/LinkedComponentClass.tsx`
28
- - `src/utils/Hooks.ts`
29
- - `src/package.ts` (exports for linked decorators/helpers)
30
- - `src/tests/query.test.tsx`
31
- - `src/tests/utils/query-tests.tsx`
32
- - `src/tests/components.test.tsx` (mostly commented; keep as historical reference, not a strong validation source)
33
-
34
- Potentially relevant legacy type surface:
35
- - `src/interfaces/Component.ts` (legacy/possibly unused, but exported path compatibility may matter)
36
-
37
- ## Important Core/Mem-Store Notes (for migration)
38
-
39
- From `rebrand/core/README.md` changelog and current code:
40
- - Core has moved to `NodeReferenceValue` (`{id: string}`) APIs.
41
- - Core no longer ships RDF model classes (`NamedNode`, `Literal`, `Quad`, etc.).
42
- - Shape instances no longer implement RDF-backed instance graph methods.
43
- - Query tracing has changed (proxy-based; no `TraceShape`/`TestNode` in core path).
44
- - Core package registration (`linkedPackage`) no longer includes React component factories; React must provide these.
45
- - Core still supports `preloadFor(...)`/`BoundComponent` query linking (via component-like objects exposing `.query`).
46
-
47
- From `rebrand/rdf-mem-store/README.md`:
48
- - RDF models and graph mutation APIs live here (`NamedNode`, `Literal`, etc.).
49
- - `InMemoryStore` integrates with core via `LinkedStorage.setDefaultStore(...)`.
50
- - `toNamedNode(...)` bridges `NodeReferenceValue` to RDF model nodes.
51
- - No explicit changelog section found; treat README API docs as current contract.
52
-
53
- ## Package Structure Target (match existing rebrand package style)
54
-
55
- `rebrand/react` will mirror `rebrand/core` + `rebrand/rdf-mem-store` setup:
56
- - `package.json` with dual CJS/ESM exports and aligned scripts.
57
- - `tsconfig.json`, `tsconfig-cjs.json`, `tsconfig-esm.json`, and `tsconfig-test.json`.
58
- - `jest.config.js`.
59
- - `scripts/dual-package.js`.
60
- - `src/**` with React runtime code and `src/tests/**` with TSX tests.
61
-
62
- Workspace wiring:
63
- - Add `react` to `rebrand/package.json` workspaces list.
64
-
65
- ## Risk Register / Potential Problems
66
-
67
- 1. Dependency-name mismatch:
68
- - Requested test dependency is `@_linked/in-mem-store`, but repo currently contains `rebrand/rdf-mem-store` as `@_linked/rdf-mem-store`.
69
-
70
- 2. Legacy API mismatch:
71
- - Legacy React code references RDF models and collection classes from monolithic `src/`; core no longer exports them.
72
-
73
- 3. Hooks compatibility risk:
74
- - Legacy hooks (`useWatchProperty*`) depend on change-listener APIs from legacy model/shape runtime that are not present in core.
75
-
76
- 4. Test fixture migration risk:
77
- - Legacy `query-tests.tsx` builds data through old shape instance mutators; new extraction should seed test data via mem-store APIs compatible with core.
78
-
79
- 5. Packaging/global registration drift:
80
- - `linkedPackage('lincd')` naming and module tree expectations may need explicit confirmation for `@_linked/react`.
81
-
82
- ## Phase Plan
83
-
84
- ### Phase 1 — Scaffold `@_linked/react` package
85
- Objective:
86
- - Create package skeleton and tooling that matches `rebrand/core`/`rebrand/rdf-mem-store`.
87
-
88
- Tasks:
89
- - Create `rebrand/react` directories and config files.
90
- - Configure package name `@_linked/react`.
91
- - Add workspace entry in `rebrand/package.json`.
92
- - Add build/compile/test scripts and dual-package script.
93
- - Set Jest to React-capable test environment (`jsdom`) with `ts-jest`.
94
-
95
- Validation:
96
- - Package installs and TypeScript config resolves.
97
- - `npm/yarn test` command can run Jest (even if tests are placeholders at this stage).
98
-
99
- Deliverable:
100
- - Empty-but-buildable React package scaffold.
101
-
102
- ### Phase 2 — Migrate runtime React APIs (no behavior changes)
103
- Objective:
104
- - Port runtime React functionality from legacy source to `rebrand/react/src`.
105
-
106
- Tasks:
107
- - Port `linkedComponent` / `linkedSetComponent` implementation and types.
108
- - Port `LinkedComponentClass`.
109
- - Port React hooks/utilities (`Hooks.ts`) with minimal required adaptation.
110
- - Port/create package exports (`src/package.ts`, `src/index.ts`) for React API surface.
111
- - Update imports to use `@_linked/core` paths and local react package files.
112
-
113
- Guardrail:
114
- - Only adjust imports/types/compatibility adapters required by extracted architecture.
115
- - If behavior changes seem unavoidable, stop and ask user before proceeding.
116
-
117
- Validation:
118
- - Type-check passes for migrated files.
119
- - Basic smoke test(s) compile against the new exports.
120
-
121
- Deliverable:
122
- - First working runtime API for `@_linked/react`.
123
-
124
- ### Phase 3 — Migrate and stabilize React tests
125
- Objective:
126
- - Port React tests from legacy suite and make them pass with core + mem-store integration.
127
-
128
- Tasks:
129
- - Bring over `query.test.tsx`/`utils/query-tests.tsx` React-focused tests (at minimum section "6. React Component Integration").
130
- - Keep test logic as close as possible to legacy behavior.
131
- - Build fixture/seeding setup using mem-store APIs (`NamedNode`/`Literal`/`toNamedNode`) and core shapes.
132
- - Configure Jest path aliases so tests use local `rebrand/core/src`, `rebrand/react/src`, and mem-store package source.
133
- - Add additional tests where React behavior is not covered (e.g. loading state, named-prop set query mapping, preload integration).
134
-
135
- Validation:
136
- - At least one React integration test passes at each sub-step.
137
- - Final phase target: React integration suite passes in the new package.
138
-
139
- Deliverable:
140
- - Passing React test suite that preserves legacy behavior expectations.
141
-
142
- ### Phase 4 — Integration verification and docs
143
- Objective:
144
- - Verify package interoperability and document migration outcomes.
145
-
146
- Tasks:
147
- - Run package-level build + tests for `rebrand/react`.
148
- - Run cross-package check(s) proving `@_linked/react` works with `@_linked/core` and mem-store in tests.
149
- - Add/update `README.md` in `rebrand/react` with usage, package split notes, and known constraints.
150
- - Update this plan file with completion state + commit hashes.
151
-
152
- Validation:
153
- - Build passes.
154
- - React test suite passes.
155
- - Documented import/migration guidance is present.
156
-
157
- Deliverable:
158
- - Ready-to-review `@_linked/react` extraction with evidence.
159
-
160
- ## Working Rules (must be followed during execution)
161
-
162
- - One commit per phase/sub-phase. Update the plan to mark completion before committing so the work + plan update are in the same commit.
163
- - If a commit hash needs to be added later, the plan-only tweak can be bundled into the next phase’s commit (no extra immediate commit).
164
- - After each phase/sub-phase, validate the work. If it’s a test-related step, validation must include at least one passing relevant test.
165
- - After each run, report:
166
- - What was done.
167
- - Problems encountered.
168
- - Changes not originally in the plan.
169
- - Validation details with explicit pass/fail counts and what was tested.
170
- - After each phase/sub-phase, commit changes and update this plan to indicate progress.
171
- - If a revert is needed later, either commit a follow-up revert/fix or reset to a previous commit if more applicable.
172
- - In every status update, always state what the next step entails and include its exact phase/sub-phase title.
173
-
174
- ## Progress Tracking Template
175
-
176
- For each completed phase/sub-phase, append:
177
- - Status: `completed` / `in progress` / `blocked`
178
- - Commit: `<hash>`
179
- - Summary: `<1-3 bullets>`
180
- - Validation:
181
- - Tests passed: `<n>`
182
- - Tests failed: `<n>`
183
- - Command(s): `<exact command>`
184
- - Deviations from plan: `<none or list>`
185
- - Next step: `<exact next phase/sub-phase title>`
186
-
187
- ## Progress Log
188
-
189
- ### Phase 1 — Scaffold `@_linked/react` package
190
- - Status: `completed`
191
- - Commit: `1242c6f`
192
- - Summary:
193
- - Created `rebrand/react` package scaffold with package metadata, dual-output build scripts, TS/Jest config, and starter source files.
194
- - Added `react` to `rebrand/package.json` workspaces.
195
- - Added a Jest smoke test to validate TS-Jest + JSDOM wiring.
196
- - Validation:
197
- - Tests passed: `1`
198
- - Tests failed: `0`
199
- - Command(s):
200
- - `npm run compile` (in `rebrand/react`) -> pass
201
- - `npm test` (in `rebrand/react`) -> pass
202
- - Deviations from plan:
203
- - Added local TypeScript path mapping to `@_linked/core` in `rebrand/react/tsconfig.json` so compile works before core is built.
204
- - Used local npm cache (`npm install --cache ./.npm-cache`) due permission issue in `~/.npm`.
205
- - Next step: `Phase 2 — Migrate runtime React APIs (no behavior changes)`
206
-
207
- ### Phase 2 — Migrate runtime React APIs (no behavior changes)
208
- - Status: `completed`
209
- - Commit: `ce4af64`
210
- - Summary:
211
- - Added core-compatible React runtime implementation in `rebrand/react/src/utils/LinkedComponent.ts` for `linkedComponent` and `linkedSetComponent`.
212
- - Added `rebrand/react/src/utils/LinkedComponentClass.tsx` and slimmed hooks to `useStyles` only (`rebrand/react/src/utils/Hooks.ts`), removing legacy watch APIs per direction.
213
- - Updated package surface (`rebrand/react/src/package.ts`, `rebrand/react/src/index.ts`) to expose React APIs under package tree `@_linked/react`.
214
- - Validation:
215
- - Tests passed: `3`
216
- - Tests failed: `0`
217
- - Command(s):
218
- - `npm run compile` (in `rebrand/react`) -> pass
219
- - `npm test` (in `rebrand/react`) -> pass
220
- - Deviations from plan:
221
- - Added a focused runtime test file `rebrand/react/src/tests/linked-component-runtime.test.tsx` already in Phase 2 to validate migrated runtime behavior before larger Phase 3 test porting.
222
- - Next step: `Phase 3 — Migrate and stabilize React tests`
223
-
224
- ### Phase 3 — Migrate and stabilize React tests
225
- - Status: `completed`
226
- - Commit: `c27016e`
227
- - Summary:
228
- - Ported the legacy React integration tests (section `6. React Component Integration`) into `rebrand/react/src/tests/query-react-integration.test.tsx` with structure and assertions kept close to the original.
229
- - Wired tests to `@_linked/rdf-mem-store` by seeding graph data using `NamedNode`/`Literal` and resolving queries through an `InMemoryStore`-backed query parser.
230
- - Updated React runtime types to support typed `preloadFor(...)` and object-query `linkedSetComponent({persons: query}, ...)` test cases.
231
- - Validation:
232
- - Tests passed: `12`
233
- - Tests failed: `0`
234
- - Command(s):
235
- - `npm run compile` (in `rebrand/react`) -> pass
236
- - `npm test -- --runInBand` (in `rebrand/react`) -> pass
237
- - Deviations from plan:
238
- - Kept the Phase 2 runtime smoke/integration tests alongside the ported legacy integration file to preserve incremental validation.
239
- - Next step: `Phase 4 — Integration verification and docs`
240
-
241
- ### Phase 4 — Integration verification and docs
242
- - Status: `completed`
243
- - Commit: `85864f5`
244
- - Summary:
245
- - Added `rebrand/react/README.md` documenting package usage, dependencies, and both supported linked set component formats.
246
- - Verified package-level build + test for `@_linked/react`.
247
- - Re-ran core tests and confirmed no duplicate package-registration warning remains after moving core to a shared package singleton.
248
- - Validation:
249
- - Tests passed: `129`
250
- - Tests failed: `0`
251
- - Suites passed: `7`
252
- - Suites skipped: `1`
253
- - Command(s):
254
- - `npx jest --config jest.config.js --runInBand` (in `rebrand/core`) -> pass (`4 passed`, `1 skipped`, `98 passed tests`)
255
- - `npx tsc -p tsconfig-cjs.json && npx tsc -p tsconfig-esm.json` (in `rebrand/core`) -> pass
256
- - `npm run build` (in `rebrand/react`) -> pass
257
- - `npm test -- --runInBand` (in `rebrand/react`) -> pass (`3 passed suites`, `12 passed tests`)
258
- - Deviations from plan:
259
- - Included additional core verification in this phase to ensure the package-registration warning was resolved end-to-end.
260
- - Next step: `Done`
261
-
262
- ### Phase 4a — README clarification follow-up
263
- - Status: `completed`
264
- - Commit: `8c9ed38`
265
- - Summary:
266
- - Expanded `rebrand/react/README.md` introduction to explain query DSL to React-props mapping and linked to the core DSL section.
267
- - Documented `@_linked/rdf-mem-store` as the simple starter store and showed `LinkedStorage.setDefaultStore(...)` setup.
268
- - Removed watch-hook mention from README notes.
269
- - Validation:
270
- - Tests passed: `12`
271
- - Tests failed: `0`
272
- - Command(s):
273
- - `npm test -- --runInBand` (in `rebrand/react`) -> pass (`3 passed suites`, `12 passed tests`)
274
- - Deviations from plan:
275
- - Added a post-phase README sub-phase for clarity updates requested after Phase 4 completion.
276
- - Next step: `Done`
277
-
278
- ### Phase 4b — Runtime behavior docs follow-up
279
- - Status: `completed`
280
- - Commit: `6db3a5e`
281
- - Summary:
282
- - Documented loading/render lifecycle for both `linkedComponent(...)` and `linkedSetComponent(...)`, including first render loading state and rerender after query resolution.
283
- - Documented fixed loading fallback element (`<div class="ld-loader" role="status" aria-label="Loading" />`) and clarified that replacement is not currently configurable by API.
284
- - Added docs for `_refresh(updatedProps?)`, `of` vs internal `source/sources` mapping, and a full pagination example with `nextPage`, `previousPage`, `setPage`, and `setLimit`.
285
- - Validation:
286
- - Tests passed: `12`
287
- - Tests failed: `0`
288
- - Command(s):
289
- - `npm test -- --runInBand` (in `rebrand/react`) -> pass (`3 passed suites`, `12 passed tests`)
290
- - Deviations from plan:
291
- - Added additional runtime-behavior clarification section requested after initial docs completion.
292
- - Next step: `Done`
293
-
294
- ### Phase 4c — linkedComponent docs structure follow-up
295
- - Status: `completed`
296
- - Commit: `fe0bdf2`
297
- - Summary:
298
- - Renamed the section title from "Input props and mapped props" to `linkedComponent(...)`.
299
- - Rewrote the intro paragraph to clarify `Shape.query(...)` vs `Shape.select(...)`, subject binding through `of`, and top-level query key-to-prop mapping.
300
- - Added an explicit prop breakdown list after the `linkedComponent(...)` example and moved the `@_linked/rdf-mem-store` setup example to the bottom of the README.
301
- - Validation:
302
- - Tests passed: `12`
303
- - Tests failed: `0`
304
- - Command(s):
305
- - `npm test -- --runInBand` (in `rebrand/react`) -> pass (`3 passed suites`, `12 passed tests`)
306
- - Deviations from plan:
307
- - None.
308
- - Next step: `Done`
309
-
310
- ### Phase 4d — `_refresh` semantics and ordering docs follow-up
311
- - Status: `completed`
312
- - Commit: `eac17b9`
313
- - Summary:
314
- - Clarified `_refresh(updatedProps)` semantics as patching query-result keys only, not regular/custom props.
315
- - Moved the `_refresh` section to the bottom of the `linkedComponent(...)` section before `linkedSetComponent(...)` docs.
316
- - Added explicit linked-set purpose text ("render a list of sources") and appended a README TODO list for `setOffset` and configurable loader/loading state.
317
- - Validation:
318
- - Tests passed: `12`
319
- - Tests failed: `0`
320
- - Command(s):
321
- - `npm test -- --runInBand` (in `rebrand/react`) -> pass (`3 passed suites`, `12 passed tests`)
322
- - Deviations from plan:
323
- - None.
324
- - Next step: `Done`
325
-
326
- ### Phase 5 — Gap-closure test phase
327
- - Status: `completed`
328
- - Commit: `1960921`
329
- - Summary:
330
- - Added `rebrand/react/src/tests/gap-closure-react-behavior.test.tsx` covering loading state rendering, `_refresh()` refetch flow, `_refresh(updatedProps)` local patch flow, linked-set pagination controller methods, set-input validation, query-wrapper validation, source conversion edge cases, and component metadata exposure.
331
- - Added `rebrand/react/src/tests/gap-closure-hooks-and-class.test.tsx` covering `useStyles` merge behavior and `LinkedComponentClass` source-shape lifecycle behavior.
332
- - Exercised parser-missing error path via `_refresh()` and validated emitted runtime error capture in test harness.
333
- - Validation:
334
- - Tests passed: `30`
335
- - Tests failed: `0`
336
- - Suites passed: `5`
337
- - Suites failed: `0`
338
- - Command(s):
339
- - `npm test -- --runInBand` (in `rebrand/react`) -> pass (`5 passed suites`, `30 passed tests`)
340
- - Deviations from plan:
341
- - For `linkedSetComponent(null, ...)`, runtime currently throws `TypeError: Cannot convert undefined or null to object` before hitting the friendly `'Unknown data query type'` branch; tests assert the friendly branch via a numeric invalid input.
342
- - Parser-missing validation in React event flow required window error capture in tests because the error is reported as an uncaught event error in JSDOM.
343
- - Next step: `Done`
344
-
345
- ### Phase 5a — Test-suite reorganization
346
- - Status: `completed`
347
- - Commit: `<to be filled after commit>`
348
- - Summary:
349
- - Reorganized React package tests into two files: `react-component-integration.test.tsx` and `react-component-behavior.test.tsx`.
350
- - Merged utility coverage (`useStyles`, `LinkedComponentClass`) into the behavior suite and removed `react-component-utils.test.tsx`.
351
- - Removed legacy naming (`gap closure`) from describe blocks and dropped redundant smoke/runtime test files from the package test tree.
352
- - Validation:
353
- - Tests passed: `27`
354
- - Tests failed: `0`
355
- - Suites passed: `2`
356
- - Suites failed: `0`
357
- - Command(s):
358
- - `npm test -- --runInBand` (in `rebrand/react`) -> pass (`2 passed suites`, `27 passed tests`)
359
- - Deviations from plan:
360
- - Test count reduced from prior `30` to `27` after consolidating/removing redundant smoke/runtime coverage; behavior coverage remains represented in the remaining suites.
361
- - Next step: `Done`
package/jest.config.js DELETED
@@ -1,20 +0,0 @@
1
- /** @type {import('ts-jest/dist/types').InitialOptionsTsJest} */
2
- module.exports = {
3
- preset: 'ts-jest',
4
- testEnvironment: 'jsdom',
5
- rootDir: 'src/tests',
6
- testMatch: ['**/*.test.ts', '**/*.test.tsx'],
7
- transform: {
8
- '^.+\\.(ts|tsx)$': [
9
- 'ts-jest',
10
- {
11
- tsconfig: '<rootDir>/../../tsconfig-test.json',
12
- },
13
- ],
14
- },
15
- moduleNameMapper: {
16
- '^(\\.{1,2}/.*)\\.js$': '$1',
17
- '^@_linked/react/(.*)$': '<rootDir>/../$1',
18
- '^@_linked/react$': '<rootDir>/../index',
19
- },
20
- };
@@ -1,25 +0,0 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
-
4
- const root = path.resolve(__dirname,'..');
5
- const libDir = path.join(root,'lib');
6
- const cjsDir = path.join(libDir,'cjs');
7
- const esmDir = path.join(libDir,'esm');
8
-
9
- const ensureDir = (dir) => {
10
- if (!fs.existsSync(dir)) {
11
- fs.mkdirSync(dir,{recursive: true});
12
- }
13
- };
14
-
15
- const writePackageJson = (dir,type) => {
16
- ensureDir(dir);
17
- const pkgPath = path.join(dir,'package.json');
18
- const data = {
19
- type,
20
- };
21
- fs.writeFileSync(pkgPath,JSON.stringify(data,null,2));
22
- };
23
-
24
- writePackageJson(cjsDir,'commonjs');
25
- writePackageJson(esmDir,'module');
package/src/index.ts DELETED
@@ -1,4 +0,0 @@
1
- export * from './package.js';
2
- export * from './utils/LinkedComponent.js';
3
- export * from './utils/LinkedComponentClass.js';
4
- export * from './utils/Hooks.js';