@genexus/mercury 0.3.6 → 0.4.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.
Files changed (45) hide show
  1. package/README.md +28 -0
  2. package/dist/assets-manager.d.ts +16 -15
  3. package/dist/assets-manager.js +20 -5
  4. package/dist/bundles/css/all.css +1 -0
  5. package/dist/bundles/css/base/base.css +1 -0
  6. package/dist/bundles/css/base/icons.css +1 -0
  7. package/dist/bundles/css/components/button.css +1 -0
  8. package/dist/bundles/css/components/checkbox.css +1 -0
  9. package/dist/bundles/css/components/code.css +1 -0
  10. package/dist/bundles/css/components/combo-box.css +1 -0
  11. package/dist/bundles/css/components/dialog.css +1 -0
  12. package/dist/bundles/css/components/edit.css +1 -0
  13. package/dist/bundles/css/components/radio-group.css +1 -0
  14. package/dist/bundles/css/components/tab.css +1 -0
  15. package/dist/bundles/css/components/tabular-grid.css +1 -0
  16. package/dist/bundles/css/components/tree-view.css +1 -0
  17. package/dist/bundles/css/resets/box-sizing.css +1 -0
  18. package/dist/bundles/css/utils/form--full.css +1 -0
  19. package/dist/bundles/css/utils/form.css +1 -0
  20. package/dist/bundles/css/utils/layout.css +1 -0
  21. package/dist/bundles/css/utils/typography.css +1 -0
  22. package/dist/bundles/scss/all.scss +4 -0
  23. package/dist/bundles/scss/base/base.scss +24 -0
  24. package/dist/bundles/scss/base/icons.scss +4 -0
  25. package/dist/bundles/scss/components/button.scss +8 -0
  26. package/dist/bundles/scss/components/checkbox.scss +3 -0
  27. package/dist/bundles/scss/components/code.scss +3 -0
  28. package/dist/bundles/scss/components/combo-box.scss +3 -0
  29. package/dist/bundles/scss/components/dialog.scss +3 -0
  30. package/dist/bundles/scss/components/edit.scss +3 -0
  31. package/dist/bundles/scss/components/radio-group.scss +3 -0
  32. package/dist/bundles/scss/components/tab.scss +3 -0
  33. package/dist/bundles/scss/components/tabular-grid.scss +10 -0
  34. package/dist/bundles/scss/components/tree-view.scss +3 -0
  35. package/dist/bundles/scss/resets/box-sizing.scss +3 -0
  36. package/dist/bundles/scss/utils/form--full.scss +16 -0
  37. package/dist/bundles/scss/utils/form.scss +4 -0
  38. package/dist/bundles/scss/utils/layout.scss +4 -0
  39. package/dist/bundles/scss/utils/typography.scss +9 -0
  40. package/dist/bundles.d.ts +71 -0
  41. package/dist/bundles.js +40 -0
  42. package/dist/mercury.scss +10124 -1129
  43. package/package.json +4 -3
  44. package/dist/css/mercury.css +0 -21833
  45. package/dist/css/mercury.css.map +0 -1
package/README.md CHANGED
@@ -72,3 +72,31 @@ npm i @genexus/mercury
72
72
  ]
73
73
  });
74
74
  ```
75
+
76
+ - Using the bundles from this repository.
77
+
78
+ 1. Install `sass` dependency to transpile the bundles.
79
+
80
+ ```bash
81
+ npm i -D sass
82
+ ```
83
+
84
+ 2. Add a config file in your project to determine the path to the assets.
85
+ Include the following configuration:
86
+
87
+ ```scss
88
+ $icons-path: "assets/custom/path/icons/";
89
+ $font-face-path: "assets/custom/path/fonts/";
90
+ ```
91
+
92
+ 3. Run the following command to transpile the bundles with the new path for the assets:
93
+
94
+ ```bash
95
+ npx sass --load-path=path/to/config/file/directory --no-source-map --style compressed node_modules/@genexus/mercury/dist/bundles/scss:untracked-folder/bundles
96
+ ```
97
+
98
+ For example:
99
+
100
+ ```bash
101
+ npx sass --load-path=src --no-source-map --style compressed node_modules/@genexus/mercury/dist/bundles/scss:untracked-folder/bundles
102
+ ```
@@ -1,3 +1,7 @@
1
+ import { GxImageMultiState, TreeViewImagePathCallback } from "@genexus/chameleon-controls-library";
2
+ import { RegistryGetImagePathCallback } from "@genexus/chameleon-controls-library/dist/types/index";
3
+ export { MercuryBundleBase, MercuryBundleComponent, MercuryBundleComponentForm, MercuryBundleFull, MercuryBundleOptimized, MercuryBundleReset, MercuryBundleUtil, MercuryBundleUtilFormFull, MercuryBundles } from "./bundles.js";
4
+ export { getThemeBundles } from "./bundles.js";
1
5
  export type AssetsMetadata = {
2
6
  category: string;
3
7
  name: string;
@@ -48,13 +52,6 @@ export type AssetsColorType = {
48
52
  export interface AssetsIconMetadata {
49
53
  name: string;
50
54
  }
51
- export type ImageMultiState = {
52
- base: string;
53
- hover?: string;
54
- active?: string;
55
- focus?: string;
56
- disabled?: string;
57
- };
58
55
  /**
59
56
  * Given a vendor and its assets, it register the assets of the vendor. After
60
57
  * the registration, the `getAsset` function can be used to retrieve any assets
@@ -80,11 +77,15 @@ export declare const getIconPath: (iconMetadata: AssetsMetadata, vendorAlias?: s
80
77
  * transforms both metadata into a string that contains the given information.
81
78
  */
82
79
  export declare const getIconPathExpanded: (iconMetadata: AssetsMetadata, iconMetadataExpanded: AssetsMetadata, vendorAlias?: string) => `${string}/${string}/${string}${string}:${string}/${string}/${string}${string}`;
83
- export declare const getImagePathCallback: (iconPath: string) => ImageMultiState | undefined;
84
- export declare const getTreeViewImagePathCallback: (item: {
85
- startImgSrc?: string;
86
- endImgSrc?: string;
87
- }, direction: "start" | "end") => {
88
- default: ImageMultiState;
89
- expanded?: ImageMultiState;
90
- } | undefined;
80
+ export declare const getImagePathCallback: (iconPath: string) => GxImageMultiState | undefined;
81
+ export declare const getTreeViewImagePathCallback: TreeViewImagePathCallback;
82
+ /**
83
+ * This object is used to register the getImagePathCallback definitions for all
84
+ * controls in Chameleon.
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * registryProperty("getImagePathCallback", getImagePathCallbackDefinitions);
89
+ * ```
90
+ */
91
+ export declare const getImagePathCallbackDefinitions: RegistryGetImagePathCallback;
@@ -1,4 +1,5 @@
1
- import { MERCURY_ASSETS } from "./assets/MERCURY_ASSETS";
1
+ import { MERCURY_ASSETS } from "./assets/MERCURY_ASSETS.js";
2
+ export { getThemeBundles } from "./bundles.js";
2
3
  const ASSETS_BY_VENDOR = {};
3
4
  const ALIAS_TO_VENDOR_NAME = {};
4
5
  const SEPARATOR = "/";
@@ -117,12 +118,12 @@ export const getImagePathCallback = (iconPath) => {
117
118
  }
118
119
  return result;
119
120
  };
120
- export const getTreeViewImagePathCallback = (item, direction) => {
121
- if ((!item.startImgSrc && direction === "start") ||
122
- (!item.endImgSrc && direction === "end")) {
121
+ export const getTreeViewImagePathCallback = (item, iconDirection) => {
122
+ if ((!item.startImgSrc && iconDirection === "start") ||
123
+ (!item.endImgSrc && iconDirection === "end")) {
123
124
  return undefined;
124
125
  }
125
- const imgSrc = direction === "start" ? item.startImgSrc : item.endImgSrc;
126
+ const imgSrc = iconDirection === "start" ? item.startImgSrc : item.endImgSrc;
126
127
  // Split the path into the collapsed (default) and expanded
127
128
  const collapsedAndExpandedSrc = imgSrc.split(EXPANDED_SEPARATOR);
128
129
  const defaultPath = getImagePathCallback(collapsedAndExpandedSrc[0]);
@@ -137,5 +138,19 @@ export const getTreeViewImagePathCallback = (item, direction) => {
137
138
  }
138
139
  : { default: defaultPath };
139
140
  };
141
+ /**
142
+ * This object is used to register the getImagePathCallback definitions for all
143
+ * controls in Chameleon.
144
+ *
145
+ * @example
146
+ * ```ts
147
+ * registryProperty("getImagePathCallback", getImagePathCallbackDefinitions);
148
+ * ```
149
+ */
150
+ export const getImagePathCallbackDefinitions = {
151
+ "ch-edit": getImagePathCallback,
152
+ "ch-image": getImagePathCallback,
153
+ "ch-tree-view-render": getTreeViewImagePathCallback
154
+ };
140
155
  // Initialize Mercury at the start
141
156
  registerAssets("Mercury", MERCURY_ALIAS, MERCURY_ASSETS);