9.1.1 • Published 14 days ago

@easterngraphics/wcf v9.1.1

Weekly downloads
-
License
MIT
Repository
-
Last release
14 days ago

W-CF

W-CF stands for Web Configuration Framework and is a JavaScript framework for 3D product configuration. It consists of several ES6 JavaScript modules.

1. Modules

The modules are categorized and structured into several folders. They can be found in the modules folder of the W-CF distribution. These are the main module folders:

  • bsk: wrapper for the EAIWS basket functionality to manage an article list
  • cf: tools and functions for OFML article configuration using the EAIWS
  • core: core functionality for the W-CF framework (e.g. the 3D view, tools, commands)
  • eaiws: JavaScript wrapper for the SOAP-Api of the EAIWS
  • pl: tools and functions for space planning
  • polyfill: optional browser polyfills
  • utils: a collection of utility functions and classes for the W-CF framework

1.1 Installing and using the modules

To use the modules you have to install them using npm. For correct installation of all dependencies version 7+ of npm is required. Please use the following command for the installation: npm i @easterngraphics/wcf After the installation the modules can be imported from @easterngraphics/wcf/modules/.... Example:

import { EaiwsSession } from "@easterngraphics/wcf/modules/eaiws";

It is also recommended to setup a build task to copy the W-CF resources (styles, data) from node_modules/@easterngraphics/wcf/ to your distribution directory.

2. Using wcfConfig to configure W-CF

wcfConfig is a global object which is used to configure different parts of W-CF. To support loading of resources on demand the dataPath has to be defined at the start of the application. Example:

import { wcfConfig } from "@easterngraphics/wcf/modules/utils";
wcfConfig.dataPath = "wcf/data/";

3. Polyfills

W-CF provides a core-js based polyfill of stable ES and web standards for the last 3 browser versions. If your build environment (e.g. Babel) does not already provide polyfills it is recommended to import it as your first import in your application to get the best compatibility with different browsers and versions.

import "@easterngraphics/wcf/modules/polyfill/core-js";

Additionally you need to add core-js to the dependencies in your package.json.

{
  ...
  "dependencies": {
    ...
    "core-js": "^3.35.1"
  }
}

4. Migrating to modules

If you are currently using a non-module W-CF (version < 8.0.0) you will have to migrate to modules if you want to use the latest W-CF version. If your application itself is not module based you should consider to switch to modules. If this is not an option you have to build your own bundle of W-CF.

Here are the basic steps in order to use the W-CF modules

  1. delete the old W-CF distribution from your project (scripts, data, styles, libs)
  2. execute npm i @easterngraphics/wcf
  3. if TypeScript is used remove references to the old W-CF .d.ts files from your tsconfig.json
  4. update your code to import and use the modules instead of the old namespaces
  5. setup a build task to copy the W-CF resources (styles, data) from node_modules/@easterngraphics/wcf/ to your distribution directory

4.1 Bundle size

If you want to have a minimal bundle size and you are importing classes from BabylonJs there some rules:

  • Do not import from the root index of BabylonJs. If you do this you will end up with all BabylonJs modules in your bundle. Instead import as close as possible from the desired module itself. Wrong: import { Vector3 } from "@babylonjs/core"; Correct: import { Vector3 } from "@babylonjs/core/Maths/math.vector";
  • Avoid using the MeshBuilder class. Using this class will bundle all "builders" to your code. You should import only the functions you need from @babylonjs/core/Meshes/Builders. e.g.: import { CreatePlane } from "@babylonjs/core/Meshes/Builders/planeBuilder";

More information about this topic can be found here: https://doc.babylonjs.com/divingDeeper/developWithBjs/treeShaking#tree-shaking

4.2 Troubleshooting

  • If you get the error Type 'Timeout' is not assignable to type 'number'. you are perhaps importing jszip in your project. JSZip is globally loading the node types and this generates a conflict with the setTimeout() function. To solve this issue you should call window.setTimeout() instead of just setTimeout().

Legal remarks

© EasternGraphics GmbH | Albert-Einstein-Straße 1 | 98693 Ilmenau | GERMANY

This work (whether as text, file, book or in other form) is copyright. All rights are reserved by EasternGraphics GmbH. Translation, reproduction or distribution of the whole or parts thereof is permitted only with the prior agreement in writing of EasternGraphics GmbH.

EasternGraphics GmbH accepts no liability for the completeness, freedom from errors, topicality or continuity of this work or for its suitability to the intended purposes of the user. All liability except in the case of malicious intent, gross negligence or harm to life and limb is excluded.

All names or descriptions contained in this work may be the trademarks of the relevant copyright owner and as such legally protected. The fact that such trademarks appear in this work entitles no-one to assume that they are for the free use of all and sundry.

9.1.1

14 days ago

10.0.0-alpha.1

28 days ago

9.1.0

28 days ago

9.1.0-rc.1

2 months ago

9.1.0-beta.4

3 months ago

9.1.0-beta.3

3 months ago

9.1.0-beta.2

3 months ago

9.1.0-beta.1

4 months ago

9.1.0-alpha.1

6 months ago

9.0.0

7 months ago

9.0.0-rc.2

7 months ago

9.0.0-rc.1

8 months ago

9.0.0-beta.1

9 months ago

9.0.0-alpha.5

9 months ago

9.0.0-alpha.4

9 months ago

9.0.0-alpha.3

9 months ago

9.0.0-alpha.2

9 months ago

9.0.0-alpha.1

9 months ago