@nectary/labs 2.5.38 → 2.5.40

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.
package/utils/element.js CHANGED
@@ -1,61 +1,70 @@
1
- import pkg from '../package.json';
2
- const nectaryDefinitions = new Map();
1
+ const version = "2.8.3";
2
+ const pkg = {
3
+ version
4
+ };
5
+ const nectaryDefinitions = /* @__PURE__ */ new Map();
3
6
  let nectaryRegistry = null;
4
- export const defineCustomElement = (name, constructor) => {
5
- console.log(`Defining custom element: ${name} nectaryRegistry`, nectaryRegistry);
6
- if (nectaryRegistry !== null) {
7
- if (nectaryRegistry.get(name) == null) {
8
- nectaryRegistry.define(name, constructor);
9
- console.log(`Custom element ${name} defined immediately`);
10
- }
11
- console.log(`Custom element ${name} already defined in registry`);
12
- return;
7
+ const defineCustomElement = (name, constructor) => {
8
+ console.log(`Defining custom element: ${name} nectaryRegistry`, nectaryRegistry);
9
+ if (nectaryRegistry !== null) {
10
+ if (nectaryRegistry.get(name) == null) {
11
+ nectaryRegistry.define(name, constructor);
12
+ console.log(`Custom element ${name} defined immediately`);
13
13
  }
14
- nectaryDefinitions.set(name, constructor);
15
- console.log(`Custom element ${name} queued for definition`);
16
- console.log(`Current definitions queue: ${Array.from(nectaryDefinitions.keys()).join(', ')}`);
14
+ console.log(`Custom element ${name} already defined in registry`);
15
+ return;
16
+ }
17
+ nectaryDefinitions.set(name, constructor);
18
+ console.log(`Custom element ${name} queued for definition`);
19
+ console.log(`Current definitions queue: ${Array.from(nectaryDefinitions.keys()).join(", ")}`);
17
20
  };
18
- export const setLabRegistry = (registry) => {
19
- if (nectaryRegistry !== null) {
20
- throw new Error('Nectary registry already set');
21
- }
22
- nectaryRegistry = registry;
23
- for (const [name, ctor] of nectaryDefinitions.entries()) {
24
- if (nectaryRegistry.get(name) == null) {
25
- nectaryRegistry.define(name, ctor);
26
- console.log(`Custom element ${name} defined in registry`);
27
- }
21
+ const setLabRegistry = (registry) => {
22
+ if (nectaryRegistry !== null) {
23
+ throw new Error("Nectary registry already set");
24
+ }
25
+ nectaryRegistry = registry;
26
+ for (const [name, ctor] of nectaryDefinitions.entries()) {
27
+ if (nectaryRegistry.get(name) == null) {
28
+ nectaryRegistry.define(name, ctor);
29
+ console.log(`Custom element ${name} defined in registry`);
28
30
  }
29
- nectaryDefinitions.clear();
31
+ }
32
+ nectaryDefinitions.clear();
30
33
  };
31
- export const resetLabRegistry = () => {
32
- nectaryRegistry = null;
34
+ const resetLabRegistry = () => {
35
+ nectaryRegistry = null;
33
36
  };
34
- export class NectaryElement extends HTMLElement {
35
- constructor() {
36
- super(...arguments);
37
- this.version = pkg.version;
38
- this.#isDomConnected = false;
39
- }
40
- attachShadow(options) {
41
- return super.attachShadow({
42
- mode: 'open',
43
- delegatesFocus: false,
44
- customElements: nectaryRegistry,
45
- ...options,
46
- });
47
- }
48
- get focusable() {
49
- return false;
50
- }
51
- #isDomConnected;
52
- connectedCallback() {
53
- this.#isDomConnected = true;
54
- }
55
- disconnectedCallback() {
56
- this.#isDomConnected = false;
57
- }
58
- get isDomConnected() {
59
- return this.#isDomConnected;
60
- }
37
+ class NectaryElement extends HTMLElement {
38
+ constructor() {
39
+ super(...arguments);
40
+ this.version = pkg.version;
41
+ this.#isDomConnected = false;
42
+ }
43
+ attachShadow(options) {
44
+ return super.attachShadow({
45
+ mode: "open",
46
+ delegatesFocus: false,
47
+ customElements: nectaryRegistry,
48
+ ...options
49
+ });
50
+ }
51
+ get focusable() {
52
+ return false;
53
+ }
54
+ #isDomConnected;
55
+ connectedCallback() {
56
+ this.#isDomConnected = true;
57
+ }
58
+ disconnectedCallback() {
59
+ this.#isDomConnected = false;
60
+ }
61
+ get isDomConnected() {
62
+ return this.#isDomConnected;
63
+ }
61
64
  }
65
+ export {
66
+ NectaryElement,
67
+ defineCustomElement,
68
+ resetLabRegistry,
69
+ setLabRegistry
70
+ };
package/utils/index.js CHANGED
@@ -1 +1,7 @@
1
- export { defineCustomElement, setLabRegistry, resetLabRegistry, NectaryElement } from './element';
1
+ import { NectaryElement, defineCustomElement, resetLabRegistry, setLabRegistry } from "./element.js";
2
+ export {
3
+ NectaryElement,
4
+ defineCustomElement,
5
+ resetLabRegistry,
6
+ setLabRegistry
7
+ };
package/vite.config.js ADDED
@@ -0,0 +1,66 @@
1
+ import { readFileSync } from 'fs'
2
+ import { resolve, dirname } from 'path'
3
+ import { fileURLToPath } from 'url'
4
+ import { glob } from 'glob'
5
+ import { defineConfig } from 'vite'
6
+
7
+ const __filename = fileURLToPath(import.meta.url)
8
+ const __dirname = dirname(__filename)
9
+
10
+ const tsFiles = glob.sync('**/*.ts', {
11
+ cwd: __dirname,
12
+ absolute: false,
13
+ ignore: ['**/*.d.ts'],
14
+ })
15
+
16
+ const input = {}
17
+
18
+ tsFiles.forEach((file) => {
19
+ const entryName = file.replace(/\.ts$/, '')
20
+
21
+ input[entryName] = resolve(__dirname, file)
22
+ })
23
+
24
+ if (Object.keys(input).length === 0) {
25
+ throw new Error('No TypeScript files found')
26
+ }
27
+
28
+ export default defineConfig({
29
+ plugins: [
30
+ {
31
+ name: 'html-raw-import',
32
+ enforce: 'pre',
33
+ resolveId(source, importer) {
34
+ if (source.endsWith('.html') && importer) {
35
+ const resolved = resolve(dirname(importer), source)
36
+
37
+ return `${resolved}?raw`
38
+ }
39
+ },
40
+ load(id) {
41
+ if (id.endsWith('.html?raw')) {
42
+ const filePath = id.replace(/\?raw$/, '')
43
+ const content = readFileSync(filePath, 'utf-8')
44
+
45
+ return `export default ${JSON.stringify(content)}`
46
+ }
47
+ },
48
+ },
49
+ ],
50
+ build: {
51
+ minify: false,
52
+ outDir: __dirname,
53
+ lib: {
54
+ entry: input,
55
+ formats: ['es'],
56
+ },
57
+ rollupOptions: {
58
+ external: [/^@nectary\/components/],
59
+ output: {
60
+ entryFileNames: '[name].js',
61
+ chunkFileNames: '[name].js',
62
+ assetFileNames: '[name].[ext]',
63
+ },
64
+ },
65
+ },
66
+ })