@keycloakify/svelte 0.0.1-rc.7 → 0.1.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.
- package/README.md +1 -1
- package/keycloakify-svelte/bin/200.index.js +46 -0
- package/keycloakify-svelte/bin/266.index.js +46 -0
- package/keycloakify-svelte/bin/{383.index.js → 279.index.js} +48 -2
- package/keycloakify-svelte/bin/709.index.js +1 -1
- package/keycloakify-svelte/bin/818.index.js +46 -0
- package/keycloakify-svelte/bin/index.js +1969 -6
- package/keycloakify-svelte/login/i18n/useI18n.js +14 -2
- package/package.json +3 -3
- package/src/login/i18n/useI18n.ts +15 -2
- package/keycloakify-svelte/bin/17.index.js +0 -1999
|
@@ -10,7 +10,19 @@ export function createUseI18n(params) {
|
|
|
10
10
|
function renderHtmlString(params) {
|
|
11
11
|
const { htmlString, msgKey } = params;
|
|
12
12
|
return createRawSnippet(() => ({
|
|
13
|
-
render: () =>
|
|
13
|
+
render: () => {
|
|
14
|
+
const elementName = (() => {
|
|
15
|
+
if (htmlString.includes('<') && htmlString.includes('>')) {
|
|
16
|
+
for (const tagName of ['div', 'section', 'article', 'ul', 'ol']) {
|
|
17
|
+
if (htmlString.includes(`<${tagName}`)) {
|
|
18
|
+
return 'div';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return 'span';
|
|
23
|
+
})();
|
|
24
|
+
return `<${elementName} data-kc-msg="${msgKey}">${htmlString}</${elementName}>`;
|
|
25
|
+
},
|
|
14
26
|
}));
|
|
15
27
|
}
|
|
16
28
|
function withSvelte(i18n_noJsx) {
|
|
@@ -39,7 +51,7 @@ export function createUseI18n(params) {
|
|
|
39
51
|
}
|
|
40
52
|
const styleElement = document.createElement('style');
|
|
41
53
|
styleElement.attributes.setNamedItem(document.createAttribute(attributeName));
|
|
42
|
-
styleElement.textContent = `[
|
|
54
|
+
styleElement.textContent = `div[${attributeName}] { display: inline-block; }`;
|
|
43
55
|
document.head.prepend(styleElement);
|
|
44
56
|
}
|
|
45
57
|
const { getI18n } = createGetI18n({ extraLanguageTranslations, messagesByLanguageTag_themeDefined });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@keycloakify/svelte",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Svelte Components for Keycloakify",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"keycloak",
|
|
@@ -432,7 +432,7 @@
|
|
|
432
432
|
"lint": "yarn format && eslint . --fix"
|
|
433
433
|
},
|
|
434
434
|
"peerDependencies": {
|
|
435
|
-
"keycloakify": "^11.
|
|
435
|
+
"keycloakify": "^11.7.0",
|
|
436
436
|
"svelte": "^5.0.0"
|
|
437
437
|
},
|
|
438
438
|
"devDependencies": {
|
|
@@ -450,7 +450,7 @@
|
|
|
450
450
|
"eslint-plugin-svelte": "^2.46.0",
|
|
451
451
|
"eslint-plugin-unused-imports": "^4.1.4",
|
|
452
452
|
"globals": "^15.12.0",
|
|
453
|
-
"keycloakify": "^11.
|
|
453
|
+
"keycloakify": "^11.7.0",
|
|
454
454
|
"npm-check-updates": "^17.1.11",
|
|
455
455
|
"prettier": "^3.3.3",
|
|
456
456
|
"prettier-plugin-svelte": "^3.3.2",
|
|
@@ -64,7 +64,20 @@ export function createUseI18n<
|
|
|
64
64
|
function renderHtmlString(params: { htmlString: string; msgKey: string }): Snippet {
|
|
65
65
|
const { htmlString, msgKey } = params;
|
|
66
66
|
return createRawSnippet(() => ({
|
|
67
|
-
render: () =>
|
|
67
|
+
render: () => {
|
|
68
|
+
const elementName = (() => {
|
|
69
|
+
if (htmlString.includes('<') && htmlString.includes('>')) {
|
|
70
|
+
for (const tagName of ['div', 'section', 'article', 'ul', 'ol']) {
|
|
71
|
+
if (htmlString.includes(`<${tagName}`)) {
|
|
72
|
+
return 'div';
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return 'span';
|
|
77
|
+
})();
|
|
78
|
+
|
|
79
|
+
return `<${elementName} data-kc-msg="${msgKey}">${htmlString}</${elementName}>`;
|
|
80
|
+
},
|
|
68
81
|
}));
|
|
69
82
|
}
|
|
70
83
|
|
|
@@ -104,7 +117,7 @@ export function createUseI18n<
|
|
|
104
117
|
|
|
105
118
|
const styleElement = document.createElement('style');
|
|
106
119
|
styleElement.attributes.setNamedItem(document.createAttribute(attributeName));
|
|
107
|
-
styleElement.textContent = `[
|
|
120
|
+
styleElement.textContent = `div[${attributeName}] { display: inline-block; }`;
|
|
108
121
|
document.head.prepend(styleElement);
|
|
109
122
|
}
|
|
110
123
|
|