@tailorkit/react 0.1.0-beta.3 → 0.1.0-beta.5

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 (41) hide show
  1. package/dist/components/context.d.ts +0 -1
  2. package/dist/components/index.d.ts +0 -1
  3. package/dist/components/render.d.ts +0 -1
  4. package/dist/components/root.d.ts +0 -1
  5. package/dist/hooks/use-apps.d.ts +0 -1
  6. package/dist/hooks/use-current-screen.d.ts +0 -1
  7. package/dist/index.d.ts +0 -1
  8. package/dist/node-store.d.ts +0 -1
  9. package/dist/primitives.d.ts +0 -1
  10. package/dist/remote-context.d.ts +0 -1
  11. package/dist/remote-view.d.ts +0 -1
  12. package/dist/tailor-kit.d.ts +0 -1
  13. package/package.json +4 -15
  14. package/dist/components/context.d.ts.map +0 -1
  15. package/dist/components/index.d.ts.map +0 -1
  16. package/dist/components/render.d.ts.map +0 -1
  17. package/dist/components/root.d.ts.map +0 -1
  18. package/dist/hooks/use-apps.d.ts.map +0 -1
  19. package/dist/hooks/use-current-screen.d.ts.map +0 -1
  20. package/dist/index.d.ts.map +0 -1
  21. package/dist/node-store.d.ts.map +0 -1
  22. package/dist/primitives.d.ts.map +0 -1
  23. package/dist/remote-context.d.ts.map +0 -1
  24. package/dist/remote-view.d.ts.map +0 -1
  25. package/dist/tailor-kit.d.ts.map +0 -1
  26. package/src/__tests__/node-store.test.ts +0 -206
  27. package/src/__tests__/primitives.test.tsx +0 -85
  28. package/src/__tests__/tailor-kit.test.tsx +0 -424
  29. package/src/__tests__/tailor-kit.types.tsx +0 -151
  30. package/src/components/context.ts +0 -21
  31. package/src/components/index.ts +0 -1
  32. package/src/components/render.tsx +0 -116
  33. package/src/components/root.tsx +0 -37
  34. package/src/hooks/use-apps.ts +0 -47
  35. package/src/hooks/use-current-screen.ts +0 -81
  36. package/src/index.ts +0 -8
  37. package/src/node-store.ts +0 -131
  38. package/src/primitives.tsx +0 -261
  39. package/src/remote-context.ts +0 -11
  40. package/src/remote-view.tsx +0 -232
  41. package/src/tailor-kit.tsx +0 -501
@@ -8,4 +8,3 @@ export interface RootTailor {
8
8
  }
9
9
  export declare const TailorRootContext: import("react").Context<TailorRootContextValue | null>;
10
10
  export declare function useTailorRootContext(component: string): TailorRootContextValue;
11
- //# sourceMappingURL=context.d.ts.map
@@ -1,2 +1 @@
1
1
  export { Root } from "./root";
2
- //# sourceMappingURL=index.d.ts.map
@@ -17,4 +17,3 @@ export type HtmlProps<TElement extends HTMLElement> = HTMLAttributes<TElement> &
17
17
  ref?: Ref<TElement>;
18
18
  };
19
19
  export {};
20
- //# sourceMappingURL=render.d.ts.map
@@ -8,4 +8,3 @@ export interface RootProps extends ComponentProps<"div"> {
8
8
  tailor: RootTailor;
9
9
  }
10
10
  export declare function Root({ apps: appsProp, children, render, tailor, ...props }: RootProps): ReactNode;
11
- //# sourceMappingURL=root.d.ts.map
@@ -10,4 +10,3 @@ export interface UseAppsResult {
10
10
  status: "error" | "idle" | "loading" | "ready";
11
11
  }
12
12
  export declare function createUseApps(store: TailorKitStore): () => UseAppsResult;
13
- //# sourceMappingURL=use-apps.d.ts.map
@@ -21,4 +21,3 @@ interface ErrorScreenOptions<TScreen extends string> {
21
21
  export type CurrentScreenOptions<TScreens extends Record<string, ScreenDefinition>, TScreen extends ScreenName<TScreens> = ScreenName<TScreens>> = TScreen extends ScreenName<TScreens> ? ReadyScreenOptions<TScreens, TScreen> | LoadingScreenOptions<TScreen> | ErrorScreenOptions<TScreen> : never;
22
22
  export declare function createUseCurrentScreen<TScreens extends Record<string, ScreenDefinition>>(store: TailorKitStore): <TScreen extends ScreenName<TScreens>>(options: CurrentScreenOptions<TScreens, TScreen>) => void;
23
23
  export {};
24
- //# sourceMappingURL=use-current-screen.d.ts.map
package/dist/index.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  export { components, createTailorKitClient } from "./tailor-kit";
2
2
  export type { AppViewProps, CurrentScreenOptions, TailorKitApp, TailorKitInstance, } from "./tailor-kit";
3
3
  export { primitives } from "./primitives";
4
- //# sourceMappingURL=index.d.ts.map
@@ -14,4 +14,3 @@ export declare class NodeStore {
14
14
  subscribeRoot(listener: Listener): () => void;
15
15
  }
16
16
  export {};
17
- //# sourceMappingURL=node-store.d.ts.map
@@ -35,4 +35,3 @@ export declare const primitives: {
35
35
  };
36
36
  export type PrimitiveStyle = CSSProperties;
37
37
  export {};
38
- //# sourceMappingURL=primitives.d.ts.map
@@ -6,4 +6,3 @@ export interface RemoteViewContext {
6
6
  store: NodeStore;
7
7
  }
8
8
  export declare const RemoteUIContext: import("react").Context<RemoteViewContext | null>;
9
- //# sourceMappingURL=remote-context.d.ts.map
@@ -12,4 +12,3 @@ interface RemoteViewProps {
12
12
  }
13
13
  export declare const RemoteView: import("react").MemoExoticComponent<({ nodeId }: RemoteViewProps) => ReactNode>;
14
14
  export {};
15
- //# sourceMappingURL=remote-view.d.ts.map
@@ -114,4 +114,3 @@ declare function createTailorKitStore(baseUrlInput: string | URL): {
114
114
  unregisterScreen: (id: symbol) => void;
115
115
  };
116
116
  export type { CurrentScreenOptions } from "./hooks/use-current-screen";
117
- //# sourceMappingURL=tailor-kit.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tailorkit/react",
3
- "version": "0.1.0-beta.3",
3
+ "version": "0.1.0-beta.5",
4
4
  "license": "AGPL-3.0-only",
5
5
  "repository": {
6
6
  "type": "git",
@@ -8,22 +8,11 @@
8
8
  "directory": "packages/react"
9
9
  },
10
10
  "files": [
11
- "dist",
12
- "src"
11
+ "dist"
13
12
  ],
14
13
  "type": "module",
15
- "imports": {
16
- "#*": [
17
- "./src/*",
18
- "./src/*.ts",
19
- "./src/*.tsx",
20
- "./src/*/index.ts",
21
- "./src/*/index.tsx"
22
- ]
23
- },
24
14
  "exports": {
25
15
  ".": {
26
- "development": "./src/index.ts",
27
16
  "types": "./dist/index.d.ts",
28
17
  "import": "./dist/index.js"
29
18
  }
@@ -34,8 +23,8 @@
34
23
  "dependencies": {
35
24
  "@floating-ui/react-dom": "^2.1.9",
36
25
  "@standard-schema/spec": "^1.1.0",
37
- "@tailorkit/core": "0.1.0-beta.3",
38
- "@tailorkit/sandbox": "0.1.0-beta.3"
26
+ "@tailorkit/core": "0.1.0-beta.5",
27
+ "@tailorkit/sandbox": "0.1.0-beta.5"
39
28
  },
40
29
  "devDependencies": {
41
30
  "@tailorkit/config": "0.0.0",
@@ -1 +0,0 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/components/context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AACvD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,YAAY,EAAE,CAAC;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,aAAa,CAAC;CAC9B;AAED,eAAO,MAAM,iBAAiB,wDAAqD,CAAC;AAEpF,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,sBAAsB,CAM9E"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"render.d.ts","sourceRoot":"","sources":["../../src/components/render.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAEV,wBAAwB,EAExB,WAAW,EACX,cAAc,EACd,YAAY,EACZ,SAAS,EACT,GAAG,EACJ,MAAM,OAAO,CAAC;AAEf,KAAK,YAAY,CAAC,QAAQ,SAAS,WAAW,IAAI,wBAAwB,CAAC,QAAQ,CAAC,GAAG;IACrF,GAAG,CAAC,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;CACpB,CAAC;AAEF,MAAM,WAAW,WAAW;IAC1B,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KAAK,EAAE,UAAU,EAA0B,MAAM,WAAW,CAAC;AAIpE,MAAM,WAAW,SAAU,SAAQ,cAAc,CAAC,KAAK,CAAC;IACtD,IAAI,CAAC,EAAE,YAAY,EAAE,CAAC;IACtB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,wBAAgB,IAAI,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,SAAS,GAAG,SAAS,CAoBjG"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-apps.d.ts","sourceRoot":"","sources":["../../src/hooks/use-apps.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAyB,cAAc,EAAE,MAAM,eAAe,CAAC;AAEzF,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,YAAY,EAAE,GAAG,SAAS,CAAC;IACjC,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,MAAM,EAAE,OAAO,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;CAChD;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,cAAc,GAAG,MAAM,aAAa,CAgBxE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"use-current-screen.d.ts","sourceRoot":"","sources":["../../src/hooks/use-current-screen.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC/D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AA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AAC;AAEZ,wBAAgB,sBAAsB,CAAC,QAAQ,SAAS,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,EACtF,KAAK,EAAE,cAAc,IAEY,OAAO,SAAS,UAAU,CAAC,QAAQ,CAAC,WAC1D,oBAAoB,CAAC,QAAQ,EAAE,OAAO,CAAC,KAC/C,IAAI,CA4BR"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACjE,YAAY,EACV,YAAY,EACZ,oBAAoB,EACpB,YAAY,EACZ,iBAAiB,GAClB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"node-store.d.ts","sourceRoot":"","sources":["../src/node-store.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAE9D,KAAK,QAAQ,GAAG,MAAM,IAAI,CAAC;AA6B3B,qBAAa,SAAS;IACpB,OAAO,CAAC,KAAK,CAAiC;IAC9C,OAAO,CAAC,UAAU,CAA6B;IAC/C,OAAO,CAAC,aAAa,CAAoC;IACzD,OAAO,CAAC,aAAa,CAAuB;IAC5C,OAAO,CAAC,MAAM,CAAuB;IAErC,KAAK,IAAI,IAAI,CAsBZ;IAED,WAAW,CAAC,IAAI,EAAE,UAAU,GAAG,IAAI,CAuClC;IAED,SAAS,IAAI,MAAM,GAAG,IAAI,CAEzB;IAED,OAAO,CAAC,EAAE,EAAE,MAAM,GAAG,UAAU,GAAG,IAAI,CAErC;IAED,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,IAAI,CAapD;IAED,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,IAAI,CAG5C;CACF"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"primitives.d.ts","sourceRoot":"","sources":["../src/primitives.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAK7D,KAAK,cAAc,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAE9C,UAAU,0BAA0B;IAClC,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,cAAc,CAAC;CACvB;AAED,eAAO,MAAM,qBAAqB,4DAAyD,CAAC;AA4K5F,eAAO,MAAM,aAAa,aAAc,MAAM,SAAS,cAAc,KAAG,MAYvE,CAAC;AAuCF,eAAO,MAAM,UAAU;aACrB,GAAG,qBAAqB;QAAE,KAAK,EAAE,cAAc,CAAC;QAAC,KAAK,EAAE;YAAE,OAAO,CAAC,EAAE,SAAS,CAAA;SAAE,CAAA;KAAE;aAKjF,IAAI,qBAAqB;QAAE,KAAK,EAAE,cAAc,CAAC;QAAC,KAAK,EAAE;YAAE,OAAO,CAAC,EAAE,SAAS,CAAA;SAAE,CAAA;KAAE;aAKlF,IAAI,qBAAqB;QAAE,KAAK,EAAE,cAAc,CAAC;QAAC,KAAK,EAAE;YAAE,OAAO,CAAC,EAAE,SAAS,CAAA;SAAE,CAAA;KAAE;aAKlF,MAAM,qBAAqB;QAAE,KAAK,EAAE,cAAc,CAAC;QAAC,KAAK,EAAE;YAAE,OAAO,CAAC,EAAE,SAAS,CAAA;SAAE,CAAA;KAAE;CAK5E,CAAC;AAEX,MAAM,MAAM,cAAc,GAAG,aAAa,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"remote-context.d.ts","sourceRoot":"","sources":["../src/remote-context.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,QAAQ,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;IACjD,KAAK,EAAE,SAAS,CAAC;CAClB;AAED,eAAO,MAAM,eAAe,mDAAgD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"remote-view.d.ts","sourceRoot":"","sources":["../src/remote-view.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAqCvC,UAAU,mBAAmB;IAC3B,MAAM,EAAE,MAAM,GAAG,GAAG,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpC,YAAY,CAAC,EAAE,MAAM,iBAAiB,CAAC;IACvC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,GAAG,GAAG,CAAC;CAC3B;AAED,wBAAgB,cAAc,CAAC,EAC7B,MAAM,EACN,UAAU,EACV,YAAY,EACZ,KAAK,EACL,UAAU,GACX,EAAE,mBAAmB,GAAG,SAAS,CA8EjC;AAqDD,UAAU,eAAe;IACvB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,UAAU,mDAAwC,eAAe,KAAG,SAAS,CAgCxF,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"tailor-kit.d.ts","sourceRoot":"","sources":["../src/tailor-kit.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,KAAK,EACV,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,cAAc,EACd,MAAM,EACN,gBAAgB,EAChB,eAA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AAK;CACV,CAAC;AAEF,wBAAgB,qBAAqB,CAAC,OAAO,SAAS,oBAAoB,EAAE,OAAO,EAAE;IACnF,OAAO,EAAE,MAAM,GAAG,GAAG,CAAC;IACtB,UAAU,CAAC,EAAE,0BAA0B,CAAC,gBAAgB,CAAC,OAAO,CAAC,CAAC,CAAC;IACnE,KAAK,CAAC,EAAE,cAAc,CAAC;CACxB,GAAG,iBAAiB,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAE5C;AA2HD,MAAM,MAAM,cAAc,GAAG,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAErE,iBAAS,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,GAAG;;0BA8D/B;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,KAAQ,OAAO,CAAC,IAAI,CAAC;qBAwC9C,OAAO,CAAC,IAAI,CAAC;iBAoCf,MAAM,KAAG,YAAY,GAAG,SAAS;mBAEjC,YAAY,EAAE;2BACN,qBAAqB;4BACpB,kBAAkB,GAAG,IAAI;2BAC1B,qBAAqB;4BAClB,IAAI,CAAC,kBAAkB,EAAE,OAAO,CAAC,KAAG,IAAI;0BAY1C,MAAM,IAAI,KAAG,CAAC,MAAM,IAAI,CAAC;2BAMxB,MAAM,KAAG,IAAI;EAMvC;AAMD,YAAY,EAAE,oBAAoB,EAAE,MAAM,4BAA4B,CAAC"}
@@ -1,206 +0,0 @@
1
- import { describe, expect, it, vi } from "vitest";
2
- import { NodeStore } from "../node-store";
3
- import type { RemoteNode } from "@tailorkit/sandbox/protocol";
4
-
5
- const textNode = (id: string, text: string): RemoteNode => ({ id, kind: "text", text });
6
-
7
- const elemNode = (
8
- id: string,
9
- type: string,
10
- props: Record<string, unknown> = {},
11
- children: RemoteNode[] = [],
12
- ): RemoteNode => ({ children, id, kind: "element", props, type });
13
-
14
- const elementWithCallback = (event: string): RemoteNode => ({
15
- callbacks: [{ callback: "onSelect", inputCount: 1, event }],
16
- children: [],
17
- id: "n",
18
- kind: "element",
19
- props: {},
20
- type: "tailorkit-button",
21
- });
22
-
23
- describe("NodeStore", () => {
24
- describe("setSnapshot", () => {
25
- it("stores all nodes from the tree", () => {
26
- const store = new NodeStore();
27
- const tree = elemNode("root", "div", {}, [textNode("t1", "hello")]);
28
- store.setSnapshot(tree);
29
-
30
- expect(store.getNode("root")).toMatchObject({ id: "root", type: "div" });
31
- expect(store.getNode("t1")).toMatchObject({ id: "t1", text: "hello" });
32
- });
33
-
34
- it("flattens nested children", () => {
35
- const store = new NodeStore();
36
- const tree = elemNode("root", "div", {}, [
37
- elemNode("child", "span", {}, [textNode("text", "hi")]),
38
- ]);
39
- store.setSnapshot(tree);
40
-
41
- expect(store.getNode("text")).toMatchObject({ text: "hi" });
42
- });
43
-
44
- it("tracks the root id", () => {
45
- const store = new NodeStore();
46
- store.setSnapshot(textNode("root", "hi"));
47
- expect(store.getRootId()).toBe("root");
48
- });
49
-
50
- it("removes stale nodes when they leave the tree", () => {
51
- const store = new NodeStore();
52
- store.setSnapshot(elemNode("root", "div", {}, [textNode("old", "gone")]));
53
- store.setSnapshot(elemNode("root", "div", {}, []));
54
-
55
- expect(store.getNode("old")).toBeNull();
56
- });
57
- });
58
-
59
- describe("subscribe", () => {
60
- it("notifies listener when a node changes", () => {
61
- const store = new NodeStore();
62
- store.setSnapshot(textNode("n1", "initial"));
63
-
64
- const listener = vi.fn();
65
- store.subscribe("n1", listener);
66
-
67
- store.setSnapshot(textNode("n1", "updated"));
68
- expect(listener).toHaveBeenCalledTimes(1);
69
- });
70
-
71
- it("does not notify when node content is unchanged", () => {
72
- const store = new NodeStore();
73
- store.setSnapshot(textNode("n1", "same"));
74
-
75
- const listener = vi.fn();
76
- store.subscribe("n1", listener);
77
-
78
- store.setSnapshot(textNode("n1", "same"));
79
- expect(listener).not.toHaveBeenCalled();
80
- });
81
-
82
- it("only notifies the subscriber for its specific node", () => {
83
- const store = new NodeStore();
84
- store.setSnapshot(elemNode("root", "div", {}, [textNode("n1", "a"), textNode("n2", "b")]));
85
-
86
- const n1Listener = vi.fn();
87
- const n2Listener = vi.fn();
88
- store.subscribe("n1", n1Listener);
89
- store.subscribe("n2", n2Listener);
90
-
91
- store.setSnapshot(
92
- elemNode("root", "div", {}, [textNode("n1", "changed"), textNode("n2", "b")]),
93
- );
94
-
95
- expect(n1Listener).toHaveBeenCalledTimes(1);
96
- expect(n2Listener).not.toHaveBeenCalled();
97
- });
98
-
99
- it("does not notify parent when only a child's props change", () => {
100
- const store = new NodeStore();
101
- store.setSnapshot(elemNode("root", "div", {}, [textNode("child", "initial")]));
102
-
103
- const rootListener = vi.fn();
104
- store.subscribe("root", rootListener);
105
-
106
- store.setSnapshot(elemNode("root", "div", {}, [textNode("child", "updated")]));
107
-
108
- expect(rootListener).not.toHaveBeenCalled();
109
- });
110
-
111
- it("notifies parent when children list changes", () => {
112
- const store = new NodeStore();
113
- store.setSnapshot(elemNode("root", "div", {}, [textNode("n1", "a")]));
114
-
115
- const rootListener = vi.fn();
116
- store.subscribe("root", rootListener);
117
-
118
- store.setSnapshot(elemNode("root", "div", {}, [textNode("n1", "a"), textNode("n2", "b")]));
119
-
120
- expect(rootListener).toHaveBeenCalledTimes(1);
121
- });
122
-
123
- it("unsubscribes cleanly", () => {
124
- const store = new NodeStore();
125
- store.setSnapshot(textNode("n1", "a"));
126
-
127
- const listener = vi.fn();
128
- const unsub = store.subscribe("n1", listener);
129
- unsub();
130
-
131
- store.setSnapshot(textNode("n1", "b"));
132
- expect(listener).not.toHaveBeenCalled();
133
- });
134
- });
135
-
136
- describe("subscribeRoot", () => {
137
- it("notifies when root id changes", () => {
138
- const store = new NodeStore();
139
- store.setSnapshot(textNode("root1", "a"));
140
-
141
- const listener = vi.fn();
142
- store.subscribeRoot(listener);
143
-
144
- store.setSnapshot(textNode("root2", "b"));
145
- expect(listener).toHaveBeenCalledTimes(1);
146
- });
147
-
148
- it("does not notify when root id stays the same", () => {
149
- const store = new NodeStore();
150
- store.setSnapshot(textNode("root", "a"));
151
-
152
- const listener = vi.fn();
153
- store.subscribeRoot(listener);
154
-
155
- store.setSnapshot(textNode("root", "b"));
156
- expect(listener).not.toHaveBeenCalled();
157
- });
158
-
159
- it("unsubscribes cleanly", () => {
160
- const store = new NodeStore();
161
- store.setSnapshot(textNode("root1", "a"));
162
-
163
- const listener = vi.fn();
164
- const unsub = store.subscribeRoot(listener);
165
- unsub();
166
-
167
- store.setSnapshot(textNode("root2", "b"));
168
- expect(listener).not.toHaveBeenCalled();
169
- });
170
- });
171
-
172
- describe("element node change detection", () => {
173
- it("detects prop changes", () => {
174
- const store = new NodeStore();
175
- store.setSnapshot(elemNode("n", "div", { color: "red" }));
176
-
177
- const listener = vi.fn();
178
- store.subscribe("n", listener);
179
-
180
- store.setSnapshot(elemNode("n", "div", { color: "blue" }));
181
- expect(listener).toHaveBeenCalledTimes(1);
182
- });
183
-
184
- it("detects type changes", () => {
185
- const store = new NodeStore();
186
- store.setSnapshot(elemNode("n", "div"));
187
-
188
- const listener = vi.fn();
189
- store.subscribe("n", listener);
190
-
191
- store.setSnapshot(elemNode("n", "span"));
192
- expect(listener).toHaveBeenCalledTimes(1);
193
- });
194
-
195
- it("detects callback binding changes", () => {
196
- const store = new NodeStore();
197
-
198
- store.setSnapshot(elementWithCallback("tailorkitcallbackonselect"));
199
- const listener = vi.fn();
200
- store.subscribe("n", listener);
201
-
202
- store.setSnapshot(elementWithCallback("tailorkitcallbackonchange"));
203
- expect(listener).toHaveBeenCalledTimes(1);
204
- });
205
- });
206
- });
@@ -1,85 +0,0 @@
1
- import { render, screen } from "@testing-library/react";
2
- import { createElement } from "react";
3
- import { describe, expect, it } from "vitest";
4
- import { buildThemeCss, PrimitiveThemeContext, primitives } from "../primitives";
5
-
6
- const theme = {
7
- breakpoints: {
8
- base: null,
9
- lg: "1024px",
10
- sm: "640px",
11
- },
12
- tokens: {
13
- background: {
14
- surface: "var(--background)",
15
- },
16
- borderColor: {
17
- default: "var(--border)",
18
- },
19
- textColor: {
20
- foreground: "var(--foreground)",
21
- muted: "var(--muted-foreground)",
22
- },
23
- radius: {
24
- md: "8px",
25
- },
26
- space: {
27
- lg: "16px",
28
- md: "8px",
29
- },
30
- },
31
- };
32
-
33
- describe("react primitives", () => {
34
- it("builds screen-scoped theme variables", () => {
35
- const css = buildThemeCss("screen-1", theme);
36
- expect(css).toContain('[data-tailorkit-screen="screen-1"]');
37
- expect(css).toContain("--tailorkit-border-solid: solid;");
38
- expect(css).toContain("--tailorkit-space-md: 8px;");
39
- expect(css).toContain("--tailorkit-background-surface: var(--background);");
40
- expect(css).toContain("--tailorkit-textColor-muted: var(--muted-foreground);");
41
- });
42
-
43
- it("renders a scoped primitive style with responsive rules", () => {
44
- render(
45
- <PrimitiveThemeContext.Provider value={{ screenId: "screen-1", theme }}>
46
- {primitives.Flex({
47
- props: {
48
- direction: { base: "column", lg: "row" },
49
- border: "solid",
50
- gap: "md",
51
- padding: { base: "md", lg: "lg" },
52
- textColor: { base: "muted", lg: "foreground" },
53
- },
54
- slots: { default: createElement("span", null, "Content") },
55
- })}
56
- </PrimitiveThemeContext.Provider>,
57
- );
58
-
59
- const content = screen.getByText("Content");
60
- const node = content.parentElement;
61
- const style = node?.querySelector("style");
62
- expect(node?.tagName).toBe("DIV");
63
- expect(style?.textContent).toContain("display: flex;");
64
- expect(style?.textContent).toContain("border-style: var(--tailorkit-border-solid);");
65
- expect(style?.textContent).toContain("border-width: 1px;");
66
- expect(style?.textContent).toContain("padding: var(--tailorkit-space-md);");
67
- expect(style?.textContent).toContain("color: var(--tailorkit-textColor-muted);");
68
- expect(style?.textContent).toContain("@media (min-width: 1024px)");
69
- expect(style?.textContent).toContain("color: var(--tailorkit-textColor-foreground);");
70
- expect(style?.textContent).toContain("flex-direction: row;");
71
- });
72
-
73
- it("renders inline as a span", () => {
74
- render(
75
- <PrimitiveThemeContext.Provider value={{ screenId: "screen-2", theme }}>
76
- {primitives.Inline({
77
- props: { padding: "md" },
78
- slots: { default: "Label" },
79
- })}
80
- </PrimitiveThemeContext.Provider>,
81
- );
82
-
83
- expect(screen.getByText("Label").tagName).toBe("SPAN");
84
- });
85
- });