@public-ui/hydrate 2.1.8-rc.0 → 2.1.8
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/dist/index.js +14 -242
- package/dist/index.mjs +14 -242
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -229,7 +229,7 @@ var HYDRATED_STYLE_ID = "sty-id";
|
|
|
229
229
|
var HYDRATE_CHILD_ID = "c-id";
|
|
230
230
|
var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
|
|
231
231
|
var XLINK_NS = "http://www.w3.org/1999/xlink";
|
|
232
|
-
var h = (nodeName, vnodeData, ...children) => {
|
|
232
|
+
var h$1 = (nodeName, vnodeData, ...children) => {
|
|
233
233
|
let child = null;
|
|
234
234
|
let key = null;
|
|
235
235
|
let slotName = null;
|
|
@@ -331,7 +331,7 @@ var convertToPrivate = (node) => {
|
|
|
331
331
|
if (node.vname) {
|
|
332
332
|
vnodeData.name = node.vname;
|
|
333
333
|
}
|
|
334
|
-
return h(node.vtag, vnodeData, ...node.vchildren || []);
|
|
334
|
+
return h$1(node.vtag, vnodeData, ...node.vchildren || []);
|
|
335
335
|
}
|
|
336
336
|
const vnode = newVNode(node.vtag, node.vtext);
|
|
337
337
|
vnode.$attrs$ = node.vattrs;
|
|
@@ -1166,7 +1166,7 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
|
1166
1166
|
const hostElm = hostRef.$hostElement$;
|
|
1167
1167
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
1168
1168
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
1169
|
-
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
|
1169
|
+
const rootVnode = isHost(renderFnResults) ? renderFnResults : h$1(null, null, renderFnResults);
|
|
1170
1170
|
hostTagName = hostElm.tagName;
|
|
1171
1171
|
if (cmpMeta.$attrsToReflect$) {
|
|
1172
1172
|
rootVnode.$attrs$ = rootVnode.$attrs$ || {};
|
|
@@ -1890,14 +1890,14 @@ var hAsync = (nodeName, vnodeData, ...children) => {
|
|
|
1890
1890
|
const flatChildren = children.flat(Infinity);
|
|
1891
1891
|
if (flatChildren.some((child) => child instanceof Promise)) {
|
|
1892
1892
|
return Promise.all(flatChildren).then((resolvedChildren) => {
|
|
1893
|
-
return h(nodeName, vnodeData, ...resolvedChildren);
|
|
1893
|
+
return h$1(nodeName, vnodeData, ...resolvedChildren);
|
|
1894
1894
|
}).catch((err2) => {
|
|
1895
|
-
return h(nodeName, vnodeData);
|
|
1895
|
+
return h$1(nodeName, vnodeData);
|
|
1896
1896
|
});
|
|
1897
1897
|
}
|
|
1898
|
-
return h(nodeName, vnodeData, ...flatChildren);
|
|
1898
|
+
return h$1(nodeName, vnodeData, ...flatChildren);
|
|
1899
1899
|
}
|
|
1900
|
-
return h(nodeName, vnodeData);
|
|
1900
|
+
return h$1(nodeName, vnodeData);
|
|
1901
1901
|
};
|
|
1902
1902
|
function proxyHostElement(elm, cmpMeta) {
|
|
1903
1903
|
if (typeof elm.componentOnReady !== "function") {
|
|
@@ -2655,30 +2655,9 @@ var loglevel = {exports: {}};
|
|
|
2655
2655
|
}));
|
|
2656
2656
|
}(loglevel));
|
|
2657
2657
|
|
|
2658
|
-
var
|
|
2658
|
+
var f = loglevel.exports;
|
|
2659
2659
|
|
|
2660
|
-
const
|
|
2661
|
-
let warrentyWarning = false;
|
|
2662
|
-
const THEME_NAME_PATTERN = /^[a-z][a-z0-9]{1,}(-[a-z0-9]+)?$/;
|
|
2663
|
-
const isThemeNameValid = (name) => {
|
|
2664
|
-
return typeof name === "string" && THEME_NAME_PATTERN.test(name);
|
|
2665
|
-
};
|
|
2666
|
-
const validateThemeName = (name) => {
|
|
2667
|
-
if (isThemeNameValid(name) === false) {
|
|
2668
|
-
throw new Error(
|
|
2669
|
-
`[Theming] The theme identifier "${typeof name === "string" ? name : ""}" (Type: ${typeof name}) is not valid. Please use only follow this pattern: /^[a-z][a-z0-9]{1,}(-[a-z0-9]+)?$/`
|
|
2670
|
-
);
|
|
2671
|
-
}
|
|
2672
|
-
};
|
|
2673
|
-
const patchThemeTag = (themeName, tagName, css, options) => setThemeTag(themeName, tagName, css, options);
|
|
2674
|
-
const setThemeTag = (themeName, tagName, css, options) => {
|
|
2675
|
-
options = options ?? {};
|
|
2676
|
-
options.append = options.append ?? false;
|
|
2677
|
-
validateThemeName(themeName);
|
|
2678
|
-
if (warrentyWarning === false) {
|
|
2679
|
-
warrentyWarning = true;
|
|
2680
|
-
log.warn(
|
|
2681
|
-
`[Theming] The theme process is locked. This means that the theme "${themeName}" should not be patched.
|
|
2660
|
+
const o$1={};let b=!1;const D=/^[a-z][a-z0-9]{1,}(-[a-z0-9]+)?$/,I=e=>typeof e=="string"&&D.test(e),U=e=>{if(I(e)===!1)throw new Error(`[Theming] The theme identifier "${typeof e=="string"?e:""}" (Type: ${typeof e}) is not valid. Please use only follow this pattern: /^[a-z][a-z0-9]{1,}(-[a-z0-9]+)?$/`)},z=(e,t,s,a)=>d(e,t,s,a),d=(e,t,s,a)=>{a=a??{},a.append=a.append??!1,U(e),b===!1&&(b=!0,f.warn(`[Theming] The theme process is locked. This means that the theme "${e}" should not be patched.
|
|
2682
2661
|
|
|
2683
2662
|
import { register } from 'adopted-style-sheets';
|
|
2684
2663
|
import { defineCustomElements } from '...';
|
|
@@ -2688,214 +2667,7 @@ const setThemeTag = (themeName, tagName, css, options) => {
|
|
|
2688
2667
|
.then(() => {
|
|
2689
2668
|
// run your app or website
|
|
2690
2669
|
})
|
|
2691
|
-
.catch(console.warn);`
|
|
2692
|
-
);
|
|
2693
|
-
}
|
|
2694
|
-
if (typeof STORE.A11yUi !== "object" || STORE.A11yUi === null) {
|
|
2695
|
-
STORE.A11yUi = {};
|
|
2696
|
-
}
|
|
2697
|
-
if (typeof STORE.A11yUi === "object" && STORE.A11yUi !== null && (typeof STORE.A11yUi.Themes !== "object" || STORE.A11yUi.Themes === null)) {
|
|
2698
|
-
STORE.A11yUi.Themes = {};
|
|
2699
|
-
}
|
|
2700
|
-
if (typeof STORE.A11yUi === "object" && STORE.A11yUi !== null && typeof STORE.A11yUi.Themes === "object" && STORE.A11yUi.Themes !== null && (typeof STORE.A11yUi.Themes[themeName] !== "object" || STORE.A11yUi.Themes[themeName] === null)) {
|
|
2701
|
-
STORE.A11yUi.Themes[themeName] = {};
|
|
2702
|
-
}
|
|
2703
|
-
if (typeof STORE.A11yUi === "object" && STORE.A11yUi !== null && typeof STORE.A11yUi.Themes === "object" && STORE.A11yUi.Themes !== null && typeof STORE.A11yUi.Themes[themeName] === "object" && STORE.A11yUi.Themes[themeName] !== null) {
|
|
2704
|
-
if (options.append && typeof STORE.A11yUi.Themes[themeName][tagName] === "string") {
|
|
2705
|
-
STORE.A11yUi.Themes[themeName][tagName] += css;
|
|
2706
|
-
} else {
|
|
2707
|
-
STORE.A11yUi.Themes[themeName][tagName] = css;
|
|
2708
|
-
}
|
|
2709
|
-
}
|
|
2710
|
-
};
|
|
2711
|
-
const patchTheme = (name, map, options, registerOptions) => setTheme(name, map, options, registerOptions);
|
|
2712
|
-
const setTheme = (name, map, options, registerOptions) => {
|
|
2713
|
-
validateThemeName(name);
|
|
2714
|
-
if (typeof map === "object" && map !== null) {
|
|
2715
|
-
const tagNames = Object.getOwnPropertyNames(map);
|
|
2716
|
-
tagNames.forEach((tagName) => {
|
|
2717
|
-
const cssStyle = map[tagName];
|
|
2718
|
-
const normalizedTagName = tagName.toLowerCase();
|
|
2719
|
-
const domTagName = typeof registerOptions?.transformTagName === "function" && !["GLOBAL", "PROPERTIES"].includes(tagName) ? registerOptions.transformTagName(normalizedTagName) : tagName;
|
|
2720
|
-
if (typeof cssStyle === "string" && cssStyle.length > 0) {
|
|
2721
|
-
setThemeTag(name, domTagName.toUpperCase(), cssStyle, options);
|
|
2722
|
-
}
|
|
2723
|
-
});
|
|
2724
|
-
}
|
|
2725
|
-
return name;
|
|
2726
|
-
};
|
|
2727
|
-
|
|
2728
|
-
const STYLING_TASK_QUEUE = /* @__PURE__ */ new Map();
|
|
2729
|
-
const HYDRATED_HISTORY = [];
|
|
2730
|
-
const CSS_PROPERTIES_REGISTERED = /* @__PURE__ */ new Set();
|
|
2731
|
-
const CSS_STYLE_CACHE = /* @__PURE__ */ new Map();
|
|
2732
|
-
const REGEX_CSS_PROPERTIES = /--[^;]+/g;
|
|
2733
|
-
const REGEX_SPLIT_CSS_PROPERTY = /:/;
|
|
2734
|
-
if (typeof STORE.A11yUi !== "object" || STORE.A11yUi === null) {
|
|
2735
|
-
STORE.A11yUi = {
|
|
2736
|
-
CSS_STYLE_CACHE,
|
|
2737
|
-
HYDRATED_HISTORY,
|
|
2738
|
-
STYLING_TASK_QUEUE
|
|
2739
|
-
};
|
|
2740
|
-
}
|
|
2741
|
-
const extractProperties = (themeName, css) => {
|
|
2742
|
-
let properties = css.match(REGEX_CSS_PROPERTIES);
|
|
2743
|
-
if (Array.isArray(properties)) {
|
|
2744
|
-
properties = properties.filter((property) => REGEX_SPLIT_CSS_PROPERTY.test(property));
|
|
2745
|
-
const style = document.createElement("style");
|
|
2746
|
-
style.innerHTML = `.${themeName} {${properties.join(";")}}`;
|
|
2747
|
-
document.querySelector("head")?.appendChild(style);
|
|
2748
|
-
}
|
|
2749
|
-
CSS_PROPERTIES_REGISTERED.add(themeName);
|
|
2750
|
-
};
|
|
2751
|
-
const getCssStyle = (themeName, tagName) => {
|
|
2752
|
-
if (
|
|
2753
|
-
/**
|
|
2754
|
-
* Search custom StyleSheet in Config
|
|
2755
|
-
* TODO: Performance???
|
|
2756
|
-
*/
|
|
2757
|
-
typeof STORE.A11yUi === "object" && STORE.A11yUi !== null && typeof STORE.A11yUi.Themes === "object" && STORE.A11yUi.Themes !== null && typeof STORE.A11yUi.Themes[themeName] === "object" && STORE.A11yUi.Themes[themeName] !== null && typeof STORE.A11yUi.Themes[themeName][tagName] === "string"
|
|
2758
|
-
) {
|
|
2759
|
-
return STORE.A11yUi.Themes[themeName][tagName].replace(
|
|
2760
|
-
/\r?\n/g,
|
|
2761
|
-
""
|
|
2762
|
-
);
|
|
2763
|
-
} else {
|
|
2764
|
-
return "";
|
|
2765
|
-
}
|
|
2766
|
-
};
|
|
2767
|
-
const removeStyle = (shadow) => {
|
|
2768
|
-
for (const childNode of Array.from(shadow.childNodes)) {
|
|
2769
|
-
if (childNode instanceof HTMLStyleElement && childNode.tagName === "STYLE") {
|
|
2770
|
-
shadow.removeChild(childNode);
|
|
2771
|
-
} else {
|
|
2772
|
-
break;
|
|
2773
|
-
}
|
|
2774
|
-
}
|
|
2775
|
-
};
|
|
2776
|
-
const patchStyle = (shadow, styles) => {
|
|
2777
|
-
try {
|
|
2778
|
-
const styleSheets = [];
|
|
2779
|
-
styles.forEach((style) => {
|
|
2780
|
-
const styleSheet = new CSSStyleSheet();
|
|
2781
|
-
styleSheet.replaceSync(style);
|
|
2782
|
-
styleSheets.push(styleSheet);
|
|
2783
|
-
});
|
|
2784
|
-
shadow.adoptedStyleSheets = styleSheets;
|
|
2785
|
-
} catch (e) {
|
|
2786
|
-
styles.reverse().forEach((style) => {
|
|
2787
|
-
const styleElement = document.createElement("style");
|
|
2788
|
-
styleElement.innerHTML = style;
|
|
2789
|
-
shadow.insertBefore(styleElement, shadow.firstChild);
|
|
2790
|
-
});
|
|
2791
|
-
}
|
|
2792
|
-
};
|
|
2793
|
-
const encroachStyles = (shadow, styles, encroachCss) => {
|
|
2794
|
-
if (encroachCss !== false) {
|
|
2795
|
-
const defaultStyleNodes = [
|
|
2796
|
-
...Array.from(shadow.childNodes).filter((node) => node instanceof HTMLStyleElement && node.tagName === "STYLE")
|
|
2797
|
-
];
|
|
2798
|
-
let defaultStyleSheets;
|
|
2799
|
-
try {
|
|
2800
|
-
defaultStyleSheets = [...Array.from(shadow.adoptedStyleSheets)];
|
|
2801
|
-
} catch (e) {
|
|
2802
|
-
defaultStyleSheets = [];
|
|
2803
|
-
}
|
|
2804
|
-
if (encroachCss?.mode === "before") {
|
|
2805
|
-
defaultStyleNodes.reverse().forEach((style) => styles.unshift(style.innerHTML));
|
|
2806
|
-
defaultStyleSheets.reverse().forEach(
|
|
2807
|
-
(style) => styles.unshift(
|
|
2808
|
-
Array.from(style.cssRules).map((rule) => rule.cssText).join("")
|
|
2809
|
-
)
|
|
2810
|
-
);
|
|
2811
|
-
} else if (encroachCss?.mode === "after") {
|
|
2812
|
-
defaultStyleNodes.forEach((style) => styles.push(style.innerHTML));
|
|
2813
|
-
defaultStyleSheets.forEach(
|
|
2814
|
-
(style) => styles.push(
|
|
2815
|
-
Array.from(style.cssRules).map((rule) => rule.cssText).join("")
|
|
2816
|
-
)
|
|
2817
|
-
);
|
|
2818
|
-
}
|
|
2819
|
-
}
|
|
2820
|
-
};
|
|
2821
|
-
const setThemeStyleAfterHydrated = (elm, themeDetails, styleDisplay) => {
|
|
2822
|
-
const themeName = themeDetails.name || "default";
|
|
2823
|
-
let shadow;
|
|
2824
|
-
try {
|
|
2825
|
-
if (elm.shadowRoot === null) {
|
|
2826
|
-
throw new Error("ShadowRoot is null");
|
|
2827
|
-
}
|
|
2828
|
-
shadow = elm.shadowRoot;
|
|
2829
|
-
} catch (e) {
|
|
2830
|
-
shadow = elm;
|
|
2831
|
-
}
|
|
2832
|
-
if (CSS_STYLE_CACHE.get(themeName)?.has(elm.tagName)) {
|
|
2833
|
-
switchStyle(elm, shadow, CSS_STYLE_CACHE.get(themeName)?.get(elm.tagName), styleDisplay);
|
|
2834
|
-
} else {
|
|
2835
|
-
const PROPERTY_STYLE = getCssStyle(themeName, "PROPERTIES");
|
|
2836
|
-
const GLOBAL_STYLE = getCssStyle(themeName, "GLOBAL");
|
|
2837
|
-
const TAG_STYLE = getCssStyle(themeName, elm.tagName);
|
|
2838
|
-
if (CSS_PROPERTIES_REGISTERED.has(themeName) === false) {
|
|
2839
|
-
extractProperties(themeName, GLOBAL_STYLE);
|
|
2840
|
-
}
|
|
2841
|
-
const STYLES = [PROPERTY_STYLE, GLOBAL_STYLE, TAG_STYLE];
|
|
2842
|
-
encroachStyles(shadow, STYLES, themeDetails.encroachCss);
|
|
2843
|
-
if (themeDetails.loglevel === "debug") {
|
|
2844
|
-
console.log(elm.tagName, STYLES);
|
|
2845
|
-
}
|
|
2846
|
-
if (themeDetails.cache === true) {
|
|
2847
|
-
if (CSS_STYLE_CACHE.has(themeName) === false) {
|
|
2848
|
-
CSS_STYLE_CACHE.set(themeName, /* @__PURE__ */ new Map());
|
|
2849
|
-
}
|
|
2850
|
-
CSS_STYLE_CACHE.get(themeName)?.set(elm.tagName, STYLES);
|
|
2851
|
-
}
|
|
2852
|
-
switchStyle(elm, shadow, STYLES, styleDisplay);
|
|
2853
|
-
}
|
|
2854
|
-
};
|
|
2855
|
-
const switchStyle = (elm, shadow, styles, styleDisplay) => {
|
|
2856
|
-
removeStyle(shadow);
|
|
2857
|
-
patchStyle(shadow, styles);
|
|
2858
|
-
elm.style.display = styleDisplay;
|
|
2859
|
-
};
|
|
2860
|
-
const logHydratedHistory = (themeDetails) => {
|
|
2861
|
-
if (themeDetails.loglevel === "debug") {
|
|
2862
|
-
HYDRATED_HISTORY.push({
|
|
2863
|
-
timestamp: Date.now(),
|
|
2864
|
-
numberOfTasks: STYLING_TASK_QUEUE.size
|
|
2865
|
-
});
|
|
2866
|
-
}
|
|
2867
|
-
};
|
|
2868
|
-
const deleteDoneTask = (elm) => {
|
|
2869
|
-
STYLING_TASK_QUEUE.delete(elm);
|
|
2870
|
-
};
|
|
2871
|
-
const loggedDeleteDoneTask = (elm, themeDetails) => {
|
|
2872
|
-
deleteDoneTask(elm);
|
|
2873
|
-
logHydratedHistory(themeDetails);
|
|
2874
|
-
};
|
|
2875
|
-
const observerCallback = (mutationsList) => {
|
|
2876
|
-
for (const mutation of mutationsList) {
|
|
2877
|
-
if (
|
|
2878
|
-
/**
|
|
2879
|
-
* Save by observer config
|
|
2880
|
-
*/
|
|
2881
|
-
// mutation.type === 'attributes' &&
|
|
2882
|
-
// mutation.attributeName === 'class' &&
|
|
2883
|
-
/**
|
|
2884
|
-
* Implizit check for HTMLElement
|
|
2885
|
-
*/
|
|
2886
|
-
// mutation.target &&
|
|
2887
|
-
STYLING_TASK_QUEUE.has(mutation.target) && mutation.target.classList.contains("hydrated")
|
|
2888
|
-
) {
|
|
2889
|
-
const { styleDisplay, themeDetails } = STYLING_TASK_QUEUE.get(mutation.target);
|
|
2890
|
-
setThemeStyleAfterHydrated(mutation.target, themeDetails, styleDisplay);
|
|
2891
|
-
loggedDeleteDoneTask(mutation.target, themeDetails);
|
|
2892
|
-
}
|
|
2893
|
-
}
|
|
2894
|
-
};
|
|
2895
|
-
try {
|
|
2896
|
-
new MutationObserver(observerCallback);
|
|
2897
|
-
} catch (e) {
|
|
2898
|
-
}
|
|
2670
|
+
.catch(console.warn);`)),(typeof o$1.A11yUi!="object"||o$1.A11yUi===null)&&(o$1.A11yUi={}),typeof o$1.A11yUi=="object"&&o$1.A11yUi!==null&&(typeof o$1.A11yUi.Themes!="object"||o$1.A11yUi.Themes===null)&&(o$1.A11yUi.Themes={}),typeof o$1.A11yUi=="object"&&o$1.A11yUi!==null&&typeof o$1.A11yUi.Themes=="object"&&o$1.A11yUi.Themes!==null&&(typeof o$1.A11yUi.Themes[e]!="object"||o$1.A11yUi.Themes[e]===null)&&(o$1.A11yUi.Themes[e]={}),typeof o$1.A11yUi=="object"&&o$1.A11yUi!==null&&typeof o$1.A11yUi.Themes=="object"&&o$1.A11yUi.Themes!==null&&typeof o$1.A11yUi.Themes[e]=="object"&&o$1.A11yUi.Themes[e]!==null&&(a.append&&typeof o$1.A11yUi.Themes[e][t]=="string"?o$1.A11yUi.Themes[e][t]+=s:o$1.A11yUi.Themes[e][t]=s);},x=(e,t,s,a)=>g(e,t,s,a),g=(e,t,s,a)=>(U(e),typeof t=="object"&&t!==null&&Object.getOwnPropertyNames(t).forEach(r=>{const n=t[r],i=r.toLowerCase(),m=typeof a?.transformTagName=="function"&&!["GLOBAL","PROPERTIES"].includes(r)?a.transformTagName(i):r;typeof n=="string"&&n.length>0&&d(e,m.toUpperCase(),n,s);}),e);const c$1=new Map,v=[],L=new Set,h=new Map,K=/--[^;]+/g,q=/:/;(typeof o$1.A11yUi!="object"||o$1.A11yUi===null)&&(o$1.A11yUi={CSS_STYLE_CACHE:h,HYDRATED_HISTORY:v,STYLING_TASK_QUEUE:c$1});const F=(e,t)=>{let s=t.match(K);if(Array.isArray(s)){s=s.filter(r=>q.test(r));const a=document.createElement("style");a.innerHTML=`.${e} {${s.join(";")}}`,document.querySelector("head")?.appendChild(a);}L.add(e);},p=(e,t)=>typeof o$1.A11yUi=="object"&&o$1.A11yUi!==null&&typeof o$1.A11yUi.Themes=="object"&&o$1.A11yUi.Themes!==null&&typeof o$1.A11yUi.Themes[e]=="object"&&o$1.A11yUi.Themes[e]!==null&&typeof o$1.A11yUi.Themes[e][t]=="string"?o$1.A11yUi.Themes[e][t].replace(/\r?\n/g,""):"",Q=e=>{for(const t of Array.from(e.childNodes))if(t instanceof HTMLStyleElement&&t.tagName==="STYLE")e.removeChild(t);else break},J=(e,t)=>{try{const s=[];t.forEach(a=>{const r=new CSSStyleSheet;r.replaceSync(a),s.push(r);}),e.adoptedStyleSheets=s;}catch{t.reverse().forEach(s=>{const a=document.createElement("style");a.innerHTML=s,e.insertBefore(a,e.firstChild);});}},V=(e,t,s)=>{if(s!==!1){const a=[...Array.from(e.childNodes).filter(n=>n instanceof HTMLStyleElement&&n.tagName==="STYLE")];let r;try{r=[...Array.from(e.adoptedStyleSheets)];}catch{r=[];}s?.mode==="before"?(a.reverse().forEach(n=>t.unshift(n.innerHTML)),r.reverse().forEach(n=>t.unshift(Array.from(n.cssRules).map(i=>i.cssText).join("")))):s?.mode==="after"&&(a.forEach(n=>t.push(n.innerHTML)),r.forEach(n=>t.push(Array.from(n.cssRules).map(i=>i.cssText).join(""))));}},M=(e,t,s)=>{const a=t.name||"default";let r;try{if(e.shadowRoot===null)throw new Error("ShadowRoot is null");r=e.shadowRoot;}catch{r=e;}if(h.get(a)?.has(e.tagName))$(e,r,h.get(a)?.get(e.tagName),s);else {const n=p(a,"PROPERTIES"),i=p(a,"GLOBAL"),m=p(a,e.tagName);L.has(a)===!1&&F(a,i);const y=[n,i,m];V(r,y,t.encroachCss),t.loglevel==="debug"&&console.log(e.tagName,y),t.cache===!0&&(h.has(a)===!1&&h.set(a,new Map),h.get(a)?.set(e.tagName,y)),$(e,r,y,s);}},$=(e,t,s,a)=>{Q(t),J(t,s),e.style.display=a;},O=e=>{e.loglevel==="debug"&&v.push({timestamp:Date.now(),numberOfTasks:c$1.size});},Z$1=e=>{c$1.delete(e);},R=(e,t)=>{Z$1(e),O(t);},ee=e=>{for(const t of e)if(c$1.has(t.target)&&t.target.classList.contains("hydrated")){const{styleDisplay:s,themeDetails:a}=c$1.get(t.target);M(t.target,a,s),R(t.target,a);}};try{new MutationObserver(ee);}catch{}
|
|
2899
2671
|
|
|
2900
2672
|
const alertTypeOptions = ['default', 'info', 'success', 'warning', 'error'];
|
|
2901
2673
|
const alertVariantOptions = ['card', 'msg'];
|
|
@@ -3970,9 +3742,9 @@ const koliBriQuerySelector = (selector, node) => querySelector(selector, node ||
|
|
|
3970
3742
|
const koliBriQuerySelectorAll = (selector, node) => querySelectorAll(selector, node || getDocument());
|
|
3971
3743
|
class KoliBriDevHelper {
|
|
3972
3744
|
}
|
|
3973
|
-
KoliBriDevHelper.getCssStyle =
|
|
3974
|
-
KoliBriDevHelper.patchTheme =
|
|
3975
|
-
KoliBriDevHelper.patchThemeTag =
|
|
3745
|
+
KoliBriDevHelper.getCssStyle = p;
|
|
3746
|
+
KoliBriDevHelper.patchTheme = x;
|
|
3747
|
+
KoliBriDevHelper.patchThemeTag = z;
|
|
3976
3748
|
KoliBriDevHelper.querySelector = koliBriQuerySelector;
|
|
3977
3749
|
KoliBriDevHelper.querySelectorAll = koliBriQuerySelectorAll;
|
|
3978
3750
|
KoliBriDevHelper.stringifyJson = stringifyJson;
|
|
@@ -11405,7 +11177,7 @@ class KolModal {
|
|
|
11405
11177
|
}; }
|
|
11406
11178
|
}
|
|
11407
11179
|
|
|
11408
|
-
const defaultStyleCss$h = "/*\n * This file contains all rules for accessibility.\n */\n@layer kol-global {\n :host {\n /*\n * Minimum size of interactive elements.\n */\n --a11y-min-size: 44px;\n /*\n * No element should be used without a background and font color whose contrast ratio has\n * not been checked. By initially setting the background color to white and the font color\n * to black, the contrast ratio is ensured and explicit adjustment is forced.\n */\n background-color: white;\n color: black;\n /*\n * Verdana is an accessible font that can be used without requiring additional loading time.\n */\n font-family: Verdana;\n }\n * {\n /*\n * This rule enables the word dividing for all texts. That is important for high zoom levels.\n */\n hyphens: auto;\n /*\n * Letter spacing is required for all texts.\n */\n letter-spacing: inherit;\n /*\n * This rule enables the word dividing for all texts. That is important for high zoom levels.\n */\n word-break: break-word;\n /*\n * Word spacing is required for all texts.\n */\n word-spacing: inherit;\n }\n /*\n * All interactive elements should have a minimum size of 44px.\n */\n /* input:not([type='checkbox'], [type='radio'], [type='range']), */\n /* option, */\n /* select, */\n /* textarea, */\n [role=button],\n button:not([role=link]),\n .kol-input .input {\n min-height: var(--a11y-min-size);\n min-width: var(--a11y-min-size);\n }\n /*\n * Some interactive elements should not inherit the font-family and font-size.\n */\n a,\n button,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n input,\n option,\n select,\n textarea {\n /*\n * All elements should inherit the font family from his parent element.\n */\n font-family: inherit;\n /*\n * All elements should inherit the font size from his parent element.\n */\n font-size: inherit;\n }\n}\n/**\n * Sometimes we need the semantic element for accessibility reasons,\n * but we don't want to show it.\n *\n * - https://www.a11yproject.com/posts/how-to-hide-content/\n */\n.visually-hidden {\n clip: rect(0 0 0 0);\n clip-path: inset(50%);\n height: 1px;\n overflow: hidden;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n}\n\n@layer kol-global {\n /*\n * Dieses CSS stellt sicher, dass der Standard-Style\n * von A und Button resettet werden.\n */\n :is(a, button) {\n background-color: transparent;\n border: none;\n margin: 0;\n padding: 0;\n width: 100%; /* 100% needed for custom width from outside */\n }\n /*\n * Ensure elements with hidden attribute to be actually not visible\n * @see https://meowni.ca/hidden.is.a.lie.html\n */\n [hidden] {\n display: none !important;\n }\n}\n@layer kol-global {\n :host {\n /*\n * The max-width is needed to prevent the table from overflowing the\n * parent node, if the table is wider than the parent node.\n */\n max-width: 100%;\n }\n * {\n /*\n * We prefer to box-sizing: border-box for all elements.\n */\n box-sizing: border-box;\n }\n /* KolSpan is a layout component with icons in all directions and a label text in the middle. */\n .kol-span-wc {\n display: grid;\n place-items: center;\n }\n /* The sub span in KolSpan is the horizontal span with icon left and right and the label text in the middle. */\n .kol-span-wc > span {\n display: flex;\n place-items: center;\n }\n a,\n button {\n cursor: pointer;\n }\n /* This is the text label. */\n .hide-label > .kol-span-wc > span > span {\n display: none;\n }\n /* Reset browser agent style. */\n button:disabled {\n color: unset;\n }\n .disabled label,\n .disabled:focus-within label,\n [aria-disabled=true],\n [aria-disabled=true]:focus,\n [disabled],\n [disabled]:focus {\n cursor: not-allowed;\n opacity: 0.5;\n outline: none;\n }\n [aria-disabled=true]:focus .kol-span-wc,\n [disabled]:focus .kol-span-wc {\n outline: none !important;\n }\n}\n@layer kol-component {\n :host {\n font-size: calc(16rem / var(--kolibri-root-font-size, 16));\n }\n :host > div {\n display: grid;\n place-items: center;\n }\n :not(.is-compact) nav {\n width: 100%;\n }\n .list {\n display: flex;\n list-style: none;\n margin: 0;\n padding: 0;\n }\n .list.vertical {\n flex-direction: column;\n }\n .entry {\n display: flex;\n }\n .entry-item {\n flex-grow: 1;\n }\n}";
|
|
11180
|
+
const defaultStyleCss$h = "/*\n * This file contains all rules for accessibility.\n */\n@layer kol-global {\n :host {\n /*\n * Minimum size of interactive elements.\n */\n --a11y-min-size: 44px;\n /*\n * No element should be used without a background and font color whose contrast ratio has\n * not been checked. By initially setting the background color to white and the font color\n * to black, the contrast ratio is ensured and explicit adjustment is forced.\n */\n background-color: white;\n color: black;\n /*\n * Verdana is an accessible font that can be used without requiring additional loading time.\n */\n font-family: Verdana;\n }\n * {\n /*\n * This rule enables the word dividing for all texts. That is important for high zoom levels.\n */\n hyphens: auto;\n /*\n * Letter spacing is required for all texts.\n */\n letter-spacing: inherit;\n /*\n * This rule enables the word dividing for all texts. That is important for high zoom levels.\n */\n word-break: break-word;\n /*\n * Word spacing is required for all texts.\n */\n word-spacing: inherit;\n }\n /*\n * All interactive elements should have a minimum size of 44px.\n */\n /* input:not([type='checkbox'], [type='radio'], [type='range']), */\n /* option, */\n /* select, */\n /* textarea, */\n [role=button],\n button:not([role=link]),\n .kol-input .input {\n min-height: var(--a11y-min-size);\n min-width: var(--a11y-min-size);\n }\n /*\n * Some interactive elements should not inherit the font-family and font-size.\n */\n a,\n button,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n input,\n option,\n select,\n textarea {\n /*\n * All elements should inherit the font family from his parent element.\n */\n font-family: inherit;\n /*\n * All elements should inherit the font size from his parent element.\n */\n font-size: inherit;\n }\n}\n/**\n * Sometimes we need the semantic element for accessibility reasons,\n * but we don't want to show it.\n *\n * - https://www.a11yproject.com/posts/how-to-hide-content/\n */\n.visually-hidden {\n clip: rect(0 0 0 0);\n clip-path: inset(50%);\n height: 1px;\n overflow: hidden;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n}\n\n@layer kol-global {\n /*\n * Dieses CSS stellt sicher, dass der Standard-Style\n * von A und Button resettet werden.\n */\n :is(a, button) {\n background-color: transparent;\n border: none;\n margin: 0;\n padding: 0;\n width: 100%; /* 100% needed for custom width from outside */\n }\n /*\n * Ensure elements with hidden attribute to be actually not visible\n * @see https://meowni.ca/hidden.is.a.lie.html\n */\n [hidden] {\n display: none !important;\n }\n}\n@layer kol-global {\n :host {\n /*\n * The max-width is needed to prevent the table from overflowing the\n * parent node, if the table is wider than the parent node.\n */\n max-width: 100%;\n }\n * {\n /*\n * We prefer to box-sizing: border-box for all elements.\n */\n box-sizing: border-box;\n }\n /* KolSpan is a layout component with icons in all directions and a label text in the middle. */\n .kol-span-wc {\n display: grid;\n place-items: center;\n }\n /* The sub span in KolSpan is the horizontal span with icon left and right and the label text in the middle. */\n .kol-span-wc > span {\n display: flex;\n place-items: center;\n }\n a,\n button {\n cursor: pointer;\n }\n /* This is the text label. */\n .hide-label > .kol-span-wc > span > span {\n display: none;\n }\n /* Reset browser agent style. */\n button:disabled {\n color: unset;\n }\n .disabled label,\n .disabled:focus-within label,\n [aria-disabled=true],\n [aria-disabled=true]:focus,\n [disabled],\n [disabled]:focus {\n cursor: not-allowed;\n opacity: 0.5;\n outline: none;\n }\n [aria-disabled=true]:focus .kol-span-wc,\n [disabled]:focus .kol-span-wc {\n outline: none !important;\n }\n}\n@layer kol-component {\n :host {\n font-size: calc(16rem / var(--kolibri-root-font-size, 16));\n }\n :host > div {\n display: grid;\n place-items: center;\n }\n :not(.is-compact) nav {\n width: 100%;\n }\n .list {\n display: flex;\n list-style: none;\n margin: 0;\n padding: 0;\n }\n .list.vertical {\n flex-direction: column;\n }\n .list.horizontal {\n flex-wrap: wrap;\n }\n .entry {\n display: flex;\n }\n .entry-item {\n flex-grow: 1;\n }\n}";
|
|
11409
11181
|
var KolNavDefaultStyle0 = defaultStyleCss$h;
|
|
11410
11182
|
|
|
11411
11183
|
const entryIsLink = (entryProps) => {
|
package/dist/index.mjs
CHANGED
|
@@ -225,7 +225,7 @@ var HYDRATED_STYLE_ID = "sty-id";
|
|
|
225
225
|
var HYDRATE_CHILD_ID = "c-id";
|
|
226
226
|
var SLOT_FB_CSS = "slot-fb{display:contents}slot-fb[hidden]{display:none}";
|
|
227
227
|
var XLINK_NS = "http://www.w3.org/1999/xlink";
|
|
228
|
-
var h = (nodeName, vnodeData, ...children) => {
|
|
228
|
+
var h$1 = (nodeName, vnodeData, ...children) => {
|
|
229
229
|
let child = null;
|
|
230
230
|
let key = null;
|
|
231
231
|
let slotName = null;
|
|
@@ -327,7 +327,7 @@ var convertToPrivate = (node) => {
|
|
|
327
327
|
if (node.vname) {
|
|
328
328
|
vnodeData.name = node.vname;
|
|
329
329
|
}
|
|
330
|
-
return h(node.vtag, vnodeData, ...node.vchildren || []);
|
|
330
|
+
return h$1(node.vtag, vnodeData, ...node.vchildren || []);
|
|
331
331
|
}
|
|
332
332
|
const vnode = newVNode(node.vtag, node.vtext);
|
|
333
333
|
vnode.$attrs$ = node.vattrs;
|
|
@@ -1162,7 +1162,7 @@ var renderVdom = (hostRef, renderFnResults, isInitialLoad = false) => {
|
|
|
1162
1162
|
const hostElm = hostRef.$hostElement$;
|
|
1163
1163
|
const cmpMeta = hostRef.$cmpMeta$;
|
|
1164
1164
|
const oldVNode = hostRef.$vnode$ || newVNode(null, null);
|
|
1165
|
-
const rootVnode = isHost(renderFnResults) ? renderFnResults : h(null, null, renderFnResults);
|
|
1165
|
+
const rootVnode = isHost(renderFnResults) ? renderFnResults : h$1(null, null, renderFnResults);
|
|
1166
1166
|
hostTagName = hostElm.tagName;
|
|
1167
1167
|
if (cmpMeta.$attrsToReflect$) {
|
|
1168
1168
|
rootVnode.$attrs$ = rootVnode.$attrs$ || {};
|
|
@@ -1886,14 +1886,14 @@ var hAsync = (nodeName, vnodeData, ...children) => {
|
|
|
1886
1886
|
const flatChildren = children.flat(Infinity);
|
|
1887
1887
|
if (flatChildren.some((child) => child instanceof Promise)) {
|
|
1888
1888
|
return Promise.all(flatChildren).then((resolvedChildren) => {
|
|
1889
|
-
return h(nodeName, vnodeData, ...resolvedChildren);
|
|
1889
|
+
return h$1(nodeName, vnodeData, ...resolvedChildren);
|
|
1890
1890
|
}).catch((err2) => {
|
|
1891
|
-
return h(nodeName, vnodeData);
|
|
1891
|
+
return h$1(nodeName, vnodeData);
|
|
1892
1892
|
});
|
|
1893
1893
|
}
|
|
1894
|
-
return h(nodeName, vnodeData, ...flatChildren);
|
|
1894
|
+
return h$1(nodeName, vnodeData, ...flatChildren);
|
|
1895
1895
|
}
|
|
1896
|
-
return h(nodeName, vnodeData);
|
|
1896
|
+
return h$1(nodeName, vnodeData);
|
|
1897
1897
|
};
|
|
1898
1898
|
function proxyHostElement(elm, cmpMeta) {
|
|
1899
1899
|
if (typeof elm.componentOnReady !== "function") {
|
|
@@ -2651,30 +2651,9 @@ var loglevel = {exports: {}};
|
|
|
2651
2651
|
}));
|
|
2652
2652
|
}(loglevel));
|
|
2653
2653
|
|
|
2654
|
-
var
|
|
2654
|
+
var f = loglevel.exports;
|
|
2655
2655
|
|
|
2656
|
-
const
|
|
2657
|
-
let warrentyWarning = false;
|
|
2658
|
-
const THEME_NAME_PATTERN = /^[a-z][a-z0-9]{1,}(-[a-z0-9]+)?$/;
|
|
2659
|
-
const isThemeNameValid = (name) => {
|
|
2660
|
-
return typeof name === "string" && THEME_NAME_PATTERN.test(name);
|
|
2661
|
-
};
|
|
2662
|
-
const validateThemeName = (name) => {
|
|
2663
|
-
if (isThemeNameValid(name) === false) {
|
|
2664
|
-
throw new Error(
|
|
2665
|
-
`[Theming] The theme identifier "${typeof name === "string" ? name : ""}" (Type: ${typeof name}) is not valid. Please use only follow this pattern: /^[a-z][a-z0-9]{1,}(-[a-z0-9]+)?$/`
|
|
2666
|
-
);
|
|
2667
|
-
}
|
|
2668
|
-
};
|
|
2669
|
-
const patchThemeTag = (themeName, tagName, css, options) => setThemeTag(themeName, tagName, css, options);
|
|
2670
|
-
const setThemeTag = (themeName, tagName, css, options) => {
|
|
2671
|
-
options = options ?? {};
|
|
2672
|
-
options.append = options.append ?? false;
|
|
2673
|
-
validateThemeName(themeName);
|
|
2674
|
-
if (warrentyWarning === false) {
|
|
2675
|
-
warrentyWarning = true;
|
|
2676
|
-
log.warn(
|
|
2677
|
-
`[Theming] The theme process is locked. This means that the theme "${themeName}" should not be patched.
|
|
2656
|
+
const o$1={};let b=!1;const D=/^[a-z][a-z0-9]{1,}(-[a-z0-9]+)?$/,I=e=>typeof e=="string"&&D.test(e),U=e=>{if(I(e)===!1)throw new Error(`[Theming] The theme identifier "${typeof e=="string"?e:""}" (Type: ${typeof e}) is not valid. Please use only follow this pattern: /^[a-z][a-z0-9]{1,}(-[a-z0-9]+)?$/`)},z=(e,t,s,a)=>d(e,t,s,a),d=(e,t,s,a)=>{a=a??{},a.append=a.append??!1,U(e),b===!1&&(b=!0,f.warn(`[Theming] The theme process is locked. This means that the theme "${e}" should not be patched.
|
|
2678
2657
|
|
|
2679
2658
|
import { register } from 'adopted-style-sheets';
|
|
2680
2659
|
import { defineCustomElements } from '...';
|
|
@@ -2684,214 +2663,7 @@ const setThemeTag = (themeName, tagName, css, options) => {
|
|
|
2684
2663
|
.then(() => {
|
|
2685
2664
|
// run your app or website
|
|
2686
2665
|
})
|
|
2687
|
-
.catch(console.warn);`
|
|
2688
|
-
);
|
|
2689
|
-
}
|
|
2690
|
-
if (typeof STORE.A11yUi !== "object" || STORE.A11yUi === null) {
|
|
2691
|
-
STORE.A11yUi = {};
|
|
2692
|
-
}
|
|
2693
|
-
if (typeof STORE.A11yUi === "object" && STORE.A11yUi !== null && (typeof STORE.A11yUi.Themes !== "object" || STORE.A11yUi.Themes === null)) {
|
|
2694
|
-
STORE.A11yUi.Themes = {};
|
|
2695
|
-
}
|
|
2696
|
-
if (typeof STORE.A11yUi === "object" && STORE.A11yUi !== null && typeof STORE.A11yUi.Themes === "object" && STORE.A11yUi.Themes !== null && (typeof STORE.A11yUi.Themes[themeName] !== "object" || STORE.A11yUi.Themes[themeName] === null)) {
|
|
2697
|
-
STORE.A11yUi.Themes[themeName] = {};
|
|
2698
|
-
}
|
|
2699
|
-
if (typeof STORE.A11yUi === "object" && STORE.A11yUi !== null && typeof STORE.A11yUi.Themes === "object" && STORE.A11yUi.Themes !== null && typeof STORE.A11yUi.Themes[themeName] === "object" && STORE.A11yUi.Themes[themeName] !== null) {
|
|
2700
|
-
if (options.append && typeof STORE.A11yUi.Themes[themeName][tagName] === "string") {
|
|
2701
|
-
STORE.A11yUi.Themes[themeName][tagName] += css;
|
|
2702
|
-
} else {
|
|
2703
|
-
STORE.A11yUi.Themes[themeName][tagName] = css;
|
|
2704
|
-
}
|
|
2705
|
-
}
|
|
2706
|
-
};
|
|
2707
|
-
const patchTheme = (name, map, options, registerOptions) => setTheme(name, map, options, registerOptions);
|
|
2708
|
-
const setTheme = (name, map, options, registerOptions) => {
|
|
2709
|
-
validateThemeName(name);
|
|
2710
|
-
if (typeof map === "object" && map !== null) {
|
|
2711
|
-
const tagNames = Object.getOwnPropertyNames(map);
|
|
2712
|
-
tagNames.forEach((tagName) => {
|
|
2713
|
-
const cssStyle = map[tagName];
|
|
2714
|
-
const normalizedTagName = tagName.toLowerCase();
|
|
2715
|
-
const domTagName = typeof registerOptions?.transformTagName === "function" && !["GLOBAL", "PROPERTIES"].includes(tagName) ? registerOptions.transformTagName(normalizedTagName) : tagName;
|
|
2716
|
-
if (typeof cssStyle === "string" && cssStyle.length > 0) {
|
|
2717
|
-
setThemeTag(name, domTagName.toUpperCase(), cssStyle, options);
|
|
2718
|
-
}
|
|
2719
|
-
});
|
|
2720
|
-
}
|
|
2721
|
-
return name;
|
|
2722
|
-
};
|
|
2723
|
-
|
|
2724
|
-
const STYLING_TASK_QUEUE = /* @__PURE__ */ new Map();
|
|
2725
|
-
const HYDRATED_HISTORY = [];
|
|
2726
|
-
const CSS_PROPERTIES_REGISTERED = /* @__PURE__ */ new Set();
|
|
2727
|
-
const CSS_STYLE_CACHE = /* @__PURE__ */ new Map();
|
|
2728
|
-
const REGEX_CSS_PROPERTIES = /--[^;]+/g;
|
|
2729
|
-
const REGEX_SPLIT_CSS_PROPERTY = /:/;
|
|
2730
|
-
if (typeof STORE.A11yUi !== "object" || STORE.A11yUi === null) {
|
|
2731
|
-
STORE.A11yUi = {
|
|
2732
|
-
CSS_STYLE_CACHE,
|
|
2733
|
-
HYDRATED_HISTORY,
|
|
2734
|
-
STYLING_TASK_QUEUE
|
|
2735
|
-
};
|
|
2736
|
-
}
|
|
2737
|
-
const extractProperties = (themeName, css) => {
|
|
2738
|
-
let properties = css.match(REGEX_CSS_PROPERTIES);
|
|
2739
|
-
if (Array.isArray(properties)) {
|
|
2740
|
-
properties = properties.filter((property) => REGEX_SPLIT_CSS_PROPERTY.test(property));
|
|
2741
|
-
const style = document.createElement("style");
|
|
2742
|
-
style.innerHTML = `.${themeName} {${properties.join(";")}}`;
|
|
2743
|
-
document.querySelector("head")?.appendChild(style);
|
|
2744
|
-
}
|
|
2745
|
-
CSS_PROPERTIES_REGISTERED.add(themeName);
|
|
2746
|
-
};
|
|
2747
|
-
const getCssStyle = (themeName, tagName) => {
|
|
2748
|
-
if (
|
|
2749
|
-
/**
|
|
2750
|
-
* Search custom StyleSheet in Config
|
|
2751
|
-
* TODO: Performance???
|
|
2752
|
-
*/
|
|
2753
|
-
typeof STORE.A11yUi === "object" && STORE.A11yUi !== null && typeof STORE.A11yUi.Themes === "object" && STORE.A11yUi.Themes !== null && typeof STORE.A11yUi.Themes[themeName] === "object" && STORE.A11yUi.Themes[themeName] !== null && typeof STORE.A11yUi.Themes[themeName][tagName] === "string"
|
|
2754
|
-
) {
|
|
2755
|
-
return STORE.A11yUi.Themes[themeName][tagName].replace(
|
|
2756
|
-
/\r?\n/g,
|
|
2757
|
-
""
|
|
2758
|
-
);
|
|
2759
|
-
} else {
|
|
2760
|
-
return "";
|
|
2761
|
-
}
|
|
2762
|
-
};
|
|
2763
|
-
const removeStyle = (shadow) => {
|
|
2764
|
-
for (const childNode of Array.from(shadow.childNodes)) {
|
|
2765
|
-
if (childNode instanceof HTMLStyleElement && childNode.tagName === "STYLE") {
|
|
2766
|
-
shadow.removeChild(childNode);
|
|
2767
|
-
} else {
|
|
2768
|
-
break;
|
|
2769
|
-
}
|
|
2770
|
-
}
|
|
2771
|
-
};
|
|
2772
|
-
const patchStyle = (shadow, styles) => {
|
|
2773
|
-
try {
|
|
2774
|
-
const styleSheets = [];
|
|
2775
|
-
styles.forEach((style) => {
|
|
2776
|
-
const styleSheet = new CSSStyleSheet();
|
|
2777
|
-
styleSheet.replaceSync(style);
|
|
2778
|
-
styleSheets.push(styleSheet);
|
|
2779
|
-
});
|
|
2780
|
-
shadow.adoptedStyleSheets = styleSheets;
|
|
2781
|
-
} catch (e) {
|
|
2782
|
-
styles.reverse().forEach((style) => {
|
|
2783
|
-
const styleElement = document.createElement("style");
|
|
2784
|
-
styleElement.innerHTML = style;
|
|
2785
|
-
shadow.insertBefore(styleElement, shadow.firstChild);
|
|
2786
|
-
});
|
|
2787
|
-
}
|
|
2788
|
-
};
|
|
2789
|
-
const encroachStyles = (shadow, styles, encroachCss) => {
|
|
2790
|
-
if (encroachCss !== false) {
|
|
2791
|
-
const defaultStyleNodes = [
|
|
2792
|
-
...Array.from(shadow.childNodes).filter((node) => node instanceof HTMLStyleElement && node.tagName === "STYLE")
|
|
2793
|
-
];
|
|
2794
|
-
let defaultStyleSheets;
|
|
2795
|
-
try {
|
|
2796
|
-
defaultStyleSheets = [...Array.from(shadow.adoptedStyleSheets)];
|
|
2797
|
-
} catch (e) {
|
|
2798
|
-
defaultStyleSheets = [];
|
|
2799
|
-
}
|
|
2800
|
-
if (encroachCss?.mode === "before") {
|
|
2801
|
-
defaultStyleNodes.reverse().forEach((style) => styles.unshift(style.innerHTML));
|
|
2802
|
-
defaultStyleSheets.reverse().forEach(
|
|
2803
|
-
(style) => styles.unshift(
|
|
2804
|
-
Array.from(style.cssRules).map((rule) => rule.cssText).join("")
|
|
2805
|
-
)
|
|
2806
|
-
);
|
|
2807
|
-
} else if (encroachCss?.mode === "after") {
|
|
2808
|
-
defaultStyleNodes.forEach((style) => styles.push(style.innerHTML));
|
|
2809
|
-
defaultStyleSheets.forEach(
|
|
2810
|
-
(style) => styles.push(
|
|
2811
|
-
Array.from(style.cssRules).map((rule) => rule.cssText).join("")
|
|
2812
|
-
)
|
|
2813
|
-
);
|
|
2814
|
-
}
|
|
2815
|
-
}
|
|
2816
|
-
};
|
|
2817
|
-
const setThemeStyleAfterHydrated = (elm, themeDetails, styleDisplay) => {
|
|
2818
|
-
const themeName = themeDetails.name || "default";
|
|
2819
|
-
let shadow;
|
|
2820
|
-
try {
|
|
2821
|
-
if (elm.shadowRoot === null) {
|
|
2822
|
-
throw new Error("ShadowRoot is null");
|
|
2823
|
-
}
|
|
2824
|
-
shadow = elm.shadowRoot;
|
|
2825
|
-
} catch (e) {
|
|
2826
|
-
shadow = elm;
|
|
2827
|
-
}
|
|
2828
|
-
if (CSS_STYLE_CACHE.get(themeName)?.has(elm.tagName)) {
|
|
2829
|
-
switchStyle(elm, shadow, CSS_STYLE_CACHE.get(themeName)?.get(elm.tagName), styleDisplay);
|
|
2830
|
-
} else {
|
|
2831
|
-
const PROPERTY_STYLE = getCssStyle(themeName, "PROPERTIES");
|
|
2832
|
-
const GLOBAL_STYLE = getCssStyle(themeName, "GLOBAL");
|
|
2833
|
-
const TAG_STYLE = getCssStyle(themeName, elm.tagName);
|
|
2834
|
-
if (CSS_PROPERTIES_REGISTERED.has(themeName) === false) {
|
|
2835
|
-
extractProperties(themeName, GLOBAL_STYLE);
|
|
2836
|
-
}
|
|
2837
|
-
const STYLES = [PROPERTY_STYLE, GLOBAL_STYLE, TAG_STYLE];
|
|
2838
|
-
encroachStyles(shadow, STYLES, themeDetails.encroachCss);
|
|
2839
|
-
if (themeDetails.loglevel === "debug") {
|
|
2840
|
-
console.log(elm.tagName, STYLES);
|
|
2841
|
-
}
|
|
2842
|
-
if (themeDetails.cache === true) {
|
|
2843
|
-
if (CSS_STYLE_CACHE.has(themeName) === false) {
|
|
2844
|
-
CSS_STYLE_CACHE.set(themeName, /* @__PURE__ */ new Map());
|
|
2845
|
-
}
|
|
2846
|
-
CSS_STYLE_CACHE.get(themeName)?.set(elm.tagName, STYLES);
|
|
2847
|
-
}
|
|
2848
|
-
switchStyle(elm, shadow, STYLES, styleDisplay);
|
|
2849
|
-
}
|
|
2850
|
-
};
|
|
2851
|
-
const switchStyle = (elm, shadow, styles, styleDisplay) => {
|
|
2852
|
-
removeStyle(shadow);
|
|
2853
|
-
patchStyle(shadow, styles);
|
|
2854
|
-
elm.style.display = styleDisplay;
|
|
2855
|
-
};
|
|
2856
|
-
const logHydratedHistory = (themeDetails) => {
|
|
2857
|
-
if (themeDetails.loglevel === "debug") {
|
|
2858
|
-
HYDRATED_HISTORY.push({
|
|
2859
|
-
timestamp: Date.now(),
|
|
2860
|
-
numberOfTasks: STYLING_TASK_QUEUE.size
|
|
2861
|
-
});
|
|
2862
|
-
}
|
|
2863
|
-
};
|
|
2864
|
-
const deleteDoneTask = (elm) => {
|
|
2865
|
-
STYLING_TASK_QUEUE.delete(elm);
|
|
2866
|
-
};
|
|
2867
|
-
const loggedDeleteDoneTask = (elm, themeDetails) => {
|
|
2868
|
-
deleteDoneTask(elm);
|
|
2869
|
-
logHydratedHistory(themeDetails);
|
|
2870
|
-
};
|
|
2871
|
-
const observerCallback = (mutationsList) => {
|
|
2872
|
-
for (const mutation of mutationsList) {
|
|
2873
|
-
if (
|
|
2874
|
-
/**
|
|
2875
|
-
* Save by observer config
|
|
2876
|
-
*/
|
|
2877
|
-
// mutation.type === 'attributes' &&
|
|
2878
|
-
// mutation.attributeName === 'class' &&
|
|
2879
|
-
/**
|
|
2880
|
-
* Implizit check for HTMLElement
|
|
2881
|
-
*/
|
|
2882
|
-
// mutation.target &&
|
|
2883
|
-
STYLING_TASK_QUEUE.has(mutation.target) && mutation.target.classList.contains("hydrated")
|
|
2884
|
-
) {
|
|
2885
|
-
const { styleDisplay, themeDetails } = STYLING_TASK_QUEUE.get(mutation.target);
|
|
2886
|
-
setThemeStyleAfterHydrated(mutation.target, themeDetails, styleDisplay);
|
|
2887
|
-
loggedDeleteDoneTask(mutation.target, themeDetails);
|
|
2888
|
-
}
|
|
2889
|
-
}
|
|
2890
|
-
};
|
|
2891
|
-
try {
|
|
2892
|
-
new MutationObserver(observerCallback);
|
|
2893
|
-
} catch (e) {
|
|
2894
|
-
}
|
|
2666
|
+
.catch(console.warn);`)),(typeof o$1.A11yUi!="object"||o$1.A11yUi===null)&&(o$1.A11yUi={}),typeof o$1.A11yUi=="object"&&o$1.A11yUi!==null&&(typeof o$1.A11yUi.Themes!="object"||o$1.A11yUi.Themes===null)&&(o$1.A11yUi.Themes={}),typeof o$1.A11yUi=="object"&&o$1.A11yUi!==null&&typeof o$1.A11yUi.Themes=="object"&&o$1.A11yUi.Themes!==null&&(typeof o$1.A11yUi.Themes[e]!="object"||o$1.A11yUi.Themes[e]===null)&&(o$1.A11yUi.Themes[e]={}),typeof o$1.A11yUi=="object"&&o$1.A11yUi!==null&&typeof o$1.A11yUi.Themes=="object"&&o$1.A11yUi.Themes!==null&&typeof o$1.A11yUi.Themes[e]=="object"&&o$1.A11yUi.Themes[e]!==null&&(a.append&&typeof o$1.A11yUi.Themes[e][t]=="string"?o$1.A11yUi.Themes[e][t]+=s:o$1.A11yUi.Themes[e][t]=s);},x=(e,t,s,a)=>g(e,t,s,a),g=(e,t,s,a)=>(U(e),typeof t=="object"&&t!==null&&Object.getOwnPropertyNames(t).forEach(r=>{const n=t[r],i=r.toLowerCase(),m=typeof a?.transformTagName=="function"&&!["GLOBAL","PROPERTIES"].includes(r)?a.transformTagName(i):r;typeof n=="string"&&n.length>0&&d(e,m.toUpperCase(),n,s);}),e);const c$1=new Map,v=[],L=new Set,h=new Map,K=/--[^;]+/g,q=/:/;(typeof o$1.A11yUi!="object"||o$1.A11yUi===null)&&(o$1.A11yUi={CSS_STYLE_CACHE:h,HYDRATED_HISTORY:v,STYLING_TASK_QUEUE:c$1});const F=(e,t)=>{let s=t.match(K);if(Array.isArray(s)){s=s.filter(r=>q.test(r));const a=document.createElement("style");a.innerHTML=`.${e} {${s.join(";")}}`,document.querySelector("head")?.appendChild(a);}L.add(e);},p=(e,t)=>typeof o$1.A11yUi=="object"&&o$1.A11yUi!==null&&typeof o$1.A11yUi.Themes=="object"&&o$1.A11yUi.Themes!==null&&typeof o$1.A11yUi.Themes[e]=="object"&&o$1.A11yUi.Themes[e]!==null&&typeof o$1.A11yUi.Themes[e][t]=="string"?o$1.A11yUi.Themes[e][t].replace(/\r?\n/g,""):"",Q=e=>{for(const t of Array.from(e.childNodes))if(t instanceof HTMLStyleElement&&t.tagName==="STYLE")e.removeChild(t);else break},J=(e,t)=>{try{const s=[];t.forEach(a=>{const r=new CSSStyleSheet;r.replaceSync(a),s.push(r);}),e.adoptedStyleSheets=s;}catch{t.reverse().forEach(s=>{const a=document.createElement("style");a.innerHTML=s,e.insertBefore(a,e.firstChild);});}},V=(e,t,s)=>{if(s!==!1){const a=[...Array.from(e.childNodes).filter(n=>n instanceof HTMLStyleElement&&n.tagName==="STYLE")];let r;try{r=[...Array.from(e.adoptedStyleSheets)];}catch{r=[];}s?.mode==="before"?(a.reverse().forEach(n=>t.unshift(n.innerHTML)),r.reverse().forEach(n=>t.unshift(Array.from(n.cssRules).map(i=>i.cssText).join("")))):s?.mode==="after"&&(a.forEach(n=>t.push(n.innerHTML)),r.forEach(n=>t.push(Array.from(n.cssRules).map(i=>i.cssText).join(""))));}},M=(e,t,s)=>{const a=t.name||"default";let r;try{if(e.shadowRoot===null)throw new Error("ShadowRoot is null");r=e.shadowRoot;}catch{r=e;}if(h.get(a)?.has(e.tagName))$(e,r,h.get(a)?.get(e.tagName),s);else {const n=p(a,"PROPERTIES"),i=p(a,"GLOBAL"),m=p(a,e.tagName);L.has(a)===!1&&F(a,i);const y=[n,i,m];V(r,y,t.encroachCss),t.loglevel==="debug"&&console.log(e.tagName,y),t.cache===!0&&(h.has(a)===!1&&h.set(a,new Map),h.get(a)?.set(e.tagName,y)),$(e,r,y,s);}},$=(e,t,s,a)=>{Q(t),J(t,s),e.style.display=a;},O=e=>{e.loglevel==="debug"&&v.push({timestamp:Date.now(),numberOfTasks:c$1.size});},Z$1=e=>{c$1.delete(e);},R=(e,t)=>{Z$1(e),O(t);},ee=e=>{for(const t of e)if(c$1.has(t.target)&&t.target.classList.contains("hydrated")){const{styleDisplay:s,themeDetails:a}=c$1.get(t.target);M(t.target,a,s),R(t.target,a);}};try{new MutationObserver(ee);}catch{}
|
|
2895
2667
|
|
|
2896
2668
|
const alertTypeOptions = ['default', 'info', 'success', 'warning', 'error'];
|
|
2897
2669
|
const alertVariantOptions = ['card', 'msg'];
|
|
@@ -3966,9 +3738,9 @@ const koliBriQuerySelector = (selector, node) => querySelector(selector, node ||
|
|
|
3966
3738
|
const koliBriQuerySelectorAll = (selector, node) => querySelectorAll(selector, node || getDocument());
|
|
3967
3739
|
class KoliBriDevHelper {
|
|
3968
3740
|
}
|
|
3969
|
-
KoliBriDevHelper.getCssStyle =
|
|
3970
|
-
KoliBriDevHelper.patchTheme =
|
|
3971
|
-
KoliBriDevHelper.patchThemeTag =
|
|
3741
|
+
KoliBriDevHelper.getCssStyle = p;
|
|
3742
|
+
KoliBriDevHelper.patchTheme = x;
|
|
3743
|
+
KoliBriDevHelper.patchThemeTag = z;
|
|
3972
3744
|
KoliBriDevHelper.querySelector = koliBriQuerySelector;
|
|
3973
3745
|
KoliBriDevHelper.querySelectorAll = koliBriQuerySelectorAll;
|
|
3974
3746
|
KoliBriDevHelper.stringifyJson = stringifyJson;
|
|
@@ -11401,7 +11173,7 @@ class KolModal {
|
|
|
11401
11173
|
}; }
|
|
11402
11174
|
}
|
|
11403
11175
|
|
|
11404
|
-
const defaultStyleCss$h = "/*\n * This file contains all rules for accessibility.\n */\n@layer kol-global {\n :host {\n /*\n * Minimum size of interactive elements.\n */\n --a11y-min-size: 44px;\n /*\n * No element should be used without a background and font color whose contrast ratio has\n * not been checked. By initially setting the background color to white and the font color\n * to black, the contrast ratio is ensured and explicit adjustment is forced.\n */\n background-color: white;\n color: black;\n /*\n * Verdana is an accessible font that can be used without requiring additional loading time.\n */\n font-family: Verdana;\n }\n * {\n /*\n * This rule enables the word dividing for all texts. That is important for high zoom levels.\n */\n hyphens: auto;\n /*\n * Letter spacing is required for all texts.\n */\n letter-spacing: inherit;\n /*\n * This rule enables the word dividing for all texts. That is important for high zoom levels.\n */\n word-break: break-word;\n /*\n * Word spacing is required for all texts.\n */\n word-spacing: inherit;\n }\n /*\n * All interactive elements should have a minimum size of 44px.\n */\n /* input:not([type='checkbox'], [type='radio'], [type='range']), */\n /* option, */\n /* select, */\n /* textarea, */\n [role=button],\n button:not([role=link]),\n .kol-input .input {\n min-height: var(--a11y-min-size);\n min-width: var(--a11y-min-size);\n }\n /*\n * Some interactive elements should not inherit the font-family and font-size.\n */\n a,\n button,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n input,\n option,\n select,\n textarea {\n /*\n * All elements should inherit the font family from his parent element.\n */\n font-family: inherit;\n /*\n * All elements should inherit the font size from his parent element.\n */\n font-size: inherit;\n }\n}\n/**\n * Sometimes we need the semantic element for accessibility reasons,\n * but we don't want to show it.\n *\n * - https://www.a11yproject.com/posts/how-to-hide-content/\n */\n.visually-hidden {\n clip: rect(0 0 0 0);\n clip-path: inset(50%);\n height: 1px;\n overflow: hidden;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n}\n\n@layer kol-global {\n /*\n * Dieses CSS stellt sicher, dass der Standard-Style\n * von A und Button resettet werden.\n */\n :is(a, button) {\n background-color: transparent;\n border: none;\n margin: 0;\n padding: 0;\n width: 100%; /* 100% needed for custom width from outside */\n }\n /*\n * Ensure elements with hidden attribute to be actually not visible\n * @see https://meowni.ca/hidden.is.a.lie.html\n */\n [hidden] {\n display: none !important;\n }\n}\n@layer kol-global {\n :host {\n /*\n * The max-width is needed to prevent the table from overflowing the\n * parent node, if the table is wider than the parent node.\n */\n max-width: 100%;\n }\n * {\n /*\n * We prefer to box-sizing: border-box for all elements.\n */\n box-sizing: border-box;\n }\n /* KolSpan is a layout component with icons in all directions and a label text in the middle. */\n .kol-span-wc {\n display: grid;\n place-items: center;\n }\n /* The sub span in KolSpan is the horizontal span with icon left and right and the label text in the middle. */\n .kol-span-wc > span {\n display: flex;\n place-items: center;\n }\n a,\n button {\n cursor: pointer;\n }\n /* This is the text label. */\n .hide-label > .kol-span-wc > span > span {\n display: none;\n }\n /* Reset browser agent style. */\n button:disabled {\n color: unset;\n }\n .disabled label,\n .disabled:focus-within label,\n [aria-disabled=true],\n [aria-disabled=true]:focus,\n [disabled],\n [disabled]:focus {\n cursor: not-allowed;\n opacity: 0.5;\n outline: none;\n }\n [aria-disabled=true]:focus .kol-span-wc,\n [disabled]:focus .kol-span-wc {\n outline: none !important;\n }\n}\n@layer kol-component {\n :host {\n font-size: calc(16rem / var(--kolibri-root-font-size, 16));\n }\n :host > div {\n display: grid;\n place-items: center;\n }\n :not(.is-compact) nav {\n width: 100%;\n }\n .list {\n display: flex;\n list-style: none;\n margin: 0;\n padding: 0;\n }\n .list.vertical {\n flex-direction: column;\n }\n .entry {\n display: flex;\n }\n .entry-item {\n flex-grow: 1;\n }\n}";
|
|
11176
|
+
const defaultStyleCss$h = "/*\n * This file contains all rules for accessibility.\n */\n@layer kol-global {\n :host {\n /*\n * Minimum size of interactive elements.\n */\n --a11y-min-size: 44px;\n /*\n * No element should be used without a background and font color whose contrast ratio has\n * not been checked. By initially setting the background color to white and the font color\n * to black, the contrast ratio is ensured and explicit adjustment is forced.\n */\n background-color: white;\n color: black;\n /*\n * Verdana is an accessible font that can be used without requiring additional loading time.\n */\n font-family: Verdana;\n }\n * {\n /*\n * This rule enables the word dividing for all texts. That is important for high zoom levels.\n */\n hyphens: auto;\n /*\n * Letter spacing is required for all texts.\n */\n letter-spacing: inherit;\n /*\n * This rule enables the word dividing for all texts. That is important for high zoom levels.\n */\n word-break: break-word;\n /*\n * Word spacing is required for all texts.\n */\n word-spacing: inherit;\n }\n /*\n * All interactive elements should have a minimum size of 44px.\n */\n /* input:not([type='checkbox'], [type='radio'], [type='range']), */\n /* option, */\n /* select, */\n /* textarea, */\n [role=button],\n button:not([role=link]),\n .kol-input .input {\n min-height: var(--a11y-min-size);\n min-width: var(--a11y-min-size);\n }\n /*\n * Some interactive elements should not inherit the font-family and font-size.\n */\n a,\n button,\n h1,\n h2,\n h3,\n h4,\n h5,\n h6,\n input,\n option,\n select,\n textarea {\n /*\n * All elements should inherit the font family from his parent element.\n */\n font-family: inherit;\n /*\n * All elements should inherit the font size from his parent element.\n */\n font-size: inherit;\n }\n}\n/**\n * Sometimes we need the semantic element for accessibility reasons,\n * but we don't want to show it.\n *\n * - https://www.a11yproject.com/posts/how-to-hide-content/\n */\n.visually-hidden {\n clip: rect(0 0 0 0);\n clip-path: inset(50%);\n height: 1px;\n overflow: hidden;\n position: absolute;\n white-space: nowrap;\n width: 1px;\n}\n\n@layer kol-global {\n /*\n * Dieses CSS stellt sicher, dass der Standard-Style\n * von A und Button resettet werden.\n */\n :is(a, button) {\n background-color: transparent;\n border: none;\n margin: 0;\n padding: 0;\n width: 100%; /* 100% needed for custom width from outside */\n }\n /*\n * Ensure elements with hidden attribute to be actually not visible\n * @see https://meowni.ca/hidden.is.a.lie.html\n */\n [hidden] {\n display: none !important;\n }\n}\n@layer kol-global {\n :host {\n /*\n * The max-width is needed to prevent the table from overflowing the\n * parent node, if the table is wider than the parent node.\n */\n max-width: 100%;\n }\n * {\n /*\n * We prefer to box-sizing: border-box for all elements.\n */\n box-sizing: border-box;\n }\n /* KolSpan is a layout component with icons in all directions and a label text in the middle. */\n .kol-span-wc {\n display: grid;\n place-items: center;\n }\n /* The sub span in KolSpan is the horizontal span with icon left and right and the label text in the middle. */\n .kol-span-wc > span {\n display: flex;\n place-items: center;\n }\n a,\n button {\n cursor: pointer;\n }\n /* This is the text label. */\n .hide-label > .kol-span-wc > span > span {\n display: none;\n }\n /* Reset browser agent style. */\n button:disabled {\n color: unset;\n }\n .disabled label,\n .disabled:focus-within label,\n [aria-disabled=true],\n [aria-disabled=true]:focus,\n [disabled],\n [disabled]:focus {\n cursor: not-allowed;\n opacity: 0.5;\n outline: none;\n }\n [aria-disabled=true]:focus .kol-span-wc,\n [disabled]:focus .kol-span-wc {\n outline: none !important;\n }\n}\n@layer kol-component {\n :host {\n font-size: calc(16rem / var(--kolibri-root-font-size, 16));\n }\n :host > div {\n display: grid;\n place-items: center;\n }\n :not(.is-compact) nav {\n width: 100%;\n }\n .list {\n display: flex;\n list-style: none;\n margin: 0;\n padding: 0;\n }\n .list.vertical {\n flex-direction: column;\n }\n .list.horizontal {\n flex-wrap: wrap;\n }\n .entry {\n display: flex;\n }\n .entry-item {\n flex-grow: 1;\n }\n}";
|
|
11405
11177
|
var KolNavDefaultStyle0 = defaultStyleCss$h;
|
|
11406
11178
|
|
|
11407
11179
|
const entryIsLink = (entryProps) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@public-ui/hydrate",
|
|
3
|
-
"version": "2.1.8
|
|
3
|
+
"version": "2.1.8",
|
|
4
4
|
"license": "EUPL-1.2",
|
|
5
5
|
"homepage": "https://public-ui.github.io",
|
|
6
6
|
"repository": {
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"hydrate"
|
|
46
46
|
],
|
|
47
47
|
"devDependencies": {
|
|
48
|
-
"rimraf": "
|
|
49
|
-
"@public-ui/components": "2.1.8
|
|
48
|
+
"rimraf": "6.0.1",
|
|
49
|
+
"@public-ui/components": "2.1.8"
|
|
50
50
|
},
|
|
51
51
|
"peerDependencies": {
|
|
52
|
-
"@public-ui/components": "2.1.8
|
|
52
|
+
"@public-ui/components": "2.1.8"
|
|
53
53
|
},
|
|
54
54
|
"sideEffects": false,
|
|
55
55
|
"type": "commonjs",
|