@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/color-select/index.js +89 -88
- package/color-select/template.html +19 -0
- package/imports.d.ts +2 -0
- package/index.js +6 -5
- package/package.json +10 -7
- package/phone-preview/index.js +81 -89
- package/phone-preview/template.html +78 -0
- package/phone-preview-rcs-channel/index.js +158 -172
- package/phone-preview-rcs-channel/template.html +76 -0
- package/phone-preview-rcs-channel-actions/index.js +108 -115
- package/phone-preview-rcs-channel-actions/template.html +52 -0
- package/phone-preview-rcs-channel-info/index.js +59 -61
- package/phone-preview-rcs-channel-info/template.html +20 -0
- package/phone-preview-rcs-channel-info-option/index.js +94 -99
- package/phone-preview-rcs-channel-info-option/template.html +58 -0
- package/phone-preview-rcs-channel-options/index.js +42 -42
- package/phone-preview-rcs-channel-options/template.html +46 -0
- package/phone-preview-rcs-channel-tabs/index.js +74 -74
- package/phone-preview-rcs-channel-tabs/template.html +35 -0
- package/phone-preview-rcs-chat/index.js +190 -73
- package/phone-preview-rcs-chat/template.html +121 -0
- package/phone-preview-rcs-chat-message/index.js +40 -42
- package/phone-preview-rcs-chat-message/template.html +18 -0
- package/utils/element.js +63 -54
- package/utils/index.js +7 -1
- package/vite.config.js +66 -0
package/utils/element.js
CHANGED
|
@@ -1,61 +1,70 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
1
|
+
const version = "2.8.3";
|
|
2
|
+
const pkg = {
|
|
3
|
+
version
|
|
4
|
+
};
|
|
5
|
+
const nectaryDefinitions = /* @__PURE__ */ new Map();
|
|
3
6
|
let nectaryRegistry = null;
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
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
|
-
|
|
31
|
+
}
|
|
32
|
+
nectaryDefinitions.clear();
|
|
30
33
|
};
|
|
31
|
-
|
|
32
|
-
|
|
34
|
+
const resetLabRegistry = () => {
|
|
35
|
+
nectaryRegistry = null;
|
|
33
36
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
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
|
-
|
|
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
|
+
})
|