oc 0.50.50 → 0.50.52

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 (37) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.turbo/turbo-test.log +47 -36
  3. package/CHANGELOG.md +12 -0
  4. package/dist/cli/facade/dev.d.ts +12 -12
  5. package/dist/components/oc-client/_package/package.json +5 -5
  6. package/dist/components/oc-client/_package/server.js +1 -1
  7. package/dist/components/oc-client/_package/src/oc-client.js +54 -56
  8. package/dist/components/oc-client/_package/src/oc-client.min.js +1 -1
  9. package/dist/components/oc-client/_package/src/oc-client.min.map +1 -1
  10. package/dist/components/oc-client/package-lock.json +2635 -10333
  11. package/dist/components/oc-client/package.json +2 -2
  12. package/dist/components/oc-client/src/oc-client.js +54 -56
  13. package/dist/components/oc-client/src/oc-client.min.js +1 -1
  14. package/dist/components/oc-client/src/oc-client.min.map +1 -1
  15. package/dist/registry/domain/extract-package.d.ts +2 -0
  16. package/dist/registry/domain/extract-package.js +3 -1
  17. package/dist/registry/routes/components.js +2 -2
  18. package/dist/registry/routes/publish.js +7 -0
  19. package/dist/registry/views/index.js +2 -1
  20. package/dist/registry/views/info.js +4 -3
  21. package/dist/registry/views/partials/component-parameters.js +6 -2
  22. package/dist/registry/views/partials/components-dependencies.js +1 -1
  23. package/dist/registry/views/partials/components-list.js +1 -1
  24. package/dist/registry/views/partials/components-plugins.js +1 -1
  25. package/dist/registry/views/partials/components-templates.js +3 -3
  26. package/dist/registry/views/partials/icon.d.ts +6 -0
  27. package/dist/registry/views/partials/icon.js +22 -0
  28. package/dist/registry/views/partials/layout.js +8 -4
  29. package/dist/registry/views/static/index.d.ts +1 -1
  30. package/dist/registry/views/static/index.js +22 -4
  31. package/dist/registry/views/static/info.d.ts +1 -1
  32. package/dist/registry/views/static/info.js +29 -0
  33. package/dist/registry/views/static/style.d.ts +1 -1
  34. package/dist/registry/views/static/style.js +799 -962
  35. package/dist/utils/put.js +6 -1
  36. package/package.json +24 -23
  37. package/tsconfig.json +1 -0
@@ -11,7 +11,7 @@
11
11
  > oc@0.50.50 lint
12
12
  > npx @biomejs/biome check preview src test tasks
13
13
 
14
- ⠙⠹⠸⠼Checked 128 files in 27ms. No fixes applied.
14
+ ⠙⠹⠸⠼Checked 128 files in 36ms. No fixes applied.
15
15
  ⠙⠙Building client
16
16
  compiling component /Users/Ricardo.Agullo/Work/oc/packages/oc/src/components/oc-client/
17
17
  Client has been built and packaged 👍
@@ -1,21 +1,21 @@
1
1
 
2
2
  
3
- > oc@0.50.47 test
3
+ > oc@0.50.50 test
4
4
  > npm run build && node tasks/mochaTest.js
5
5
 
6
6
 
7
- > oc@0.50.47 prebuild
7
+ > oc@0.50.50 prebuild
8
8
  > rimraf dist
9
9
 
10
10
  ⠙
11
- > oc@0.50.47 build
11
+ > oc@0.50.50 build
12
12
  > npm run lint && tsc && node tasks/build.js
13
13
 
14
14
  ⠙
15
- > oc@0.50.47 lint
15
+ > oc@0.50.50 lint
16
16
  > npx @biomejs/biome check preview src test tasks
17
17
 
18
- ⠙⠹Checked 128 files in 26ms. No fixes applied.
18
+ ⠙⠹⠸Checked 128 files in 33ms. No fixes applied.
19
19
  ⠙⠙Building client
20
20
  compiling component /Users/Ricardo.Agullo/Work/oc/packages/oc/src/components/oc-client/
21
21
  Client has been built and packaged 👍
@@ -35,13 +35,6 @@ compiling component /Users/Ricardo.Agullo/Work/oc/packages/oc/test/fixtures/comp
35
35
  Test components packaged 👍
36
36
 
37
37
  
38
-  The targz dependency
39
-  when compressing a folder with targz
40
-  ✔ should create the file
41
-  when decompressing the created file
42
-  ✔ should throw no error
43
-  ✔ should contain the files
44
-
45
38
   cli : domain : clean
46
39
   when fetching the list of folders to clean
47
40
   happy path
@@ -293,7 +286,7 @@ compiling component /Users/Ricardo.Agullo/Work/oc/packages/oc/test/fixtures/comp
293
286
   ✔ should show error message
294
287
   when href = /component
295
288
   ✔ href should be /component/~preview/
296
- (node:98422) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities.
289
+ (node:92394) [DEP0169] DeprecationWarning: `url.parse()` behavior is not standardized and prone to errors that have security implications. Use the WHATWG URL API instead. CVEs are not issued for `url.parse()` vulnerabilities.
297
290
  (Use `node --trace-deprecation ...` to show where the warning was created)
298
291
   when href = /component/1.X.X
299
292
   ✔ href should be /component/1.X.X/~preview/
@@ -579,6 +572,7 @@ compiling component /Users/Ricardo.Agullo/Work/oc/packages/oc/test/fixtures/comp
579
572
   ✔ should not error
580
573
   ✔ should return the details
581
574
   ✔ should fetch the details from components-details.json
575
+  ✔ should cache the details after the first fetch
582
576
   when details file does not exist on cdn
583
577
   ✔ should return an error
584
578
   refresh()
@@ -596,6 +590,7 @@ compiling component /Users/Ricardo.Agullo/Work/oc/packages/oc/test/fixtures/comp
596
590
   when component details save succeeds
597
591
   ✔ should not error
598
592
   ✔ should return result
593
+  ✔ should cache the refreshed details
599
594
   when details file is up-to-date on cdn
600
595
   ✔ should not error
601
596
   ✔ should not save it
@@ -613,6 +608,13 @@ compiling component /Users/Ricardo.Agullo/Work/oc/packages/oc/test/fixtures/comp
613
608
   when component details save succeeds
614
609
   ✔ should not error
615
610
   ✔ should return result
611
+  polling
612
+  ✔ should start the polling loop using the configured interval
613
+  ✔ should clear the previous loop when refreshing again
614
+  ✔ should restart the loop after each poll
615
+  ✔ should update the cache when the polled data is newer
616
+  ✔ should keep the cached data when the polled data is not newer
617
+  ✔ should fire an error event when polling fails
616
618
 
617
619
   registry : domain : events-handler
618
620
   when requiring it multiple times
@@ -673,57 +675,57 @@ compiling component /Users/Ricardo.Agullo/Work/oc/packages/oc/test/fixtures/comp
673
675
 
674
676
   registry : domain : options-sanitiser
675
677
   when options is empty
676
-  ✔ should set prefix to "/" (177ms)
678
+  ✔ should set prefix to "/" (192ms)
677
679
   ✔ should set tempDir to "./temp/" (84ms)
678
-  ✔ should set hotReloading to false (66ms)
679
-  ✔ should set verbosity to 0 (65ms)
680
-  ✔ should set customHeadersToSkipOnWeakVersion to [] (63ms)
681
-  ✔ should set timeout to 120000 (82ms)
680
+  ✔ should set hotReloading to false (69ms)
681
+  ✔ should set verbosity to 0 (88ms)
682
+  ✔ should set customHeadersToSkipOnWeakVersion to [] (68ms)
683
+  ✔ should set timeout to 120000 (64ms)
682
684
   when verbosity is provided
683
-  ✔ should leave value untouched (60ms)
685
+  ✔ should leave value untouched (64ms)
684
686
   customHeadersToSkipOnWeakVersion
685
687
   when it contains valid elements
686
-  ✔ should convert the array elements to lower case (62ms)
688
+  ✔ should convert the array elements to lower case (64ms)
687
689
   fallbackRegistryUrl
688
690
   when fallbackRegistryUrl doesn't contain / at the end of url
689
-  ✔ should add `/` at the end of url (57ms)
691
+  ✔ should add `/` at the end of url (60ms)
690
692
   when fallbackRegistryUrl contains `/` at the end of url
691
-  ✔ should not modify fallbackRegistryUrl url (57ms)
693
+  ✔ should not modify fallbackRegistryUrl url (58ms)
692
694
   prefix and baseUrl sanitization
693
-  ✔ should support various scenarios correctly (745ms)
695
+  ✔ should support various scenarios correctly (901ms)
694
696
   when pollingInterval
695
697
   is provided
696
-  ✔ should not modify it (54ms)
698
+  ✔ should not modify it (56ms)
697
699
   is not provided
698
-  ✔ should initialize it as 5000 (56ms)
700
+  ✔ should initialize it as 5000 (59ms)
699
701
   when templates
700
702
   is provided
701
703
   ✔ should not modify it
702
704
   is not provided
703
-  ✔ should initialize it as 5000 (54ms)
705
+  ✔ should initialize it as 5000 (56ms)
704
706
   when env
705
707
   is provided
706
-  ✔ should not modify it (52ms)
708
+  ✔ should not modify it (54ms)
707
709
   is not provided
708
-  ✔ should initialize it as an empty {} (53ms)
710
+  ✔ should initialize it as an empty {} (58ms)
709
711
   storage adapter configuration
710
712
   when legacy "s3" param
711
713
   is provided
712
-  ✔ should create a storage.adapter configuration accordingly (236ms)
714
+  ✔ should create a storage.adapter configuration accordingly (289ms)
713
715
   when no storage adapter
714
716
   is provided
715
-  ✔ should default to the oc-s3-storage-adapter (54ms)
717
+  ✔ should default to the oc-s3-storage-adapter (63ms)
716
718
   when refreshInterval
717
719
   is provided
718
-  ✔ should pass the refreshInterval to the storage options (54ms)
720
+  ✔ should pass the refreshInterval to the storage options (66ms)
719
721
   when verbosity
720
722
   is provided
721
-  ✔ should pass the verbosity to the storage options (55ms)
723
+  ✔ should pass the verbosity to the storage options (60ms)
722
724
   when storage.path
723
725
   does not include a protocol
724
-  ✔ should sanitize the path to rely on the https protocol (53ms)
726
+  ✔ should sanitize the path to rely on the https protocol (63ms)
725
727
   does include a prefix
726
-  ✔ should not modify it (53ms)
728
+  ✔ should not modify it (63ms)
727
729
 
728
730
   registry : domain : plugins-initialiser
729
731
   when initialising not valid plugins
@@ -807,6 +809,8 @@ compiling component /Users/Ricardo.Agullo/Work/oc/packages/oc/test/fixtures/comp
807
809
   ✔ should refresh cached components list
808
810
   ✔ should refresh componens details
809
811
   ✔ should store the component in the correct directory
812
+  when refreshing details is slow
813
+  ✔ should resolve publish before details refresh finishes
810
814
   when on local configuration
811
815
   when getting the list of available components
812
816
   ✔ should respond without an error
@@ -1154,7 +1158,7 @@ compiling component /Users/Ricardo.Agullo/Work/oc/packages/oc/test/fixtures/comp
1154
1158
   ✔ should return component's name and request version for both requests
1155
1159
   when getting a component that implements a plugin
1156
1160
   when plugin not declared in package.json
1157
- (node:98422) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead. (Triggered by calling processImmediate on process.)
1161
+ (node:92394) [DEP0097] DeprecationWarning: Using a domain property in MakeCallback is deprecated. Use the async_context variant of MakeCallback or the AsyncResource class instead. (Triggered by calling processImmediate on process.)
1158
1162
   ✔ should return 500 status code
1159
1163
   ✔ should respond with GENERIC_ERROR error code
1160
1164
   ✔ should respond with error message including missing plugin
@@ -1451,6 +1455,13 @@ compiling component /Users/Ricardo.Agullo/Work/oc/packages/oc/test/fixtures/comp
1451
1455
   when a version is not included
1452
1456
   ✔ should return the unmodified dependency
1453
1457
 
1458
+  The targz dependency
1459
+  when compressing a folder with targz
1460
+  ✔ should create the file
1461
+  when decompressing the created file
1462
+  ✔ should throw no error
1463
+  ✔ should contain the files
1464
+
1454
1465
   registry (ui interface)
1455
1466
   GET / with Accept: text/html
1456
1467
   ✔ should not error
@@ -1607,6 +1618,6 @@ compiling component /Users/Ricardo.Agullo/Work/oc/packages/oc/test/fixtures/comp
1607
1618
   ✔ should respond with components parameters
1608
1619
 
1609
1620
 
1610
-   838 passing (8s)
1621
+   847 passing (10s)
1611
1622
 
1612
1623
  ⠙
package/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  ## Change Log
2
2
 
3
+ ## 0.50.52
4
+
5
+ ### Patch Changes
6
+
7
+ - Fix undici breaking change on v8
8
+
9
+ ## 0.50.51
10
+
11
+ ### Patch Changes
12
+
13
+ - improve UI. clean publish temp. improve perf
14
+
3
15
  ## 0.50.50
4
16
 
5
17
  ### Patch Changes
@@ -18,7 +18,7 @@ declare const dev: ({ local, logger }: {
18
18
  verbose?: boolean;
19
19
  production?: boolean;
20
20
  }): Promise<{
21
- close: (callback: (err?: Error | undefined | string) => void) => void | import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
21
+ close: (callback: (err?: Error | undefined | string) => void) => void | import("node:http").Server<typeof import("node:http").IncomingMessage, typeof import("node:http").ServerResponse>;
22
22
  on: <T extends keyof {
23
23
  error: {
24
24
  code: string;
@@ -28,9 +28,9 @@ declare const dev: ({ local, logger }: {
28
28
  'cache-poll': number;
29
29
  request: import("../../registry/domain/events-handler").RequestData;
30
30
  'component-retrieved': {
31
- headers: import("http").IncomingHttpHeaders;
31
+ headers: import("node:http").IncomingHttpHeaders;
32
32
  name: string;
33
- parameters: import("http").IncomingHttpHeaders;
33
+ parameters: import("node:http").IncomingHttpHeaders;
34
34
  requestVersion: string;
35
35
  duration: number;
36
36
  };
@@ -58,9 +58,9 @@ declare const dev: ({ local, logger }: {
58
58
  'cache-poll': number;
59
59
  request: import("../../registry/domain/events-handler").RequestData;
60
60
  'component-retrieved': {
61
- headers: import("http").IncomingHttpHeaders;
61
+ headers: import("node:http").IncomingHttpHeaders;
62
62
  name: string;
63
- parameters: import("http").IncomingHttpHeaders;
63
+ parameters: import("node:http").IncomingHttpHeaders;
64
64
  requestVersion: string;
65
65
  duration: number;
66
66
  };
@@ -83,7 +83,7 @@ declare const dev: ({ local, logger }: {
83
83
  register: <T = any>(plugin: oc.Plugin<T>, callback?: ((...args: any[]) => void) | undefined) => void;
84
84
  start: (callback: (err: unknown, data?: {
85
85
  app: import("express").Express;
86
- server: import("http").Server;
86
+ server: import("node:http").Server;
87
87
  } | undefined) => void) => Promise<void>;
88
88
  app: import("express").Express;
89
89
  }>;
@@ -100,7 +100,7 @@ declare const dev: ({ local, logger }: {
100
100
  verbose?: boolean;
101
101
  production?: boolean;
102
102
  }, arguments__1: (error: unknown, value: {
103
- close: (callback: (err?: Error | undefined | string) => void) => void | import("http").Server<typeof import("http").IncomingMessage, typeof import("http").ServerResponse>;
103
+ close: (callback: (err?: Error | undefined | string) => void) => void | import("node:http").Server<typeof import("node:http").IncomingMessage, typeof import("node:http").ServerResponse>;
104
104
  on: <T extends keyof {
105
105
  error: {
106
106
  code: string;
@@ -110,9 +110,9 @@ declare const dev: ({ local, logger }: {
110
110
  'cache-poll': number;
111
111
  request: import("../../registry/domain/events-handler").RequestData;
112
112
  'component-retrieved': {
113
- headers: import("http").IncomingHttpHeaders;
113
+ headers: import("node:http").IncomingHttpHeaders;
114
114
  name: string;
115
- parameters: import("http").IncomingHttpHeaders;
115
+ parameters: import("node:http").IncomingHttpHeaders;
116
116
  requestVersion: string;
117
117
  duration: number;
118
118
  };
@@ -140,9 +140,9 @@ declare const dev: ({ local, logger }: {
140
140
  'cache-poll': number;
141
141
  request: import("../../registry/domain/events-handler").RequestData;
142
142
  'component-retrieved': {
143
- headers: import("http").IncomingHttpHeaders;
143
+ headers: import("node:http").IncomingHttpHeaders;
144
144
  name: string;
145
- parameters: import("http").IncomingHttpHeaders;
145
+ parameters: import("node:http").IncomingHttpHeaders;
146
146
  requestVersion: string;
147
147
  duration: number;
148
148
  };
@@ -165,7 +165,7 @@ declare const dev: ({ local, logger }: {
165
165
  register: <T = any>(plugin: oc.Plugin<T>, callback?: ((...args: any[]) => void) | undefined) => void;
166
166
  start: (callback: (err: unknown, data?: {
167
167
  app: import("express").Express;
168
- server: import("http").Server;
168
+ server: import("node:http").Server;
169
169
  } | undefined) => void) => Promise<void>;
170
170
  app: import("express").Express;
171
171
  }) => void): void;
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "oc-client",
3
3
  "description": "The OpenComponents client-side javascript client",
4
- "version": "0.50.50",
4
+ "version": "0.50.51",
5
5
  "repository": "https://github.com/opencomponents/oc/tree/master/components/oc-client",
6
6
  "author": "Matteo Figus <matteofigus@gmail.com>",
7
7
  "oc": {
@@ -23,16 +23,16 @@
23
23
  ],
24
24
  "dataProvider": {
25
25
  "type": "node.js",
26
- "hashKey": "6c80f5fa8b874aa6454c4283f87796382ef83789",
26
+ "hashKey": "eb6f0f6e8adbdc8373db06539b04c840ac3faa2a",
27
27
  "src": "server.js",
28
28
  "size": 644
29
29
  }
30
30
  },
31
- "version": "0.50.50",
31
+ "version": "0.50.51",
32
32
  "packaged": true,
33
- "date": 1781085467922
33
+ "date": 1781764817361
34
34
  },
35
35
  "devDependencies": {
36
- "oc-template-es6-compiler": "^1.0.1"
36
+ "oc-template-es6-compiler": "^8.0.0"
37
37
  }
38
38
  }
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=(t,s)=>{const{staticPath:e,templates:a}=t;return s(null,{staticPath:e,templates:a})},r=(t,s)=>{o(t,(e,a,i={})=>{if(e)return s(e);if(a==null)return s(null,{__oc_emptyResponse:!0});const n=t.action?a:Object.assign({},a,{_staticPath:t.staticPath,_baseUrl:t.baseUrl,_componentName:"oc-client",_componentVersion:"0.50.50"}),c=t.staticPath.indexOf("http")===0?t.staticPath:"https:"+t.staticPath;return s(null,Object.assign({},{component:{key:"c4abb6bf4dc6657fb718a45b64bd6b2cb92e874a",src:c+"template.js",props:n,esm:!1,development:void 0}}))})};exports.data=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=(t,s)=>{const{staticPath:e,templates:a}=t;return s(null,{staticPath:e,templates:a})},r=(t,s)=>{o(t,(e,a,i={})=>{if(e)return s(e);if(a==null)return s(null,{__oc_emptyResponse:!0});const n=t.action?a:Object.assign({},a,{_staticPath:t.staticPath,_baseUrl:t.baseUrl,_componentName:"oc-client",_componentVersion:"0.50.51"}),c=t.staticPath.indexOf("http")===0?t.staticPath:"https:"+t.staticPath;return s(null,Object.assign({},{component:{key:"c4abb6bf4dc6657fb718a45b64bd6b2cb92e874a",src:c+"template.js",props:n,esm:!1,development:void 0}}))})};exports.data=r;
@@ -445,15 +445,15 @@
445
445
  if (o.stack) e.stack = o.stack;
446
446
  return Object.assign(e, o.originalError, o);
447
447
  }
448
- function createOc(oc2) {
449
- if (oc2.status) {
450
- return oc2;
448
+ function createOc(oc) {
449
+ if (oc.status) {
450
+ return oc;
451
451
  }
452
- oc2.status = "loading";
453
- oc2.conf = oc2.conf || {};
454
- oc2.cmd = oc2.cmd || [];
455
- oc2.renderedComponents = oc2.renderedComponents || {};
456
- oc2.clientVersion = "2.1.10";
452
+ oc.status = "loading";
453
+ oc.conf = oc.conf || {};
454
+ oc.cmd = oc.cmd || [];
455
+ oc.renderedComponents = oc.renderedComponents || {};
456
+ oc.clientVersion = "2.1.10";
457
457
  let isRequired = (name, value) => {
458
458
  if (!value) {
459
459
  throw name + " parameter is required";
@@ -468,9 +468,9 @@
468
468
  let retries = {};
469
469
  let isBool = (a) => typeof a == "boolean";
470
470
  let timeout = setTimeout;
471
- let ocCmd = oc2.cmd;
472
- let ocConf = oc2.conf;
473
- let renderedComponents = oc2.renderedComponents;
471
+ let ocCmd = oc.cmd;
472
+ let ocConf = oc.conf;
473
+ let renderedComponents = oc.renderedComponents;
474
474
  let dataRenderedAttribute = "data-rendered";
475
475
  let dataRenderingAttribute = "data-rendering";
476
476
  let nonce = $document.currentScript?.nonce;
@@ -551,7 +551,7 @@
551
551
  ...typeof globalHeaders == "function" ? globalHeaders() : globalHeaders
552
552
  };
553
553
  };
554
- oc2.addStylesToHead = (styles) => {
554
+ oc.addStylesToHead = (styles) => {
555
555
  let style = $document.createElement("style");
556
556
  style.textContent = styles;
557
557
  if (nonce) {
@@ -560,14 +560,14 @@
560
560
  $document.head.appendChild(style);
561
561
  };
562
562
  let loadAfterReady = () => {
563
- oc2.ready(oc2.renderUnloadedComponents);
563
+ oc.ready(oc.renderUnloadedComponents);
564
564
  };
565
- oc2.registerTemplates = (templates) => {
565
+ oc.registerTemplates = (templates) => {
566
566
  registerTemplates(templates);
567
567
  loadAfterReady();
568
568
  return registeredTemplates;
569
569
  };
570
- oc2.require = (nameSpace, url, callback) => {
570
+ oc.require = (nameSpace, url, callback) => {
571
571
  if (!callback) {
572
572
  callback = url;
573
573
  url = nameSpace;
@@ -607,12 +607,12 @@
607
607
  callback(loaded);
608
608
  } else {
609
609
  let loading = toLoad[0];
610
- oc2.require(loading.global, loading.url, (resolved) => {
610
+ oc.require(loading.global, loading.url, (resolved) => {
611
611
  asyncRequireForEach(toLoad.slice(1), loaded.concat(resolved), callback);
612
612
  });
613
613
  }
614
614
  };
615
- oc2.requireSeries = asyncRequireForEach;
615
+ oc.requireSeries = asyncRequireForEach;
616
616
  let processHtml = (component, data, callback) => {
617
617
  let setAttribute = component.setAttribute.bind(component);
618
618
  let dataName = data.name;
@@ -636,7 +636,7 @@
636
636
  renderedComponents[dataName].baseUrl = data.baseUrl;
637
637
  }
638
638
  data.element = component;
639
- oc2.events.fire("oc:rendered", { ...data, id: data.ocId });
639
+ oc.events.fire("oc:rendered", { ...data, id: data.ocId });
640
640
  }
641
641
  callback();
642
642
  };
@@ -677,8 +677,8 @@
677
677
  }
678
678
  }).catch(cb);
679
679
  };
680
- oc2.getData = getData;
681
- oc2.getAction = (options) => {
680
+ oc.getData = getData;
681
+ oc.getAction = (options) => {
682
682
  return new Promise((resolve, reject) => {
683
683
  let name = options.component;
684
684
  getData(
@@ -707,7 +707,7 @@
707
707
  );
708
708
  });
709
709
  };
710
- oc2.build = (options) => {
710
+ oc.build = (options) => {
711
711
  isRequired("baseUrl", options.baseUrl);
712
712
  isRequired("name", options.name);
713
713
  let withFinalSlash = (s) => {
@@ -727,7 +727,7 @@
727
727
  }
728
728
  return "<" + OC_TAG + ' href="' + href + '"></' + OC_TAG + ">";
729
729
  };
730
- oc2.ready = (callback) => {
730
+ oc.ready = (callback) => {
731
731
  if (initialised) {
732
732
  callback();
733
733
  } else if (initialising) {
@@ -737,7 +737,7 @@
737
737
  let done = () => {
738
738
  initialised = true;
739
739
  initialising = false;
740
- oc2.events = /* @__PURE__ */ (() => {
740
+ oc.events = /* @__PURE__ */ (() => {
741
741
  let listeners = {};
742
742
  return {
743
743
  fire(key, data) {
@@ -787,16 +787,16 @@
787
787
  );
788
788
  }
789
789
  callback();
790
- oc2.events.fire("oc:ready", oc2);
791
- oc2.status = "ready";
790
+ oc.events.fire("oc:ready", oc);
791
+ oc.status = "ready";
792
792
  ocCmd.map((cmd) => {
793
- cmd(oc2);
793
+ cmd(oc);
794
794
  });
795
- oc2.cmd = {
796
- push: (f) => f(oc2)
795
+ oc.cmd = {
796
+ push: (f) => f(oc)
797
797
  };
798
798
  };
799
- oc2.requireSeries(externals, done);
799
+ oc.requireSeries(externals, done);
800
800
  }
801
801
  };
802
802
  const renderOc = (template, apiResponse, callback) => {
@@ -804,7 +804,7 @@
804
804
  if (isEsm) {
805
805
  renderEsm(apiResponse.data, callback);
806
806
  } else {
807
- oc2.render(template, apiResponse.data, callback);
807
+ oc.render(template, apiResponse.data, callback);
808
808
  }
809
809
  };
810
810
  const renderEsm = async (data, callback) => {
@@ -825,8 +825,8 @@
825
825
  callback(error);
826
826
  }
827
827
  };
828
- oc2.render = (compiledViewInfo, model, callback) => {
829
- oc2.ready(() => {
828
+ oc.render = (compiledViewInfo, model, callback) => {
829
+ oc.ready(() => {
830
830
  if (model && model.__oc_emptyResponse == true) {
831
831
  return callback(null, "");
832
832
  }
@@ -838,7 +838,7 @@
838
838
  }
839
839
  let template = registeredTemplates[type];
840
840
  if (template) {
841
- oc2.require(
841
+ oc.require(
842
842
  ["oc", "components", compiledViewInfo.key],
843
843
  compiledViewInfo.src,
844
844
  (compiledView) => {
@@ -873,8 +873,8 @@
873
873
  }
874
874
  });
875
875
  };
876
- oc2.renderNestedComponent = (component, callback) => {
877
- oc2.ready(() => {
876
+ oc.renderNestedComponent = (component, callback) => {
877
+ oc.ready(() => {
878
878
  component = component[0] || component;
879
879
  let getAttribute = component.getAttribute.bind(component);
880
880
  let setAttribute = component.setAttribute.bind(component);
@@ -888,7 +888,7 @@
888
888
  }
889
889
  if (isRendering) {
890
890
  timeout(() => {
891
- oc2.renderNestedComponent(component, callback);
891
+ oc.renderNestedComponent(component, callback);
892
892
  }, POLLING_INTERVAL);
893
893
  return;
894
894
  }
@@ -897,7 +897,7 @@
897
897
  if (!DISABLE_LOADER) {
898
898
  component.innerHTML = '<div class="oc-loading">' + MESSAGES_LOADING_COMPONENT + "</div>";
899
899
  }
900
- oc2.renderByHref(
900
+ oc.renderByHref(
901
901
  {
902
902
  href: getAttribute("href"),
903
903
  id: getAttribute("id"),
@@ -909,7 +909,7 @@
909
909
  setAttribute(dataRenderedAttribute, false);
910
910
  setAttribute("data-failed", true);
911
911
  component.innerHTML = "";
912
- oc2.events.fire("oc:failed", {
912
+ oc.events.fire("oc:failed", {
913
913
  originalError: err,
914
914
  data,
915
915
  component
@@ -923,14 +923,14 @@
923
923
  );
924
924
  });
925
925
  };
926
- oc2.renderByHref = (hrefOrOptions, retryNumberOrCallback, callback) => {
926
+ oc.renderByHref = (hrefOrOptions, retryNumberOrCallback, callback) => {
927
927
  callback = callback || retryNumberOrCallback;
928
928
  let ocId = Math.floor(Math.random() * 9999999999);
929
929
  let retryNumber = hrefOrOptions.retryNumber || +retryNumberOrCallback || 0;
930
930
  let href = hrefOrOptions.href || hrefOrOptions;
931
931
  let id = hrefOrOptions.id || ocId;
932
932
  let element = hrefOrOptions.element;
933
- oc2.ready(() => {
933
+ oc.ready(() => {
934
934
  if (!href) {
935
935
  callback(MESSAGES_ERRORS_RENDERING + MESSAGES_ERRORS_HREF_MISSING);
936
936
  } else {
@@ -976,7 +976,7 @@
976
976
  retry(
977
977
  href,
978
978
  (requestNumber) => {
979
- oc2.renderByHref(
979
+ oc.renderByHref(
980
980
  {
981
981
  href,
982
982
  retryNumber: requestNumber,
@@ -994,28 +994,28 @@
994
994
  }
995
995
  });
996
996
  };
997
- oc2.renderUnloadedComponents = () => {
998
- oc2.ready(() => {
997
+ oc.renderUnloadedComponents = () => {
998
+ oc.ready(() => {
999
999
  let unloadedComponents = $document.querySelectorAll(
1000
1000
  `${OC_TAG}:not([data-rendered="true"]):not([data-failed="true"])`
1001
1001
  );
1002
1002
  unloadedComponents.forEach((unloadedComponent, idx) => {
1003
- oc2.renderNestedComponent(unloadedComponent, () => {
1003
+ oc.renderNestedComponent(unloadedComponent, () => {
1004
1004
  if (idx == unloadedComponents.length - 1) {
1005
- oc2.renderUnloadedComponents();
1005
+ oc.renderUnloadedComponents();
1006
1006
  }
1007
1007
  });
1008
1008
  });
1009
1009
  });
1010
1010
  };
1011
- oc2.load = (placeholder, href, callback) => {
1012
- oc2.ready(() => {
1011
+ oc.load = (placeholder, href, callback) => {
1012
+ oc.ready(() => {
1013
1013
  callback = callback || noop;
1014
1014
  if (placeholder) {
1015
1015
  placeholder = placeholder[0] || placeholder;
1016
1016
  placeholder.innerHTML = "<" + OC_TAG + ' href="' + href + '" />';
1017
1017
  let newComponent = placeholder.querySelector(OC_TAG);
1018
- oc2.renderNestedComponent(newComponent, () => {
1018
+ oc.renderNestedComponent(newComponent, () => {
1019
1019
  callback(newComponent);
1020
1020
  });
1021
1021
  }
@@ -1045,7 +1045,7 @@
1045
1045
  for (const entry of entries) {
1046
1046
  if (entry.isIntersecting) {
1047
1047
  observer.disconnect();
1048
- oc2.renderNestedComponent(this, () => {
1048
+ oc.renderNestedComponent(this, () => {
1049
1049
  });
1050
1050
  break;
1051
1051
  }
@@ -1053,7 +1053,7 @@
1053
1053
  });
1054
1054
  observer.observe(this);
1055
1055
  } else {
1056
- oc2.renderNestedComponent(this, () => {
1056
+ oc.renderNestedComponent(this, () => {
1057
1057
  });
1058
1058
  }
1059
1059
  }
@@ -1063,7 +1063,7 @@
1063
1063
  this.#connected = false;
1064
1064
  const id = this.getAttribute("id");
1065
1065
  if (id) {
1066
- oc2.events.fire("oc:unrendered", {
1066
+ oc.events.fire("oc:unrendered", {
1067
1067
  element: this,
1068
1068
  id
1069
1069
  });
@@ -1078,12 +1078,10 @@
1078
1078
  }
1079
1079
  );
1080
1080
  }
1081
- return oc2;
1081
+ return oc;
1082
1082
  }
1083
1083
 
1084
1084
  // src/index.js
1085
- var oc = window.oc || {};
1086
- var ljs2 = new LJS();
1087
- window.ljs = ljs2;
1088
- window.oc = createOc(oc);
1085
+ window.ljs = new LJS();
1086
+ window.oc = createOc(window.oc || {});
1089
1087
  })();