@noirmd/previewer 2.1.2 → 2.1.4
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/NReditor.cjs +105 -15
- package/dist/NReditor.cjs.map +1 -1
- package/dist/NReditor.js +106 -16
- package/dist/NReditor.js.map +1 -1
- package/dist/card.css +150 -142
- package/dist/editor.css +58 -3
- package/dist/index.cjs +45 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +45 -3
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +105 -15
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +106 -16
- package/dist/react.js.map +1 -1
- package/dist/vanilla.cjs +45 -3
- package/dist/vanilla.cjs.map +1 -1
- package/dist/vanilla.js +45 -3
- package/dist/vanilla.js.map +1 -1
- package/dist/vue.cjs +45 -3
- package/dist/vue.cjs.map +1 -1
- package/dist/vue.js +45 -3
- package/dist/vue.js.map +1 -1
- package/editor.css +58 -3
- package/package.json +1 -1
package/dist/vue.js
CHANGED
|
@@ -11992,6 +11992,22 @@ var hovergalleryDirective = ({ props, slots }) => {
|
|
|
11992
11992
|
var hovergallery_default = hovergalleryDirective;
|
|
11993
11993
|
|
|
11994
11994
|
// vanilla/directives/chat.ts
|
|
11995
|
+
var CHAT_THEME_TOKENS = /* @__PURE__ */ new Set([
|
|
11996
|
+
"primary",
|
|
11997
|
+
"secondary",
|
|
11998
|
+
"accent",
|
|
11999
|
+
"neutral",
|
|
12000
|
+
"info",
|
|
12001
|
+
"success",
|
|
12002
|
+
"warning",
|
|
12003
|
+
"error"
|
|
12004
|
+
]);
|
|
12005
|
+
function isArbitraryColor(value) {
|
|
12006
|
+
if (CHAT_THEME_TOKENS.has(value)) return false;
|
|
12007
|
+
if (/^(#|rgb|hsl|oklch|oklab|lab|lch|color\()/i.test(value)) return true;
|
|
12008
|
+
if (/^[a-zA-Z]+$/.test(value)) return true;
|
|
12009
|
+
return false;
|
|
12010
|
+
}
|
|
11995
12011
|
var chatItemDirective = ({ props, renderSlot }) => {
|
|
11996
12012
|
const side = props.side === "end" ? "end" : "start";
|
|
11997
12013
|
const wrap = document.createElement("div");
|
|
@@ -12022,8 +12038,14 @@ var chatItemDirective = ({ props, renderSlot }) => {
|
|
|
12022
12038
|
avatar.appendChild(img);
|
|
12023
12039
|
wrap.appendChild(avatar);
|
|
12024
12040
|
}
|
|
12041
|
+
const isThemeToken = CHAT_THEME_TOKENS.has(props.color || "");
|
|
12042
|
+
const colorClass = isThemeToken ? ` nr-chat__bubble--${props.color}` : "";
|
|
12025
12043
|
const bubble = document.createElement("div");
|
|
12026
|
-
bubble.className = `nr-chat__bubble${
|
|
12044
|
+
bubble.className = `nr-chat__bubble${colorClass}`;
|
|
12045
|
+
if (props.color && isArbitraryColor(props.color) && !isThemeToken) {
|
|
12046
|
+
bubble.style.background = props.color;
|
|
12047
|
+
bubble.style.color = "white";
|
|
12048
|
+
}
|
|
12027
12049
|
bubble.appendChild(renderSlot("default"));
|
|
12028
12050
|
wrap.appendChild(bubble);
|
|
12029
12051
|
if (props.footer) {
|
|
@@ -12145,15 +12167,32 @@ var richlistDirective = ({ props, renderSlot }) => {
|
|
|
12145
12167
|
var richlist_default = richlistDirective;
|
|
12146
12168
|
|
|
12147
12169
|
// vanilla/directives/stat.ts
|
|
12170
|
+
var STAT_THEME_TOKENS = /* @__PURE__ */ new Set([
|
|
12171
|
+
"primary",
|
|
12172
|
+
"secondary",
|
|
12173
|
+
"info",
|
|
12174
|
+
"success",
|
|
12175
|
+
"warning",
|
|
12176
|
+
"error"
|
|
12177
|
+
]);
|
|
12178
|
+
function isArbitraryColor2(value) {
|
|
12179
|
+
if (STAT_THEME_TOKENS.has(value)) return false;
|
|
12180
|
+
if (/^(#|rgb|hsl|oklch|oklab|lab|lch|color\()/i.test(value)) return true;
|
|
12181
|
+
if (/^[a-zA-Z]+$/.test(value)) return true;
|
|
12182
|
+
return false;
|
|
12183
|
+
}
|
|
12148
12184
|
var statDirective = ({ props }) => {
|
|
12149
|
-
const
|
|
12185
|
+
const isThemeToken = STAT_THEME_TOKENS.has(props.color || "");
|
|
12186
|
+
const colorClass = isThemeToken ? ` nr-stat--${props.color}` : "";
|
|
12150
12187
|
const stat = document.createElement("div");
|
|
12151
12188
|
stat.className = `nr-stat${colorClass}`;
|
|
12152
12189
|
if (props.class) stat.classList.add(...props.class.split(/\s+/).filter(Boolean));
|
|
12153
12190
|
if (props.style) stat.setAttribute("style", props.style);
|
|
12191
|
+
const useInlineColor = props.color && isArbitraryColor2(props.color) && !isThemeToken;
|
|
12154
12192
|
if (props.icon) {
|
|
12155
12193
|
const figure = document.createElement("div");
|
|
12156
12194
|
figure.className = "nr-stat__figure";
|
|
12195
|
+
if (useInlineColor) figure.style.color = props.color;
|
|
12157
12196
|
figure.appendChild(createIcon(props.icon));
|
|
12158
12197
|
stat.appendChild(figure);
|
|
12159
12198
|
}
|
|
@@ -12166,6 +12205,7 @@ var statDirective = ({ props }) => {
|
|
|
12166
12205
|
if (props.value) {
|
|
12167
12206
|
const value = document.createElement("div");
|
|
12168
12207
|
value.className = "nr-stat__value";
|
|
12208
|
+
if (useInlineColor) value.style.color = props.color;
|
|
12169
12209
|
value.textContent = props.value;
|
|
12170
12210
|
stat.appendChild(value);
|
|
12171
12211
|
}
|
|
@@ -12292,7 +12332,9 @@ function processElements(elements, ctx, allElements) {
|
|
|
12292
12332
|
}
|
|
12293
12333
|
} else {
|
|
12294
12334
|
const grid = document.createElement("div");
|
|
12295
|
-
|
|
12335
|
+
const gridClass = BATCHED_DIRECTIVES[cards[0].directiveType];
|
|
12336
|
+
const align = cards[0].props?.align;
|
|
12337
|
+
grid.className = align === "center" || align === "right" ? `${gridClass} ${gridClass}--${align}` : gridClass;
|
|
12296
12338
|
for (const card of cards) {
|
|
12297
12339
|
const rendered = renderElement(card, ctx, allElements);
|
|
12298
12340
|
if (rendered) grid.appendChild(rendered);
|