Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@sciux/monorepo",
"type": "module",
"version": "0.0.6",
"version": "0.0.7",
"private": true,
"packageManager": "pnpm@10.4.0",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/layout/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@sciux/layout",
"type": "module",
"version": "0.0.6",
"version": "0.0.7",
"description": "Layout components for SciuxKit",
"author": "BijonAI <info@bijon.ai>",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/math/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@sciux/math",
"type": "module",
"version": "0.0.6",
"version": "0.0.7",
"description": "Layout components for SciuxKit",
"author": "BijonAI <info@bijon.ai>",
"license": "MIT",
Expand Down
11 changes: 10 additions & 1 deletion packages/math/src/angle/points.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export const angleEndPoint = defineComponent<'end-point', typeof InfoPointType.i
]
return {
name: 'end-point',
attrs: InfoPointType,
attrs: InfoPointType
globals: (() => {
if ('as' in attrs) {
return {
Expand Down Expand Up @@ -91,5 +91,14 @@ export const origin = defineComponent<'origin', typeof InfoPointType.infer, {
container.append(texElement)
return container
},
defaults: {
value: '',
},
setup() {
const container = document.createElementNS('http://www.w3.org/2000/svg', 'g')
const texElement = generateTexNode(attrs.value.value)
container.append(texElement)
return container
},
}
})
40 changes: 40 additions & 0 deletions packages/math/src/dot/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { theme } from '@sciux/utils-theme'
import { type } from 'arktype'
import { defineComponent } from 'sciux-laplace'
import { generateTexNode } from '../utils/tex'

const T = type({
x: type.number,
y: type.number,
label: 'string | undefined',
})

export const dot = defineComponent<'dot', typeof T.infer, { division: number | undefined }>((attrs, context) => {
return {
name: 'dot',
attrs: T,
defaults: {
x: 0,
y: 0,
},
setup() {
const container = document.createElementNS('http://www.w3.org/2000/svg', 'g')
container.setAttribute('transform', `translate(${attrs.x.value * (context.division ?? 1)}, ${attrs.y.value * (context.division ?? 1)})`)

const dotSvg = document.createElementNS('http://www.w3.org/2000/svg', 'circle')
dotSvg.id = 'dot-circle'
container.id = 'canvas-dot'
dotSvg.setAttribute('stroke', 'none')
dotSvg.setAttribute('fill', theme.pallete('primary'))
dotSvg.setAttribute('r', '2')

if (attrs.label.value) {
const label = generateTexNode(attrs.label.value)
container.append(label)
}

container.appendChild(dotSvg)
return container
},
}
})
1 change: 1 addition & 0 deletions packages/math/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export * from './angle'
export * from './axis'
export * from './circle'
export * from './dot'
export * from './figure'
export * from './function'
export * from './line'
Expand Down
2 changes: 1 addition & 1 deletion packages/model/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@sciux/model",
"type": "module",
"version": "0.0.6",
"version": "0.0.7",
"description": "Model components for SciuxKit",
"author": "BijonAI <info@bijon.ai>",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/sciux/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "sciux",
"type": "module",
"version": "0.0.6",
"version": "0.0.7",
"description": "Sciux library composed package.",
"author": "BijonAI <info@bijon.ai>",
"license": "MIT",
Expand Down
3 changes: 2 additions & 1 deletion packages/sciux/src/math.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Animation, Component } from 'sciux-laplace'
import type { RegisterContext } from './types'
import { angle, angleArcCreation, angleCreation, axis, axisCreation, circle, circleCreation, figure, func, funcCreation, line, lineCreation, parametric, parametricCreation, plane, planeCreation, projectionCreation, tools, vector, vectorCreation } from '@sciux/math'
import { angle, angleArcCreation, angleCreation, axis, axisCreation, circle, circleCreation, dot, figure, func, funcCreation, line, lineCreation, parametric, parametricCreation, plane, planeCreation, projectionCreation, tools, vector, vectorCreation } from '@sciux/math'
import { withSpace } from 'sciux-laplace'
import { canvasSpace } from './widget'

Expand All @@ -14,6 +14,7 @@ export default function ({ animations, context }: RegisterContext): void {
canvasSpace.set('axis', axis)
canvasSpace.set('plane', withSpace(plane as Component<'plane', any, any>, canvasSpace))
canvasSpace.set('parametric', parametric)
canvasSpace.set('dot', dot)
const creation = <Animation<[], any, any>[]> animations.get('creation')
creation.push(angleCreation, angleArcCreation, circleCreation, lineCreation, funcCreation, parametricCreation, axisCreation, planeCreation, projectionCreation, vectorCreation)
Object.assign(context, tools)
Expand Down
2 changes: 1 addition & 1 deletion packages/theme-default/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@sciux/theme-default",
"type": "module",
"version": "0.0.6",
"version": "0.0.7",
"description": "Default theme for SciuxKit",
"author": "BijonAI <info@bijon.ai>",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/utils-theme/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@sciux/utils-theme",
"type": "module",
"version": "0.0.6",
"version": "0.0.7",
"description": "Theme utilities for SciuxKit",
"author": "BijonAI <info@bijon.ai>",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion packages/widget/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@sciux/widget",
"type": "module",
"version": "0.0.6",
"version": "0.0.7",
"description": "Widgets for SciuxKit",
"author": "BijonAI <info@bijon.ai>",
"license": "MIT",
Expand Down
2 changes: 2 additions & 0 deletions test/src/examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import ins02 from './template/instance/ins02.sciux?raw'
import angle from './template/math/angle.sciux?raw'
import axis from './template/math/axis.sciux?raw'
import circle from './template/math/circle.sciux?raw'
import dot from './template/math/dot.sciux?raw'
import figure from './template/math/figure.sciux?raw'
import parametric from './template/math/parametric.sciux?raw'
import plane from './template/math/plane.sciux?raw'
Expand All @@ -22,6 +23,7 @@ export default {
plane,
parametric,
axis,
dot,
},
'INSTANCE': {
ins01,
Expand Down
10 changes: 5 additions & 5 deletions test/src/template/instance/ins02.sciux
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<let :to="angleA < angleB ? angleB : angleA" />
<let :startSide="angleA < angleB ? sideA : sideB" />
<let :endSide="angleA < angleB ? sideB : sideA" />
<line :from="A" :to="B" type="solid" value="O" />
<angle
:from="from"
:to="to"
Expand All @@ -22,13 +23,12 @@
:x="P[0]"
:y="P[1]"
>
<start-point as="BB" value="A" />
<end-point as="AA" value="B" />
<origin value="P" />
<start-point as="A" value="A" />
<end-point as="B" value="B" />
<origin as="P" value="P" />
<arc type="solid" value="90 \degree" />
</angle>
<line :from="AA" :to="BB" type="solid" value="O" />
<line :from="P" :to="O" type="dotted" />
<line :from="O" :to="P" type="dashed" />
<circle $="v(1080),10000" :x="O[0]" :y="O[1]" :radius="2 * d" />
</canvas>
</flexbox>
5 changes: 5 additions & 0 deletions test/src/template/math/dot.sciux
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<canvas :width="200" :height="300" :origin="[100, 150]">
<plane :x="0" :y="0" :domain="[0, 10]" :range="[0, 12]" :division="15">
<dot label="(5, 7)" :x="5" :y="7" />
</plane>
</canvas>