native-document 1.0.275 → 1.0.277

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,35 @@
1
+ export { default as BaseComponent } from './src/components/BaseComponent';
2
+ export * from './src/components/accordion/index';
3
+ export * from './src/components/alert/index';
4
+ export * from './src/components/avatar/index';
5
+ export * from './src/components/badge/index';
6
+ export * from './src/components/breadcrumb/index';
7
+ export * from './src/components/button/index';
8
+ export * from './src/components/card/index';
9
+ export * from './src/components/drawer/index';
10
+ export * from './src/components/context-menu/index';
11
+ export * from './src/components/divider/index';
12
+ export * from './src/components/dropdown/index';
13
+ export * from './src/components/form/index';
14
+ export * from './src/components/list/index';
15
+ export * from './src/components/menu/index';
16
+ export * from './src/components/modal/index';
17
+ export * from './src/components/modal/createModal';
18
+ export * from './src/components/pagination/index';
19
+ export * from './src/components/popover/index';
20
+ export * from './src/components/progress/index';
21
+ export * from './src/components/skeleton/index';
22
+ export * from './src/components/slider/index';
23
+ export * from './src/components/spinner/index';
24
+ export * from './src/components/splitter/index';
25
+ export * from './src/components/stepper/index';
26
+ export * from './src/components/switch/index';
27
+ export * from './src/components/table/index';
28
+
29
+ export * from './src/components/tabs/index';
30
+ export * from './src/components/toast/index';
31
+ export * from './src/components/tooltip/index';
32
+ export * from './src/components/stacks/index';
33
+ export * from './src/components/spacer/index';
34
+
35
+ export * from './src/components/icon/index';
@@ -62,7 +62,8 @@ const ComponentRegistry = (function() {
62
62
  registryItem.instances.add(instance);
63
63
 
64
64
  attachLocalExtensions(instance, factoryInstance);
65
- return anchor;
65
+ factoryInstance.toNdElement = () => anchor;
66
+ return factoryInstance;
66
67
  };
67
68
  };
68
69
 
@@ -0,0 +1,2 @@
1
+
2
+ export const TRANSFORMED_OBSERVABLE_ID = '#__@TRANSFORMED_OBSERVABLE_ID@__#';
@@ -2,10 +2,13 @@ import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
 
4
4
  import { fileURLToPath } from 'node:url';
5
+ import {TRANSFORMED_OBSERVABLE_ID} from '../constantes';
5
6
 
6
7
  const __filename = fileURLToPath(import.meta.url);
7
8
  const __dirname = path.dirname(__filename);
8
9
 
10
+
11
+
9
12
  export function template(code, params) {
10
13
  let codeFormatted = code;
11
14
  for(const key in params) {
@@ -34,7 +37,11 @@ export function renameImportedObservables(content, match) {
34
37
  }
35
38
 
36
39
  export function transformObservableImports(code, params = {}) {
37
- return code.replace(/import\s+\{([^}]+?)\}\s+from\s+['"]native-document['"]/g, renameImportedObservables);
40
+ code = code.replace(/import\s+\{([^}]+?)\}\s+from\s+['"]native-document['"]/g, renameImportedObservables);
41
+
42
+ return code.replace(/import\s+\{([^}]+?)\}\s+from\s+['"]native-document\/components['"]/g, (content, match) => {
43
+ return `import {${match} } from 'native-document/components.hrm'`;
44
+ });
38
45
  }
39
46
 
40
47
  export function transformObservableDeclarations(code, id) {
@@ -42,7 +49,7 @@ export function transformObservableDeclarations(code, id) {
42
49
 
43
50
  return code.replace(regex, (match, varType, varName, caller, method) => {
44
51
  const obsName = method ? `${caller}${method}` : caller;
45
- return `${varType} ${varName} = ${obsName}('${varName}', '${id}', (typeof arguments !== 'undefined') ? Array.from(arguments).at(-1) : null, `;
52
+ return `${varType} ${varName} = ${obsName}('${TRANSFORMED_OBSERVABLE_ID}', '${varName}', '${id}', (typeof arguments !== 'undefined') ? Array.from(arguments).at(-1) : null, `;
46
53
  });
47
54
  }
48
55
 
@@ -51,6 +58,9 @@ export function isFileMustBeModified(file) {
51
58
  return false;
52
59
  }
53
60
  const content = fs.readFileSync(file, 'utf-8');
61
+ if(/@ignore-hrm/.test(content)) {
62
+ return false;
63
+ }
54
64
  const isContainObservableImport = /import\s+\{([^}]+?)\}\s+from\s+['"]native-document['"]/g.test(content);
55
65
  if(isContainObservableImport) {
56
66
  return true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "native-document",
3
- "version": "1.0.275",
3
+ "version": "1.0.277",
4
4
  "description": "A reactive JavaScript framework that preserves native DOM simplicity without sacrificing modern features",
5
5
  "author": "AfroCodeur <https://github.com/afrocodeur>",
6
6
  "license": "MIT",
@@ -1,13 +1,18 @@
1
1
  import {Observable as ObservableOriginal} from './Observable';
2
+ import {call} from '@babel/traverse/lib/path/context';
3
+ import {TRANSFORMED_OBSERVABLE_ID} from '../../../devtools/constantes';
2
4
 
3
5
  const HrmGlobakObservableRegistry = new Map();
4
6
 
5
- const overrideMethods = ['array', 'init', 'object', 'json'];
7
+ const overrideMethods = ['array', 'init', 'object', 'json', 'computed', 'batch'];
6
8
  const noObservableOverride = ['ref', 'resource'];
7
9
 
8
10
 
9
11
  const override = (callback) => {
10
- return function(name, id, scope, value, configs = null) {
12
+ return function(transformed_key, name, id, scope, value, configs = null) {
13
+ if(transformed_key !== TRANSFORMED_OBSERVABLE_ID) {
14
+ return callback(...arguments);
15
+ }
11
16
  if(!scope?.__hrm) {
12
17
  scope = null;
13
18
  }