Skip to content

Commit 06c7fdb

Browse files
committed
feat: add composing package
1 parent 840c4a0 commit 06c7fdb

File tree

12 files changed

+146
-6
lines changed

12 files changed

+146
-6
lines changed

packages/layout/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"license": "MIT",
88
"repository": {
99
"type": "git",
10-
"url": "git+https://github.com/bijonai/lib.git"
10+
"url": "git+https://github.com/sciux-kit/lib.git"
1111
},
12-
"bugs": "https://github.com/bijonai/lib/issues",
12+
"bugs": "https://github.com/sciux-kit/lib/issues",
1313
"keywords": [],
1414
"exports": {
1515
".": {

packages/model/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
"license": "MIT",
88
"repository": {
99
"type": "git",
10-
"url": "git+https://github.com/bijonai/lib.git"
10+
"url": "git+https://github.com/sciux-kit/lib.git"
1111
},
12-
"bugs": "https://github.com/bijonai/lib/issues",
12+
"bugs": "https://github.com/sciux-kit/lib/issues",
1313
"keywords": [],
1414
"exports": {
1515
".": {

packages/sciux/README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# `sciux`
2+
3+
Sciux library composed package.

packages/sciux/package.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"name": "sciux",
3+
"type": "module",
4+
"version": "0.0.0",
5+
"description": "Sciux library composed package.",
6+
"author": "BijonAI <info@bijon.ai>",
7+
"license": "MIT",
8+
"repository": {
9+
"type": "git",
10+
"url": "git+https://github.com/sciux-kit/lib.git"
11+
},
12+
"bugs": "https://github.com/sciux-kit/lib/issues",
13+
"keywords": [],
14+
"exports": {
15+
".": {
16+
"types": "./src/index.ts",
17+
"import": "./dist/index.js"
18+
}
19+
},
20+
"main": "./dist/index.mjs",
21+
"module": "./dist/index.mjs",
22+
"types": "./dist/index.d.mts",
23+
"files": [
24+
"dist"
25+
],
26+
"scripts": {
27+
"build": "tsup",
28+
"dev": "tsup --watch",
29+
"prepublishOnly": "nr build",
30+
"start": "tsx src/index.ts"
31+
},
32+
"dependencies": {
33+
"@sciux/layout": "workspace:*",
34+
"@sciux/model": "workspace:*",
35+
"@sciux/widget": "workspace:*",
36+
"sciux-laplace": "latest"
37+
}
38+
}

packages/sciux/src/index.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
import type { RegisterContext } from './types'
2+
import { animations, components, flows, textModes } from 'sciux-laplace'
3+
import layout from './layout'
4+
import model from './model'
5+
import widget from './widget'
6+
7+
const defaultContext: RegisterContext = {
8+
components,
9+
flows,
10+
animations,
11+
textModes,
12+
}
13+
const registers = [widget, model, layout]
14+
15+
export default function (context: RegisterContext = defaultContext): void {
16+
for (const register of registers) {
17+
register(context)
18+
}
19+
}
20+
21+
export * from './layout'
22+
export * from './model'
23+
export * from './widget'
24+
export * from 'sciux-laplace'

packages/sciux/src/layout.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import type { RegisterContext } from './types'
2+
import { align, block, columns, flexbox, grid, rows } from '@sciux/layout'
3+
4+
export default function ({ components }: RegisterContext): void {
5+
components.set('block', block)
6+
components.set('flexbox', flexbox)
7+
components.set('rows', rows)
8+
components.set('columns', columns)
9+
components.set('grid', grid)
10+
components.set('align', align)
11+
}
12+
13+
export * from '@sciux/layout'

packages/sciux/src/model.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import type { RegisterContext } from './types'
2+
import { button, checkbox, input, slider } from '@sciux/model'
3+
4+
export default function ({ components }: RegisterContext): void {
5+
components.set('button', button)
6+
components.set('input', input)
7+
components.set('slider', slider)
8+
components.set('checkbox', checkbox)
9+
}
10+
11+
export * from '@sciux/model'

packages/sciux/src/types.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import type { animations, components, flows, textModes } from 'sciux-laplace'
2+
3+
export type Components = typeof components
4+
export type Flows = typeof flows
5+
export type Animations = typeof animations
6+
export type TextModes = typeof textModes
7+
export interface RegisterContext {
8+
components: Components
9+
flows: Flows
10+
animations: Animations
11+
textModes: TextModes
12+
}

packages/sciux/src/widget.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import type { RegisterContext } from './types'
2+
import { canvas, code, link, table } from '@sciux/widget'
3+
import { TextMode } from 'sciux-laplace'
4+
5+
export default function ({ components, textModes }: RegisterContext): void {
6+
components.set('table', table)
7+
components.set('canvas', canvas)
8+
components.set('link', link)
9+
components.set('code', code)
10+
11+
textModes.set('code', TextMode.RCDATA)
12+
}
13+
14+
export * from '@sciux/widget'

packages/sciux/tsup.config.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
import { defineConfig } from 'tsup'
2+
3+
export default defineConfig({
4+
entry: ['./src/index.ts'],
5+
outDir: './dist',
6+
format: 'esm',
7+
dts: true,
8+
sourcemap: true,
9+
clean: true,
10+
})

0 commit comments

Comments
 (0)