@rulecms/widget-angular 0.8.0 → 0.8.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/fesm2022/rulecms-widget-angular.mjs +26 -4
- package/fesm2022/rulecms-widget-angular.mjs.map +1 -1
- package/lib/project-css-classes/format-project-css-classes-stylesheet.d.ts +13 -1
- package/lib/project-css-classes/format-project-css-classes-stylesheet.d.ts.map +1 -1
- package/lib/project-css-properties/format-project-css-properties-stylesheet.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -3508,8 +3508,26 @@ const wrapProjectCssClassesStylesheetInLayer = (css, classLayer) => {
|
|
|
3508
3508
|
* `[data-rulecms-published-key="…"]`. `CSS.escape` is not assumed (SSR / Node).
|
|
3509
3509
|
*/
|
|
3510
3510
|
const escapeCssAttributeValue$2 = (value) => value.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
|
|
3511
|
-
/**
|
|
3512
|
-
|
|
3511
|
+
/**
|
|
3512
|
+
* Escape a class name for use after `.` in a selector. `/` becomes `\/` so
|
|
3513
|
+
* `ring-parity-accent/30` emits as `.ring-parity-accent\/30`.
|
|
3514
|
+
*
|
|
3515
|
+
* A CSS identifier may not *start* with a digit, or with a hyphen followed by a
|
|
3516
|
+
* digit, so a leading digit needs the numeric escape form instead of a
|
|
3517
|
+
* backslash: `2xl:flex` has to emit `.\32 xl\:flex`, because `.2xl\:flex` is a
|
|
3518
|
+
* parse error and the browser drops the whole rule. Tailwind breakpoint
|
|
3519
|
+
* prefixes (`2xl:`) and grid utilities kept in class names hit this.
|
|
3520
|
+
*/
|
|
3521
|
+
const escapeCssClassName = (name) => {
|
|
3522
|
+
const escaped = name.replace(/[^A-Za-z0-9_-]/g, char => `\\${char}`);
|
|
3523
|
+
if (/^[0-9]/.test(escaped)) {
|
|
3524
|
+
return `\\3${escaped[0]} ${escaped.slice(1)}`;
|
|
3525
|
+
}
|
|
3526
|
+
if (/^-[0-9]/.test(escaped)) {
|
|
3527
|
+
return `-\\3${escaped[1]} ${escaped.slice(2)}`;
|
|
3528
|
+
}
|
|
3529
|
+
return escaped;
|
|
3530
|
+
};
|
|
3513
3531
|
const REJECTED_IN_BODY = ['</', '<script', '@import', 'javascript:', 'vbscript:', 'expression('];
|
|
3514
3532
|
// eslint-disable-next-line no-control-regex -- control characters are what this matches
|
|
3515
3533
|
const REJECTED_CONTROL_CHARACTERS$2 = /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/;
|
|
@@ -3573,6 +3591,9 @@ const indentDeclarationBody$1 = (body) => body
|
|
|
3573
3591
|
/**
|
|
3574
3592
|
* Descendant class rules under this widget’s published-key span.
|
|
3575
3593
|
* Empty / flag-off / unsanitary catalogs return null so the caller omits `<style>`.
|
|
3594
|
+
*
|
|
3595
|
+
* Rules are emitted in catalog order. Two utilities that set the same property
|
|
3596
|
+
* are resolved by source order, so re-sorting here would change which one wins.
|
|
3576
3597
|
*/
|
|
3577
3598
|
const formatProjectCssClassesStylesheet = (publishedKey, classes, includeClassDefinitions, classLayer) => {
|
|
3578
3599
|
if (!shouldIncludeClassDefinitionsOnPublishedWidget(includeClassDefinitions)) {
|
|
@@ -3585,7 +3606,6 @@ const formatProjectCssClassesStylesheet = (publishedKey, classes, includeClassDe
|
|
|
3585
3606
|
}
|
|
3586
3607
|
const ancestor = `[data-rulecms-published-key="${escapeCssAttributeValue$2(publishedKey)}"]`;
|
|
3587
3608
|
const css = names
|
|
3588
|
-
.sort((left, right) => left.localeCompare(right))
|
|
3589
3609
|
.map(name => `${ancestor} .${escapeCssClassName(name)} {\n${indentDeclarationBody$1(sanitized[name])}\n}`)
|
|
3590
3610
|
.join('\n');
|
|
3591
3611
|
return wrapProjectCssClassesStylesheetInLayer(css, classLayer);
|
|
@@ -4255,7 +4275,9 @@ const PROJECT_CSS_PROPERTY_SYNTAX_VALUES = [
|
|
|
4255
4275
|
];
|
|
4256
4276
|
const PROPERTY_SYNTAX_SET = new Set(PROJECT_CSS_PROPERTY_SYNTAX_VALUES);
|
|
4257
4277
|
const REJECTED_IN_EMITTED_VALUE$2 = /[{};]/;
|
|
4258
|
-
|
|
4278
|
+
// RuleCMS's cap. Below it, the published widget silently drops registrations
|
|
4279
|
+
// the composer renders.
|
|
4280
|
+
const MAX_PROJECT_CSS_PROPERTIES = 200;
|
|
4259
4281
|
const PROPERTY_INITIAL_VALUE_MAX_LENGTH = 200;
|
|
4260
4282
|
const isAllowlistedSyntax = (value) => typeof value === 'string' && PROPERTY_SYNTAX_SET.has(value);
|
|
4261
4283
|
const isSafeInitialValue = (value, syntax) => {
|