@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.cjs
CHANGED
|
@@ -12011,6 +12011,22 @@ var hovergalleryDirective = ({ props, slots }) => {
|
|
|
12011
12011
|
var hovergallery_default = hovergalleryDirective;
|
|
12012
12012
|
|
|
12013
12013
|
// vanilla/directives/chat.ts
|
|
12014
|
+
var CHAT_THEME_TOKENS = /* @__PURE__ */ new Set([
|
|
12015
|
+
"primary",
|
|
12016
|
+
"secondary",
|
|
12017
|
+
"accent",
|
|
12018
|
+
"neutral",
|
|
12019
|
+
"info",
|
|
12020
|
+
"success",
|
|
12021
|
+
"warning",
|
|
12022
|
+
"error"
|
|
12023
|
+
]);
|
|
12024
|
+
function isArbitraryColor(value) {
|
|
12025
|
+
if (CHAT_THEME_TOKENS.has(value)) return false;
|
|
12026
|
+
if (/^(#|rgb|hsl|oklch|oklab|lab|lch|color\()/i.test(value)) return true;
|
|
12027
|
+
if (/^[a-zA-Z]+$/.test(value)) return true;
|
|
12028
|
+
return false;
|
|
12029
|
+
}
|
|
12014
12030
|
var chatItemDirective = ({ props, renderSlot }) => {
|
|
12015
12031
|
const side = props.side === "end" ? "end" : "start";
|
|
12016
12032
|
const wrap = document.createElement("div");
|
|
@@ -12041,8 +12057,14 @@ var chatItemDirective = ({ props, renderSlot }) => {
|
|
|
12041
12057
|
avatar.appendChild(img);
|
|
12042
12058
|
wrap.appendChild(avatar);
|
|
12043
12059
|
}
|
|
12060
|
+
const isThemeToken = CHAT_THEME_TOKENS.has(props.color || "");
|
|
12061
|
+
const colorClass = isThemeToken ? ` nr-chat__bubble--${props.color}` : "";
|
|
12044
12062
|
const bubble = document.createElement("div");
|
|
12045
|
-
bubble.className = `nr-chat__bubble${
|
|
12063
|
+
bubble.className = `nr-chat__bubble${colorClass}`;
|
|
12064
|
+
if (props.color && isArbitraryColor(props.color) && !isThemeToken) {
|
|
12065
|
+
bubble.style.background = props.color;
|
|
12066
|
+
bubble.style.color = "white";
|
|
12067
|
+
}
|
|
12046
12068
|
bubble.appendChild(renderSlot("default"));
|
|
12047
12069
|
wrap.appendChild(bubble);
|
|
12048
12070
|
if (props.footer) {
|
|
@@ -12164,15 +12186,32 @@ var richlistDirective = ({ props, renderSlot }) => {
|
|
|
12164
12186
|
var richlist_default = richlistDirective;
|
|
12165
12187
|
|
|
12166
12188
|
// vanilla/directives/stat.ts
|
|
12189
|
+
var STAT_THEME_TOKENS = /* @__PURE__ */ new Set([
|
|
12190
|
+
"primary",
|
|
12191
|
+
"secondary",
|
|
12192
|
+
"info",
|
|
12193
|
+
"success",
|
|
12194
|
+
"warning",
|
|
12195
|
+
"error"
|
|
12196
|
+
]);
|
|
12197
|
+
function isArbitraryColor2(value) {
|
|
12198
|
+
if (STAT_THEME_TOKENS.has(value)) return false;
|
|
12199
|
+
if (/^(#|rgb|hsl|oklch|oklab|lab|lch|color\()/i.test(value)) return true;
|
|
12200
|
+
if (/^[a-zA-Z]+$/.test(value)) return true;
|
|
12201
|
+
return false;
|
|
12202
|
+
}
|
|
12167
12203
|
var statDirective = ({ props }) => {
|
|
12168
|
-
const
|
|
12204
|
+
const isThemeToken = STAT_THEME_TOKENS.has(props.color || "");
|
|
12205
|
+
const colorClass = isThemeToken ? ` nr-stat--${props.color}` : "";
|
|
12169
12206
|
const stat = document.createElement("div");
|
|
12170
12207
|
stat.className = `nr-stat${colorClass}`;
|
|
12171
12208
|
if (props.class) stat.classList.add(...props.class.split(/\s+/).filter(Boolean));
|
|
12172
12209
|
if (props.style) stat.setAttribute("style", props.style);
|
|
12210
|
+
const useInlineColor = props.color && isArbitraryColor2(props.color) && !isThemeToken;
|
|
12173
12211
|
if (props.icon) {
|
|
12174
12212
|
const figure = document.createElement("div");
|
|
12175
12213
|
figure.className = "nr-stat__figure";
|
|
12214
|
+
if (useInlineColor) figure.style.color = props.color;
|
|
12176
12215
|
figure.appendChild(createIcon(props.icon));
|
|
12177
12216
|
stat.appendChild(figure);
|
|
12178
12217
|
}
|
|
@@ -12185,6 +12224,7 @@ var statDirective = ({ props }) => {
|
|
|
12185
12224
|
if (props.value) {
|
|
12186
12225
|
const value = document.createElement("div");
|
|
12187
12226
|
value.className = "nr-stat__value";
|
|
12227
|
+
if (useInlineColor) value.style.color = props.color;
|
|
12188
12228
|
value.textContent = props.value;
|
|
12189
12229
|
stat.appendChild(value);
|
|
12190
12230
|
}
|
|
@@ -12311,7 +12351,9 @@ function processElements(elements, ctx, allElements) {
|
|
|
12311
12351
|
}
|
|
12312
12352
|
} else {
|
|
12313
12353
|
const grid = document.createElement("div");
|
|
12314
|
-
|
|
12354
|
+
const gridClass = BATCHED_DIRECTIVES[cards[0].directiveType];
|
|
12355
|
+
const align = cards[0].props?.align;
|
|
12356
|
+
grid.className = align === "center" || align === "right" ? `${gridClass} ${gridClass}--${align}` : gridClass;
|
|
12315
12357
|
for (const card of cards) {
|
|
12316
12358
|
const rendered = renderElement(card, ctx, allElements);
|
|
12317
12359
|
if (rendered) grid.appendChild(rendered);
|