@yanqirenshi/d3.wireframe 0.1.0 → 0.1.1

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/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@yanqirenshi/d3.wireframe",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Wireframe diagram renderer (frame / image / button / modal / dialog elements)",
5
5
  "main": "dist/index.js",
6
+ "files": [
7
+ "dist",
8
+ "src"
9
+ ],
6
10
  "scripts": {
7
11
  "transpile": "babel src -d dist --copy-files",
8
12
  "prepublishOnly": "npm run transpile",
@@ -21,8 +25,8 @@
21
25
  },
22
26
  "homepage": "https://yanqirenshi.github.io/D3.Wireframe/#home",
23
27
  "peerDependencies": {
24
- "react": "^18.2.0",
25
- "react-dom": "^18.2.0"
28
+ "react": "^18.0.0 || ^19.0.0",
29
+ "react-dom": "^18.0.0 || ^19.0.0"
26
30
  },
27
31
  "dependencies": {
28
32
  "@yanqirenshi/assh0le": "^0.5.2"
package/babel.config.js DELETED
@@ -1,10 +0,0 @@
1
- module.exports = {
2
- presets: [
3
- [
4
- "@babel/preset-env"
5
- ],
6
- [
7
- "@babel/preset-react"
8
- ]
9
- ],
10
- };
package/jest.config.js DELETED
@@ -1,23 +0,0 @@
1
- module.exports = {
2
- // テストファイルは tests ディレクトリに指定
3
- // テストファイルには `spec` か `test` を付けるように指定
4
- testMatch: [
5
- "**/tests/**/?(*.)+(spec|test).[tj]s?(x)"
6
- ],
7
- // src ディレクトリ内の .js ファイルは babel-jest で変換する
8
- // 注: monorepo 化により babel-jest はルート node_modules に hoist されるため、
9
- // <rootDir>/node_modules/ のパス固定ではなく名前解決に任せる。
10
- transform: {
11
- "^.+\\.js$": 'babel-jest',
12
- },
13
- // d3 v7 は ESM-only で CJS ランタイムの jest では読めないため、スタブにマップする
14
- // (assh0le → d3.svg の連鎖が d3 を require する)。
15
- moduleNameMapper: {
16
- '^d3$': '<rootDir>/tests/d3-stub.js',
17
- },
18
- // カバレッジの対象ファイルを `**/src/**/*.js` にして `node_modules` を除外
19
- collectCoverageFrom: [
20
- "**/src/**/*.js",
21
- "!**/node_modules/**",
22
- ],
23
- };
@@ -1,54 +0,0 @@
1
- import { Rectum } from '../src/index.js';
2
-
3
- // frame + 子 button の最小ワイヤーフレーム入力
4
- const sample = () => ([
5
- {
6
- id: 1,
7
- element_type: 'frame',
8
- rectangle: { w: 600, h: 800 },
9
- position: { x: 0, y: 0, z: 0 },
10
- stroke: { color: '#afafb0', width: 1 },
11
- labels: [
12
- { text: 'FRAME 01', position: { x: 20, y: 20 }, font: { size: 16, color: '#7b7c7d' } },
13
- ],
14
- children: [
15
- {
16
- id: 2,
17
- element_type: 'button',
18
- rectangle: { w: 111, h: 50 },
19
- position: { x: 100, y: 500, z: 0 },
20
- round: 10,
21
- labels: [
22
- { text: 'BUTTON 01', position: { x: 20, y: 20 }, font: { size: 16, color: '#7b7c7d' } },
23
- ],
24
- children: [],
25
- },
26
- ],
27
- },
28
- ]);
29
-
30
- test('makeElements builds the element tree from input data', () => {
31
- const rectum = new Rectum({});
32
-
33
- const pool = rectum.makeElements(sample());
34
-
35
- // ルート要素は frame 1つ
36
- expect(pool.list.length).toBe(1);
37
-
38
- const frame = pool.list[0];
39
- expect(frame._core.element_type).toBe('frame');
40
-
41
- // 子の button が構築されている
42
- expect(frame.children.length).toBe(1);
43
- expect(frame.children[0]._core.element_type).toBe('button');
44
- });
45
-
46
- test('flatten expands the element tree depth-first', () => {
47
- const rectum = new Rectum({});
48
-
49
- const pool = rectum.makeElements(sample());
50
-
51
- const flat = rectum.flatten(pool.list);
52
-
53
- expect(flat.length).toBe(2);
54
- });
package/tests/d3-stub.js DELETED
@@ -1,4 +0,0 @@
1
- // jest 用の d3 スタブ。
2
- // d3 v7 は ESM-only のため CJS ランタイムの jest では読み込めない。
3
- // テスト対象(データクラスの構築・マージ)は d3 の関数を呼ばないので空オブジェクトで足りる。
4
- module.exports = {};