@processandtools/rp-article-designer 1.0.0

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.
@@ -0,0 +1 @@
1
+ .var-controller__range-info{font-size:11px;color:#666;margin-top:2px}.var-controller__numeric-control{display:flex;align-items:center;gap:10px}.var-controller__number-input{padding:4px 8px;border:1px solid #ddd;border-radius:4px;width:80px}.var-controller{padding:20px;font-family:monospace;max-width:1200px;margin:0 auto}.var-controller__header{color:#666;margin-bottom:20px}.var-controller__section{margin-bottom:30px;border:2px solid #333;border-radius:8px;padding:15px;background-color:#f9f9f9}.var-controller__section-title{margin-top:0;border-bottom:1px solid #ccc;padding-bottom:10px}.var-controller__table{width:100%;border-collapse:collapse}.var-controller__table thead tr{background-color:#e0e0e0}.var-controller__table th{padding:8px;text-align:left}.var-controller__table th.center{text-align:center}.var-controller__table tbody tr{border-bottom:1px solid #ddd}.var-controller__table tbody tr:nth-child(2n){background-color:#f5f5f5}.var-controller__table tbody tr:nth-child(odd){background-color:#fff}.var-controller__table td{padding:8px}.var-controller__var-name{font-weight:700}.var-controller__value--reference{color:#007bff}.var-controller__reference{color:#666;font-size:.9em}.var-controller__type-badge{padding:2px 8px;border-radius:4px;background-color:#e0e0e0;font-size:.85em}.var-controller__slider-container{display:flex;align-items:center;gap:10px}.var-controller__slider{flex:1;height:6px;border-radius:3px;background:#d3d3d3;outline:none;-webkit-appearance:none}.var-controller__slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:18px;height:18px;border-radius:50%;background:#007bff;cursor:pointer}.var-controller__slider::-moz-range-thumb{width:18px;height:18px;border-radius:50%;background:#007bff;cursor:pointer;border:none}.var-controller__slider-value{min-width:60px;text-align:right;font-weight:700;color:#007bff}.var-controller__text-input{width:100%;padding:4px;border:2px solid #007bff;border-radius:4px}.var-controller__btn{padding:4px 12px;border:none;border-radius:4px;cursor:pointer;font-size:.9em}.var-controller__btn--edit{background-color:#007bff;color:#fff}.var-controller__btn--save{background-color:#28a745;color:#fff;margin-right:4px}.var-controller__btn--cancel{background-color:#dc3545;color:#fff}.var-controller__btn:hover{opacity:.9}.var-controller__stats{padding:15px;background-color:#e8f4f8;border-radius:8px;margin-top:20px}.var-controller__stats h4{margin-top:0}.var-controller__stats ul{margin:0;padding-left:20px}
@@ -0,0 +1,82 @@
1
+ import { AnglZone } from './data.types.tsx';
2
+ import { DimensionProps } from './zone.types.tsx';
3
+
4
+ export type DivisionDirection = 'A' | 'D' | 'H' | 'I' | 'V';
5
+ export type HorizontalDefType = '2' | 'A' | 'D' | 'P' | 'W';
6
+ export type DividerType = 'A' | 'B' | 'C' | 'D' | 'F' | 'P' | 'S' | 'T' | 'V';
7
+ type DividerProps = Pick<AnglZone, 'TREEID' | 'DIVDIR' | 'DIVTYPE' | 'HORDEFTYPE' | 'LINDIV1' | 'DIVELEM1' | 'DIVIDER'>;
8
+ export declare const DividerTypeConst: {
9
+ readonly LINEAR_DIVISION: "linear-division";
10
+ readonly ARTICLE: "article";
11
+ };
12
+ export declare const ValueSourceConst: {
13
+ readonly STRING: "string";
14
+ readonly DESCRIPTOR: "descriptor";
15
+ };
16
+ interface BaseDivider {
17
+ TREEID: string;
18
+ DIVDIR: DivisionDirection;
19
+ DIVTYPE: DividerType;
20
+ HORDEFTYPE: HorizontalDefType;
21
+ LINDIV1: string;
22
+ DIVELEM1: number;
23
+ }
24
+ export interface LinearDivisionString extends BaseDivider {
25
+ type: typeof DividerTypeConst.LINEAR_DIVISION;
26
+ valueSource: typeof ValueSourceConst.STRING;
27
+ DIVIDER: '';
28
+ formula: string;
29
+ thickness: number;
30
+ }
31
+ export interface LinearDivisionDescriptor extends BaseDivider {
32
+ type: typeof DividerTypeConst.LINEAR_DIVISION;
33
+ valueSource: typeof ValueSourceConst.DESCRIPTOR;
34
+ DIVIDER: '';
35
+ descriptorName: string;
36
+ thickness: number;
37
+ }
38
+ export type LinearDivisionMode = LinearDivisionString | LinearDivisionDescriptor;
39
+ export interface ArticleString extends BaseDivider {
40
+ type: typeof DividerTypeConst.ARTICLE;
41
+ valueSource: typeof ValueSourceConst.STRING;
42
+ DIVIDER: string;
43
+ articleName: string;
44
+ }
45
+ export interface ArticleDescriptor extends BaseDivider {
46
+ type: typeof DividerTypeConst.ARTICLE;
47
+ valueSource: typeof ValueSourceConst.DESCRIPTOR;
48
+ DIVIDER: string;
49
+ descriptorName: string;
50
+ }
51
+ export type ArticleMode = ArticleString | ArticleDescriptor;
52
+ export type DividerMode = LinearDivisionMode | ArticleMode;
53
+ export declare const isDivider: {
54
+ linearDivision: (divider: DividerMode) => divider is LinearDivisionMode;
55
+ article: (divider: DividerMode) => divider is ArticleMode;
56
+ };
57
+ export declare const isLinearDivision: {
58
+ string: (divider: DividerMode) => divider is LinearDivisionString;
59
+ descriptor: (divider: DividerMode) => divider is LinearDivisionDescriptor;
60
+ };
61
+ export declare const isArticle: {
62
+ string: (divider: DividerMode) => divider is ArticleString;
63
+ descriptor: (divider: DividerMode) => divider is ArticleDescriptor;
64
+ };
65
+ export declare const createDivider: {
66
+ linearDivisionString(TREEID: string, DIVDIR: DivisionDirection, DIVTYPE: DividerType, HORDEFTYPE: HorizontalDefType, LINDIV1: string, DIVELEM1: number, formula: string, thickness: number): LinearDivisionString;
67
+ linearDivisionDescriptor(TREEID: string, DIVDIR: DivisionDirection, DIVTYPE: DividerType, HORDEFTYPE: HorizontalDefType, LINDIV1: string, DIVELEM1: number, descriptorName: string, thickness: number): LinearDivisionDescriptor;
68
+ articleString(TREEID: string, DIVDIR: DivisionDirection, DIVTYPE: DividerType, HORDEFTYPE: HorizontalDefType, LINDIV1: string, DIVELEM1: number, articleName: string): ArticleString;
69
+ articleDescriptor(TREEID: string, DIVDIR: DivisionDirection, DIVTYPE: DividerType, HORDEFTYPE: HorizontalDefType, LINDIV1: string, DIVELEM1: number, descriptorName: string): ArticleDescriptor;
70
+ fromZoneData(divProps: DividerProps, thickness: number): DividerMode;
71
+ };
72
+ export declare function getArticleName(divider: DividerMode): string | undefined;
73
+ export declare function getArticleDescriptorName(divider: DividerMode): string | undefined;
74
+ export declare function getFormula(divider: DividerMode): string | undefined;
75
+ export declare function getLinearDescriptorName(divider: DividerMode): string | undefined;
76
+ export declare function needsDescriptorEvaluation(divider: DividerMode): boolean;
77
+ export declare function getDescriptorName(divider: DividerMode): string | undefined;
78
+ export declare function getDividedAxis(divider?: DividerMode): 'width' | 'depth' | 'height';
79
+ export declare function getDividedLength(axis: 'width' | 'depth' | 'height', dimensions?: DimensionProps): number;
80
+ export declare function isHorizontalDivision(divider: DividerMode): boolean;
81
+ export declare function isVerticalDivision(divider: DividerMode): boolean;
82
+ export {};
@@ -0,0 +1,5 @@
1
+ export declare enum VIEW {
2
+ _2D_TOP = "2D_TOP",
3
+ _2D_FRONT = "2D_FRONT",
4
+ _3D = "3D"
5
+ }
@@ -0,0 +1,28 @@
1
+ import { ImosVariable } from './variable.types.ts';
2
+
3
+ export type VariableTree = Map<string, ImosVariable>;
4
+ /**
5
+ * Create variable tree - just convert array to Map
6
+ */
7
+ export declare function createVariableTree(imosVariables: ImosVariable[]): VariableTree;
8
+ /**
9
+ * Get the final value by following $VAR references
10
+ * V1 ($V2) -> V2 ($V3) -> V3 ($V4) -> V4 (400) = 400
11
+ */
12
+ export declare function getValue(varName: string, tree: VariableTree, visited?: Set<string>): string | number | undefined;
13
+ /**
14
+ * Set a variable's value (immutable update)
15
+ */
16
+ export declare function setValue(varName: string, newValue: string | number, tree: VariableTree): VariableTree;
17
+ /**
18
+ * Resolve variables in a string (e.g., "1:$VAR_M1 mm" → "1:300 mm")
19
+ */
20
+ export declare function resolveString(str: string, tree: VariableTree): string;
21
+ /**
22
+ * Check if a string contains variable references
23
+ */
24
+ export declare function hasVariables(str: string): boolean;
25
+ /**
26
+ * Extract all variable names from a string
27
+ */
28
+ export declare function extractVariableNames(str: string): string[];
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Hook to access variables
3
+ * Provides utilities to work with the variable tree
4
+ */
5
+ export declare function useVariables(): {
6
+ tree: any;
7
+ getValue: (name: string) => string | number;
8
+ resolveString: (str: string) => string;
9
+ hasVariables: (str: string) => boolean;
10
+ setValue: any;
11
+ };
@@ -0,0 +1,20 @@
1
+ export declare enum VAR_TYPE {
2
+ Surface = 3,
3
+ Material = 4,
4
+ Numeric = 100,
5
+ Text = 120
6
+ }
7
+ export interface ImosVariable {
8
+ NAME: string;
9
+ TYP: number;
10
+ WERT: string;
11
+ }
12
+ export declare function isVariableReference(value: string): boolean;
13
+ export declare function extractVariableName(reference: string): string;
14
+ export interface VariableContextType {
15
+ getValue: (name: string) => string | number | undefined;
16
+ setValue: (name: string, value: string | number) => void;
17
+ resolveString: (str: string) => string;
18
+ hasVariables: (str: string) => boolean;
19
+ getTree: () => Map<string, ImosVariable>;
20
+ }
package/dist/vite.svg ADDED
@@ -0,0 +1 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" aria-hidden="true" role="img" class="iconify iconify--logos" width="31.88" height="32" preserveAspectRatio="xMidYMid meet" viewBox="0 0 256 257"><defs><linearGradient id="IconifyId1813088fe1fbc01fb466" x1="-.828%" x2="57.636%" y1="7.652%" y2="78.411%"><stop offset="0%" stop-color="#41D1FF"></stop><stop offset="100%" stop-color="#BD34FE"></stop></linearGradient><linearGradient id="IconifyId1813088fe1fbc01fb467" x1="43.376%" x2="50.316%" y1="2.242%" y2="89.03%"><stop offset="0%" stop-color="#FFEA83"></stop><stop offset="8.333%" stop-color="#FFDD35"></stop><stop offset="100%" stop-color="#FFA800"></stop></linearGradient></defs><path fill="url(#IconifyId1813088fe1fbc01fb466)" d="M255.153 37.938L134.897 252.976c-2.483 4.44-8.862 4.466-11.382.048L.875 37.958c-2.746-4.814 1.371-10.646 6.827-9.67l120.385 21.517a6.537 6.537 0 0 0 2.322-.004l117.867-21.483c5.438-.991 9.574 4.796 6.877 9.62Z"></path><path fill="url(#IconifyId1813088fe1fbc01fb467)" d="M185.432.063L96.44 17.501a3.268 3.268 0 0 0-2.634 3.014l-5.474 92.456a3.268 3.268 0 0 0 3.997 3.378l24.777-5.718c2.318-.535 4.413 1.507 3.936 3.838l-7.361 36.047c-.495 2.426 1.782 4.5 4.151 3.78l15.304-4.649c2.372-.72 4.652 1.36 4.15 3.788l-11.698 56.621c-.732 3.542 3.979 5.473 5.943 2.437l1.313-2.028l72.516-144.72c1.215-2.423-.88-5.186-3.54-4.672l-25.505 4.922c-2.396.462-4.435-1.77-3.759-4.114l16.646-57.705c.677-2.35-1.37-4.583-3.769-4.113Z"></path></svg>
package/package.json ADDED
@@ -0,0 +1,88 @@
1
+ {
2
+ "name": "@processandtools/rp-article-designer",
3
+ "version": "1.0.0",
4
+ "description": "3D Article Designer component library for furniture visualization using React Three Fiber",
5
+ "author": "Otman Abid Lmerabetine",
6
+ "license": "MIT",
7
+ "keywords": [
8
+ "react",
9
+ "three",
10
+ "threejs",
11
+ "3d",
12
+ "furniture",
13
+ "designer",
14
+ "visualization",
15
+ "article",
16
+ "react-three-fiber",
17
+ "imos"
18
+ ],
19
+ "type": "module",
20
+ "main": "./dist/index.cjs",
21
+ "module": "./dist/index.js",
22
+ "types": "./dist/index.d.ts",
23
+ "exports": {
24
+ ".": {
25
+ "types": "./dist/index.d.ts",
26
+ "import": "./dist/index.js",
27
+ "require": "./dist/index.cjs"
28
+ }
29
+ },
30
+ "files": [
31
+ "dist",
32
+ "README.md",
33
+ "LICENSE"
34
+ ],
35
+ "scripts": {
36
+ "dev": "vite",
37
+ "build": "tsc -b && vite build",
38
+ "build:lib": "vite build --mode production",
39
+ "build:protected": "npm run build:lib && javascript-obfuscator dist --output dist",
40
+ "lint": "eslint .",
41
+ "preview": "vite preview",
42
+ "prepublishOnly": "npm run build:lib",
43
+ "test:pack": "npm pack"
44
+ },
45
+ "peerDependencies": {
46
+ "@react-three/drei": "^9.0.0 || ^10.0.0",
47
+ "@react-three/fiber": "^8.0.0 || ^9.0.0",
48
+ "react": "^18.0.0 || ^19.0.0",
49
+ "react-dom": "^18.0.0 || ^19.0.0",
50
+ "three": "^0.150.0 || ^0.181.0"
51
+ },
52
+ "dependencies": {
53
+ "@react-three/postprocessing": "^3.0.4",
54
+ "imos-linear-division": "^0.1.3"
55
+ },
56
+ "devDependencies": {
57
+ "@eslint/js": "^9.39.1",
58
+ "@react-three/drei": "^10.7.7",
59
+ "@react-three/fiber": "^9.4.0",
60
+ "@types/node": "^24.10.0",
61
+ "@types/react": "^19.2.2",
62
+ "@types/react-dom": "^19.2.2",
63
+ "@types/three": "^0.181.0",
64
+ "@vitejs/plugin-react": "^5.1.0",
65
+ "d3-selection": "^3.0.0",
66
+ "d3-zoom": "^3.0.0",
67
+ "eslint": "^9.39.1",
68
+ "eslint-plugin-react-hooks": "^7.0.1",
69
+ "eslint-plugin-react-refresh": "^0.4.24",
70
+ "globals": "^16.5.0",
71
+ "javascript-obfuscator": "^5.1.0",
72
+ "react": "^19.2.0",
73
+ "react-dom": "^19.2.0",
74
+ "terser": "^5.44.1",
75
+ "three": "^0.181.1",
76
+ "typescript": "~5.9.3",
77
+ "typescript-eslint": "^8.46.3",
78
+ "vite": "^7.2.2",
79
+ "vite-plugin-dts": "^3.9.1"
80
+ },
81
+ "publishConfig": {
82
+ "access": "public"
83
+ },
84
+ "repository": {
85
+ "type": "git",
86
+ "url": "https://github.com/processandtools/rp-article-designer.git"
87
+ }
88
+ }