@rulecms/widget-angular 0.8.0 → 0.8.2

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.
Files changed (26) hide show
  1. package/README.md +1 -1
  2. package/fesm2022/rulecms-widget-angular.mjs +217 -44
  3. package/fesm2022/rulecms-widget-angular.mjs.map +1 -1
  4. package/lib/helpers/prepare-style-element-css.d.ts +11 -0
  5. package/lib/helpers/prepare-style-element-css.d.ts.map +1 -0
  6. package/lib/project-css-classes/format-project-css-classes-stylesheet.d.ts +13 -1
  7. package/lib/project-css-classes/format-project-css-classes-stylesheet.d.ts.map +1 -1
  8. package/lib/project-css-classes/project-css-classes-stylesheet.component.d.ts.map +1 -1
  9. package/lib/project-css-fonts/project-css-fonts-stylesheet.component.d.ts.map +1 -1
  10. package/lib/project-css-keyframes/project-css-keyframes-stylesheet.component.d.ts.map +1 -1
  11. package/lib/project-css-position-try/project-css-position-try-stylesheet.component.d.ts.map +1 -1
  12. package/lib/project-css-properties/format-project-css-properties-stylesheet.d.ts.map +1 -1
  13. package/lib/project-css-properties/project-css-properties-stylesheet.component.d.ts.map +1 -1
  14. package/lib/project-css-themes/project-css-themes-stylesheet.component.d.ts.map +1 -1
  15. package/lib/project-css-variables/project-css-variables-stylesheet.component.d.ts.map +1 -1
  16. package/lib/project-css-widget-chrome/project-css-widget-chrome-stylesheet.component.d.ts.map +1 -1
  17. package/lib/render/breakpoint-variant-render.component.d.ts +4 -0
  18. package/lib/render/breakpoint-variant-render.component.d.ts.map +1 -1
  19. package/lib/render/embed-in-vertical-container.component.d.ts +1 -1
  20. package/lib/render/embed-in-vertical-container.component.d.ts.map +1 -1
  21. package/lib/render/library-stylesheets.component.d.ts.map +1 -1
  22. package/lib/render/scope-id-from-content.d.ts +8 -0
  23. package/lib/render/scope-id-from-content.d.ts.map +1 -0
  24. package/lib/render/style-element.directive.d.ts +24 -0
  25. package/lib/render/style-element.directive.d.ts.map +1 -0
  26. package/package.json +1 -1
package/README.md CHANGED
@@ -65,7 +65,7 @@ const data = await fetchRuleCMSWidget({
65
65
  />
66
66
  ```
67
67
 
68
- No token is needed on the client in `pre-fetched` mode — the widget does not refetch in the browser. Pre-fetched mode uses CSS breakpoint variants so server HTML matches all viewport widths.
68
+ No token is needed on the client in `pre-fetched` mode — the widget does not refetch in the browser. When a widget's content differs by device, the server HTML carries its phone, tablet and desktop versions with a `<style>` of media queries that shows the one matching the viewport, so the first paint is right at every width. The widget's library, project and container CSS are `<style>` elements in the same HTML, and hydration keeps them. Before 0.8.2 none of these `<style>` elements were emitted, so all three versions showed.
69
69
 
70
70
  ## Host `componentProps`
71
71
 
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Injectable, Input, Component, HostBinding, EventEmitter, ErrorHandler, Output, Optional, Inject } from '@angular/core';
2
+ import { Injectable, Input, Component, ViewEncapsulation, inject, ViewContainerRef, Renderer2, Directive, HostBinding, EventEmitter, ErrorHandler, Output, Optional, Inject } from '@angular/core';
3
3
  import { NgComponentOutlet, NgStyle, NgTemplateOutlet } from '@angular/common';
4
4
 
5
5
  /**
@@ -2322,6 +2322,29 @@ ${phone}, ${tablet}, ${desktop} { display: none; }
2322
2322
  `.trim();
2323
2323
  }
2324
2324
 
2325
+ /** cyrb53, a public-domain 53-bit string hash. */
2326
+ const cyrb53 = (value) => {
2327
+ let h1 = 0xdeadbeef;
2328
+ let h2 = 0x41c6ce57;
2329
+ for (let index = 0; index < value.length; index += 1) {
2330
+ const code = value.charCodeAt(index);
2331
+ h1 = Math.imul(h1 ^ code, 2654435761);
2332
+ h2 = Math.imul(h2 ^ code, 1597334677);
2333
+ }
2334
+ h1 = Math.imul(h1 ^ (h1 >>> 16), 2246822507);
2335
+ h1 ^= Math.imul(h2 ^ (h2 >>> 13), 3266489909);
2336
+ h2 = Math.imul(h2 ^ (h2 >>> 16), 2246822507);
2337
+ h2 ^= Math.imul(h1 ^ (h1 >>> 13), 3266489909);
2338
+ return 4294967296 * (2097151 & h2) + (h1 >>> 0);
2339
+ };
2340
+ /**
2341
+ * Class-name-safe scope id computed from what the scope styles, so a server
2342
+ * render, every later render in that process, and the browser hydrating it
2343
+ * all agree without a framework id API. Equal content shares an id, which is
2344
+ * harmless because its scoped rules are equal too.
2345
+ */
2346
+ const scopeIdFromContent = (prefix, content) => `${prefix}-${cyrb53(content).toString(36)}`;
2347
+
2325
2348
  /**
2326
2349
  * Extracts the (already composed) source components plugin from the plugins
2327
2350
  * object the pipeline receives. Throws if it is missing or malformed.
@@ -2352,7 +2375,80 @@ function getComponentsPluginFromPlugins(plugins) {
2352
2375
  return sourceComponentsPlugin;
2353
2376
  }
2354
2377
 
2355
- let verticalContainerSeq = 0;
2378
+ const STYLE_TAG_PATTERN = /(<\/|<)(s)(tyle)/gi;
2379
+ /**
2380
+ * Prepares CSS for the text of a `<style>` element.
2381
+ *
2382
+ * Angular's server renderer writes `<style>` text raw, as browsers expect, so
2383
+ * this is the security boundary: the only way out of a `<style>` element is a
2384
+ * `</style` sequence, and its `s` becomes the CSS escape `\73 ` / `\53 `, as
2385
+ * React 19 and the other RuleCMS SDKs do. The CSS means the same; nothing else
2386
+ * is changed.
2387
+ */
2388
+ function prepareStyleElementCss(css) {
2389
+ return css.replace(STYLE_TAG_PATTERN, (_match, prefix, s, suffix) => `${prefix}${s === 's' ? '\\73 ' : '\\53 '}${suffix}`);
2390
+ }
2391
+
2392
+ /** Created dynamically, so its host element is a `<style>`; it renders nothing itself. */
2393
+ class StyleElementHostComponent {
2394
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: StyleElementHostComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2395
+ static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "19.2.25", type: StyleElementHostComponent, isStandalone: true, selector: "style", ngImport: i0, template: '', isInline: true, encapsulation: i0.ViewEncapsulation.None }); }
2396
+ }
2397
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: StyleElementHostComponent, decorators: [{
2398
+ type: Component,
2399
+ args: [{
2400
+ selector: 'style',
2401
+ standalone: true,
2402
+ template: '',
2403
+ encapsulation: ViewEncapsulation.None,
2404
+ }]
2405
+ }] });
2406
+ /**
2407
+ * Puts a `<style>` holding `rulecmsStyleElement` where this `<ng-container>` is.
2408
+ *
2409
+ * Angular's template compiler removes every `<style>` element from a template,
2410
+ * and a bound one leaves nothing behind. A component created through
2411
+ * `ViewContainerRef` takes its host element from its selector instead, so this
2412
+ * `<style>` never reaches the template compiler, yet it is a node Angular owns:
2413
+ * the server render writes it, hydration adopts the server's element rather
2414
+ * than adding a second one, and destroying the surrounding view removes it.
2415
+ */
2416
+ class StyleElementDirective {
2417
+ constructor() {
2418
+ this.viewContainer = inject(ViewContainerRef);
2419
+ this.renderer = inject(Renderer2);
2420
+ }
2421
+ ngOnChanges() {
2422
+ if (!this.styleRef) {
2423
+ this.styleRef = this.viewContainer.createComponent(StyleElementHostComponent);
2424
+ if (this.rulecmsStyleElementMarker) {
2425
+ this.renderer.setAttribute(this.styleRef.location.nativeElement, this.rulecmsStyleElementMarker, '');
2426
+ }
2427
+ }
2428
+ const style = this.styleRef.location.nativeElement;
2429
+ const css = prepareStyleElementCss(this.rulecmsStyleElement);
2430
+ // Hydration adopts the server's element with its text; writing the same
2431
+ // text again would only make the browser parse the sheet a second time.
2432
+ if (style.textContent !== css) {
2433
+ this.renderer.setProperty(style, 'textContent', css);
2434
+ }
2435
+ }
2436
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: StyleElementDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive }); }
2437
+ static { this.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "19.2.25", type: StyleElementDirective, isStandalone: true, selector: "ng-container[rulecmsStyleElement]", inputs: { rulecmsStyleElement: "rulecmsStyleElement", rulecmsStyleElementMarker: "rulecmsStyleElementMarker" }, usesOnChanges: true, ngImport: i0 }); }
2438
+ }
2439
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: StyleElementDirective, decorators: [{
2440
+ type: Directive,
2441
+ args: [{
2442
+ selector: 'ng-container[rulecmsStyleElement]',
2443
+ standalone: true,
2444
+ }]
2445
+ }], propDecorators: { rulecmsStyleElement: [{
2446
+ type: Input,
2447
+ args: [{ required: true }]
2448
+ }], rulecmsStyleElementMarker: [{
2449
+ type: Input
2450
+ }] } });
2451
+
2356
2452
  class EmbedInVerticalContainerComponent {
2357
2453
  constructor() {
2358
2454
  this.isComposeMode = false;
@@ -2361,7 +2457,7 @@ class EmbedInVerticalContainerComponent {
2361
2457
  this.deviceDisplayType = 'Desktop';
2362
2458
  this.cssString = '';
2363
2459
  this.scopedCss = '';
2364
- this.scopeClass = `rulecms-vc-${++verticalContainerSeq}`;
2460
+ this.scopeClass = '';
2365
2461
  this.wrap = false;
2366
2462
  this.hidden = false;
2367
2463
  this.wrapperClass = '';
@@ -2385,6 +2481,7 @@ class EmbedInVerticalContainerComponent {
2385
2481
  ngOnChanges() {
2386
2482
  const containerCss = this.displayItemList.containerAttributes?.[cssAttrArrayKey] || [];
2387
2483
  this.cssString = containerCss.join(';\n');
2484
+ this.scopeClass = scopeIdFromContent('rulecms-vc', this.cssString);
2388
2485
  this.scopedCss = this.cssString
2389
2486
  ? `.${this.scopeClass} {\n${this.cssString}\n}`
2390
2487
  : '';
@@ -2424,19 +2521,20 @@ class EmbedInVerticalContainerComponent {
2424
2521
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EmbedInVerticalContainerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
2425
2522
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: EmbedInVerticalContainerComponent, isStandalone: true, selector: "rulecms-embed-vertical", inputs: { displayItemList: "displayItemList", isComposeMode: "isComposeMode", showDropContainers: "showDropContainers", isWithinCollection: "isWithinCollection", deviceDisplayType: "deviceDisplayType" }, host: { properties: { "attr.hidden": "this.hiddenAttr", "class": "this.hostClass", "style": "this.hostStyle" } }, usesOnChanges: true, ngImport: i0, template: `
2426
2523
  @if (cssString) {
2427
- <style [innerText]="scopedCss"></style>
2524
+ <ng-container [rulecmsStyleElement]="scopedCss" />
2428
2525
  }
2429
2526
  <ng-content />
2430
- `, isInline: true }); }
2527
+ `, isInline: true, dependencies: [{ kind: "directive", type: StyleElementDirective, selector: "ng-container[rulecmsStyleElement]", inputs: ["rulecmsStyleElement", "rulecmsStyleElementMarker"] }] }); }
2431
2528
  }
2432
2529
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: EmbedInVerticalContainerComponent, decorators: [{
2433
2530
  type: Component,
2434
2531
  args: [{
2435
2532
  selector: 'rulecms-embed-vertical',
2436
2533
  standalone: true,
2534
+ imports: [StyleElementDirective],
2437
2535
  template: `
2438
2536
  @if (cssString) {
2439
- <style [innerText]="scopedCss"></style>
2537
+ <ng-container [rulecmsStyleElement]="scopedCss" />
2440
2538
  }
2441
2539
  <ng-content />
2442
2540
  `,
@@ -3223,18 +3321,25 @@ class LibraryStylesheetsComponent {
3223
3321
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: LibraryStylesheetsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3224
3322
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: LibraryStylesheetsComponent, isStandalone: true, selector: "rulecms-library-stylesheets", inputs: { stylesheets: "stylesheets" }, host: { styleAttribute: "display: contents" }, ngImport: i0, template: `
3225
3323
  @for (css of stylesheets ?? []; track $index) {
3226
- <style data-rulecms-library-stylesheet="" [innerText]="css"></style>
3324
+ <ng-container
3325
+ [rulecmsStyleElement]="css"
3326
+ rulecmsStyleElementMarker="data-rulecms-library-stylesheet"
3327
+ />
3227
3328
  }
3228
- `, isInline: true }); }
3329
+ `, isInline: true, dependencies: [{ kind: "directive", type: StyleElementDirective, selector: "ng-container[rulecmsStyleElement]", inputs: ["rulecmsStyleElement", "rulecmsStyleElementMarker"] }] }); }
3229
3330
  }
3230
3331
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: LibraryStylesheetsComponent, decorators: [{
3231
3332
  type: Component,
3232
3333
  args: [{
3233
3334
  selector: 'rulecms-library-stylesheets',
3234
3335
  standalone: true,
3336
+ imports: [StyleElementDirective],
3235
3337
  template: `
3236
3338
  @for (css of stylesheets ?? []; track $index) {
3237
- <style data-rulecms-library-stylesheet="" [innerText]="css"></style>
3339
+ <ng-container
3340
+ [rulecmsStyleElement]="css"
3341
+ rulecmsStyleElementMarker="data-rulecms-library-stylesheet"
3342
+ />
3238
3343
  }
3239
3344
  `,
3240
3345
  host: { style: 'display: contents' },
@@ -3244,19 +3349,27 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
3244
3349
  }] } });
3245
3350
 
3246
3351
  const DEVICE_VARIANTS = ['Phone', 'Tablet', 'Desktop'];
3247
- let breakpointSeq = 0;
3248
3352
  class BreakpointVariantRenderComponent {
3249
3353
  constructor() {
3250
3354
  this.devices = DEVICE_VARIANTS;
3251
3355
  this.divergent = false;
3252
3356
  this.variantStyles = '';
3253
- this.resolvedScopeId = `rulecms-bp-${++breakpointSeq}`;
3357
+ this.resolvedScopeId = '';
3358
+ this.itemListScopeId = '';
3254
3359
  }
3255
3360
  ngOnChanges() {
3256
- this.resolvedScopeId = this.scopeIdInput ?? this.resolvedScopeId;
3361
+ this.resolvedScopeId = this.scopeIdInput ?? this.scopeIdForItemList();
3257
3362
  this.divergent = hasDeviceDivergentValues(this.displayItemList, this.widgetCollections);
3258
3363
  this.variantStyles = buildBreakpointVariantStyles(this.resolvedScopeId);
3259
3364
  }
3365
+ /** Hashes once per item list: `rulecms-widget` passes a new `plugins` object on every check. */
3366
+ scopeIdForItemList() {
3367
+ if (this.hashedItemList !== this.displayItemList) {
3368
+ this.hashedItemList = this.displayItemList;
3369
+ this.itemListScopeId = scopeIdFromContent('rulecms-bp', JSON.stringify(this.displayItemList));
3370
+ }
3371
+ return this.itemListScopeId;
3372
+ }
3260
3373
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: BreakpointVariantRenderComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3261
3374
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: BreakpointVariantRenderComponent, isStandalone: true, selector: "rulecms-breakpoint-variants", inputs: { displayItemList: "displayItemList", widgetCollections: "widgetCollections", plugins: "plugins", componentProps: "componentProps", mounts: "mounts", placeholderValues: "placeholderValues", scopeIdInput: "scopeIdInput" }, host: { styleAttribute: "display: contents" }, usesOnChanges: true, ngImport: i0, template: `
3262
3375
  <rulecms-library-stylesheets [stylesheets]="plugins.sourceComponents?.stylesheets" />
@@ -3275,7 +3388,7 @@ class BreakpointVariantRenderComponent {
3275
3388
  [placeholderValues]="placeholderValues"
3276
3389
  />
3277
3390
  } @else {
3278
- <style [innerText]="variantStyles"></style>
3391
+ <ng-container [rulecmsStyleElement]="variantStyles" />
3279
3392
  @for (device of devices; track device) {
3280
3393
  <div [class]="resolvedScopeId + '-' + device.toLowerCase()">
3281
3394
  <rulecms-render-for-device
@@ -3294,14 +3407,14 @@ class BreakpointVariantRenderComponent {
3294
3407
  </div>
3295
3408
  }
3296
3409
  }
3297
- `, isInline: true, dependencies: [{ kind: "component", type: RenderComponentsForDeviceComponent, selector: "rulecms-render-for-device", inputs: ["displayItemList", "isComposeMode", "isWithinCollection", "widgetCollections", "showDropContainers", "reduxDeviceDisplayType", "deviceDisplayType", "plugins", "componentProps", "mounts", "placeholderValues", "ancestorColumnIds"] }, { kind: "component", type: LibraryStylesheetsComponent, selector: "rulecms-library-stylesheets", inputs: ["stylesheets"] }] }); }
3410
+ `, isInline: true, dependencies: [{ kind: "component", type: RenderComponentsForDeviceComponent, selector: "rulecms-render-for-device", inputs: ["displayItemList", "isComposeMode", "isWithinCollection", "widgetCollections", "showDropContainers", "reduxDeviceDisplayType", "deviceDisplayType", "plugins", "componentProps", "mounts", "placeholderValues", "ancestorColumnIds"] }, { kind: "component", type: LibraryStylesheetsComponent, selector: "rulecms-library-stylesheets", inputs: ["stylesheets"] }, { kind: "directive", type: StyleElementDirective, selector: "ng-container[rulecmsStyleElement]", inputs: ["rulecmsStyleElement", "rulecmsStyleElementMarker"] }] }); }
3298
3411
  }
3299
3412
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: BreakpointVariantRenderComponent, decorators: [{
3300
3413
  type: Component,
3301
3414
  args: [{
3302
3415
  selector: 'rulecms-breakpoint-variants',
3303
3416
  standalone: true,
3304
- imports: [RenderComponentsForDeviceComponent, LibraryStylesheetsComponent],
3417
+ imports: [RenderComponentsForDeviceComponent, LibraryStylesheetsComponent, StyleElementDirective],
3305
3418
  template: `
3306
3419
  <rulecms-library-stylesheets [stylesheets]="plugins.sourceComponents?.stylesheets" />
3307
3420
  @if (!divergent) {
@@ -3319,7 +3432,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
3319
3432
  [placeholderValues]="placeholderValues"
3320
3433
  />
3321
3434
  } @else {
3322
- <style [innerText]="variantStyles"></style>
3435
+ <ng-container [rulecmsStyleElement]="variantStyles" />
3323
3436
  @for (device of devices; track device) {
3324
3437
  <div [class]="resolvedScopeId + '-' + device.toLowerCase()">
3325
3438
  <rulecms-render-for-device
@@ -3508,8 +3621,26 @@ const wrapProjectCssClassesStylesheetInLayer = (css, classLayer) => {
3508
3621
  * `[data-rulecms-published-key="…"]`. `CSS.escape` is not assumed (SSR / Node).
3509
3622
  */
3510
3623
  const escapeCssAttributeValue$2 = (value) => value.replace(/\\/g, '\\\\').replace(/"/g, '\\"');
3511
- /** Escape a class name for use after `.` (`/` → `\/`). */
3512
- const escapeCssClassName = (name) => name.replace(/[^A-Za-z0-9_-]/g, char => `\\${char}`);
3624
+ /**
3625
+ * Escape a class name for use after `.` in a selector. `/` becomes `\/` so
3626
+ * `ring-parity-accent/30` emits as `.ring-parity-accent\/30`.
3627
+ *
3628
+ * A CSS identifier may not *start* with a digit, or with a hyphen followed by a
3629
+ * digit, so a leading digit needs the numeric escape form instead of a
3630
+ * backslash: `2xl:flex` has to emit `.\32 xl\:flex`, because `.2xl\:flex` is a
3631
+ * parse error and the browser drops the whole rule. Tailwind breakpoint
3632
+ * prefixes (`2xl:`) and grid utilities kept in class names hit this.
3633
+ */
3634
+ const escapeCssClassName = (name) => {
3635
+ const escaped = name.replace(/[^A-Za-z0-9_-]/g, char => `\\${char}`);
3636
+ if (/^[0-9]/.test(escaped)) {
3637
+ return `\\3${escaped[0]} ${escaped.slice(1)}`;
3638
+ }
3639
+ if (/^-[0-9]/.test(escaped)) {
3640
+ return `-\\3${escaped[1]} ${escaped.slice(2)}`;
3641
+ }
3642
+ return escaped;
3643
+ };
3513
3644
  const REJECTED_IN_BODY = ['</', '<script', '@import', 'javascript:', 'vbscript:', 'expression('];
3514
3645
  // eslint-disable-next-line no-control-regex -- control characters are what this matches
3515
3646
  const REJECTED_CONTROL_CHARACTERS$2 = /[\u0000-\u0008\u000b\u000c\u000e-\u001f\u007f]/;
@@ -3573,6 +3704,9 @@ const indentDeclarationBody$1 = (body) => body
3573
3704
  /**
3574
3705
  * Descendant class rules under this widget’s published-key span.
3575
3706
  * Empty / flag-off / unsanitary catalogs return null so the caller omits `<style>`.
3707
+ *
3708
+ * Rules are emitted in catalog order. Two utilities that set the same property
3709
+ * are resolved by source order, so re-sorting here would change which one wins.
3576
3710
  */
3577
3711
  const formatProjectCssClassesStylesheet = (publishedKey, classes, includeClassDefinitions, classLayer) => {
3578
3712
  if (!shouldIncludeClassDefinitionsOnPublishedWidget(includeClassDefinitions)) {
@@ -3585,7 +3719,6 @@ const formatProjectCssClassesStylesheet = (publishedKey, classes, includeClassDe
3585
3719
  }
3586
3720
  const ancestor = `[data-rulecms-published-key="${escapeCssAttributeValue$2(publishedKey)}"]`;
3587
3721
  const css = names
3588
- .sort((left, right) => left.localeCompare(right))
3589
3722
  .map(name => `${ancestor} .${escapeCssClassName(name)} {\n${indentDeclarationBody$1(sanitized[name])}\n}`)
3590
3723
  .join('\n');
3591
3724
  return wrapProjectCssClassesStylesheetInLayer(css, classLayer);
@@ -3603,18 +3736,25 @@ class ProjectCssClassesStylesheetComponent {
3603
3736
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: ProjectCssClassesStylesheetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
3604
3737
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: ProjectCssClassesStylesheetComponent, isStandalone: true, selector: "rulecms-project-css-classes-stylesheet", inputs: { publishedKey: "publishedKey", classes: "classes", classLayer: "classLayer" }, ngImport: i0, template: `
3605
3738
  @if (css) {
3606
- <style data-rulecms-project-class-definitions="" [innerText]="css"></style>
3739
+ <ng-container
3740
+ [rulecmsStyleElement]="css"
3741
+ rulecmsStyleElementMarker="data-rulecms-project-class-definitions"
3742
+ />
3607
3743
  }
3608
- `, isInline: true }); }
3744
+ `, isInline: true, dependencies: [{ kind: "directive", type: StyleElementDirective, selector: "ng-container[rulecmsStyleElement]", inputs: ["rulecmsStyleElement", "rulecmsStyleElementMarker"] }] }); }
3609
3745
  }
3610
3746
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: ProjectCssClassesStylesheetComponent, decorators: [{
3611
3747
  type: Component,
3612
3748
  args: [{
3613
3749
  selector: 'rulecms-project-css-classes-stylesheet',
3614
3750
  standalone: true,
3751
+ imports: [StyleElementDirective],
3615
3752
  template: `
3616
3753
  @if (css) {
3617
- <style data-rulecms-project-class-definitions="" [innerText]="css"></style>
3754
+ <ng-container
3755
+ [rulecmsStyleElement]="css"
3756
+ rulecmsStyleElementMarker="data-rulecms-project-class-definitions"
3757
+ />
3618
3758
  }
3619
3759
  `,
3620
3760
  }]
@@ -3883,21 +4023,22 @@ class ProjectCssFontsStylesheetComponent {
3883
4023
  <link rel="stylesheet" [attr.href]="href" data-rulecms-project-fonts="" />
3884
4024
  }
3885
4025
  @if (css) {
3886
- <style data-rulecms-project-fonts="" [innerText]="css"></style>
4026
+ <ng-container [rulecmsStyleElement]="css" rulecmsStyleElementMarker="data-rulecms-project-fonts" />
3887
4027
  }
3888
- `, isInline: true }); }
4028
+ `, isInline: true, dependencies: [{ kind: "directive", type: StyleElementDirective, selector: "ng-container[rulecmsStyleElement]", inputs: ["rulecmsStyleElement", "rulecmsStyleElementMarker"] }] }); }
3889
4029
  }
3890
4030
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: ProjectCssFontsStylesheetComponent, decorators: [{
3891
4031
  type: Component,
3892
4032
  args: [{
3893
4033
  selector: 'rulecms-project-css-fonts-stylesheet',
3894
4034
  standalone: true,
4035
+ imports: [StyleElementDirective],
3895
4036
  template: `
3896
4037
  @if (href) {
3897
4038
  <link rel="stylesheet" [attr.href]="href" data-rulecms-project-fonts="" />
3898
4039
  }
3899
4040
  @if (css) {
3900
- <style data-rulecms-project-fonts="" [innerText]="css"></style>
4041
+ <ng-container [rulecmsStyleElement]="css" rulecmsStyleElementMarker="data-rulecms-project-fonts" />
3901
4042
  }
3902
4043
  `,
3903
4044
  }]
@@ -4086,18 +4227,19 @@ class ProjectCssKeyframesStylesheetComponent {
4086
4227
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: ProjectCssKeyframesStylesheetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4087
4228
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: ProjectCssKeyframesStylesheetComponent, isStandalone: true, selector: "rulecms-project-css-keyframes-stylesheet", inputs: { publishedKey: "publishedKey", keyframes: "keyframes" }, ngImport: i0, template: `
4088
4229
  @if (css) {
4089
- <style data-rulecms-project-keyframes="" [innerText]="css"></style>
4230
+ <ng-container [rulecmsStyleElement]="css" rulecmsStyleElementMarker="data-rulecms-project-keyframes" />
4090
4231
  }
4091
- `, isInline: true }); }
4232
+ `, isInline: true, dependencies: [{ kind: "directive", type: StyleElementDirective, selector: "ng-container[rulecmsStyleElement]", inputs: ["rulecmsStyleElement", "rulecmsStyleElementMarker"] }] }); }
4092
4233
  }
4093
4234
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: ProjectCssKeyframesStylesheetComponent, decorators: [{
4094
4235
  type: Component,
4095
4236
  args: [{
4096
4237
  selector: 'rulecms-project-css-keyframes-stylesheet',
4097
4238
  standalone: true,
4239
+ imports: [StyleElementDirective],
4098
4240
  template: `
4099
4241
  @if (css) {
4100
- <style data-rulecms-project-keyframes="" [innerText]="css"></style>
4242
+ <ng-container [rulecmsStyleElement]="css" rulecmsStyleElementMarker="data-rulecms-project-keyframes" />
4101
4243
  }
4102
4244
  `,
4103
4245
  }]
@@ -4210,18 +4352,25 @@ class ProjectCssPositionTryStylesheetComponent {
4210
4352
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: ProjectCssPositionTryStylesheetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4211
4353
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: ProjectCssPositionTryStylesheetComponent, isStandalone: true, selector: "rulecms-project-css-position-try-stylesheet", inputs: { publishedKey: "publishedKey", positionTry: "positionTry" }, ngImport: i0, template: `
4212
4354
  @if (css) {
4213
- <style data-rulecms-project-position-try="" [innerText]="css"></style>
4355
+ <ng-container
4356
+ [rulecmsStyleElement]="css"
4357
+ rulecmsStyleElementMarker="data-rulecms-project-position-try"
4358
+ />
4214
4359
  }
4215
- `, isInline: true }); }
4360
+ `, isInline: true, dependencies: [{ kind: "directive", type: StyleElementDirective, selector: "ng-container[rulecmsStyleElement]", inputs: ["rulecmsStyleElement", "rulecmsStyleElementMarker"] }] }); }
4216
4361
  }
4217
4362
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: ProjectCssPositionTryStylesheetComponent, decorators: [{
4218
4363
  type: Component,
4219
4364
  args: [{
4220
4365
  selector: 'rulecms-project-css-position-try-stylesheet',
4221
4366
  standalone: true,
4367
+ imports: [StyleElementDirective],
4222
4368
  template: `
4223
4369
  @if (css) {
4224
- <style data-rulecms-project-position-try="" [innerText]="css"></style>
4370
+ <ng-container
4371
+ [rulecmsStyleElement]="css"
4372
+ rulecmsStyleElementMarker="data-rulecms-project-position-try"
4373
+ />
4225
4374
  }
4226
4375
  `,
4227
4376
  }]
@@ -4255,7 +4404,9 @@ const PROJECT_CSS_PROPERTY_SYNTAX_VALUES = [
4255
4404
  ];
4256
4405
  const PROPERTY_SYNTAX_SET = new Set(PROJECT_CSS_PROPERTY_SYNTAX_VALUES);
4257
4406
  const REJECTED_IN_EMITTED_VALUE$2 = /[{};]/;
4258
- const MAX_PROJECT_CSS_PROPERTIES = 40;
4407
+ // RuleCMS's cap. Below it, the published widget silently drops registrations
4408
+ // the composer renders.
4409
+ const MAX_PROJECT_CSS_PROPERTIES = 200;
4259
4410
  const PROPERTY_INITIAL_VALUE_MAX_LENGTH = 200;
4260
4411
  const isAllowlistedSyntax = (value) => typeof value === 'string' && PROPERTY_SYNTAX_SET.has(value);
4261
4412
  const isSafeInitialValue = (value, syntax) => {
@@ -4346,18 +4497,25 @@ class ProjectCssPropertiesStylesheetComponent {
4346
4497
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: ProjectCssPropertiesStylesheetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4347
4498
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: ProjectCssPropertiesStylesheetComponent, isStandalone: true, selector: "rulecms-project-css-properties-stylesheet", inputs: { publishedKey: "publishedKey", cssProperties: "cssProperties" }, ngImport: i0, template: `
4348
4499
  @if (css) {
4349
- <style data-rulecms-project-css-properties="" [innerText]="css"></style>
4500
+ <ng-container
4501
+ [rulecmsStyleElement]="css"
4502
+ rulecmsStyleElementMarker="data-rulecms-project-css-properties"
4503
+ />
4350
4504
  }
4351
- `, isInline: true }); }
4505
+ `, isInline: true, dependencies: [{ kind: "directive", type: StyleElementDirective, selector: "ng-container[rulecmsStyleElement]", inputs: ["rulecmsStyleElement", "rulecmsStyleElementMarker"] }] }); }
4352
4506
  }
4353
4507
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: ProjectCssPropertiesStylesheetComponent, decorators: [{
4354
4508
  type: Component,
4355
4509
  args: [{
4356
4510
  selector: 'rulecms-project-css-properties-stylesheet',
4357
4511
  standalone: true,
4512
+ imports: [StyleElementDirective],
4358
4513
  template: `
4359
4514
  @if (css) {
4360
- <style data-rulecms-project-css-properties="" [innerText]="css"></style>
4515
+ <ng-container
4516
+ [rulecmsStyleElement]="css"
4517
+ rulecmsStyleElementMarker="data-rulecms-project-css-properties"
4518
+ />
4361
4519
  }
4362
4520
  `,
4363
4521
  }]
@@ -4540,18 +4698,19 @@ class ProjectCssThemesStylesheetComponent {
4540
4698
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: ProjectCssThemesStylesheetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4541
4699
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: ProjectCssThemesStylesheetComponent, isStandalone: true, selector: "rulecms-project-css-themes-stylesheet", inputs: { publishedKey: "publishedKey", themes: "themes" }, ngImport: i0, template: `
4542
4700
  @if (css) {
4543
- <style data-rulecms-project-themes="" [innerText]="css"></style>
4701
+ <ng-container [rulecmsStyleElement]="css" rulecmsStyleElementMarker="data-rulecms-project-themes" />
4544
4702
  }
4545
- `, isInline: true }); }
4703
+ `, isInline: true, dependencies: [{ kind: "directive", type: StyleElementDirective, selector: "ng-container[rulecmsStyleElement]", inputs: ["rulecmsStyleElement", "rulecmsStyleElementMarker"] }] }); }
4546
4704
  }
4547
4705
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: ProjectCssThemesStylesheetComponent, decorators: [{
4548
4706
  type: Component,
4549
4707
  args: [{
4550
4708
  selector: 'rulecms-project-css-themes-stylesheet',
4551
4709
  standalone: true,
4710
+ imports: [StyleElementDirective],
4552
4711
  template: `
4553
4712
  @if (css) {
4554
- <style data-rulecms-project-themes="" [innerText]="css"></style>
4713
+ <ng-container [rulecmsStyleElement]="css" rulecmsStyleElementMarker="data-rulecms-project-themes" />
4555
4714
  }
4556
4715
  `,
4557
4716
  }]
@@ -4573,18 +4732,25 @@ class ProjectCssVariablesStylesheetComponent {
4573
4732
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: ProjectCssVariablesStylesheetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4574
4733
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: ProjectCssVariablesStylesheetComponent, isStandalone: true, selector: "rulecms-project-css-variables-stylesheet", inputs: { publishedKey: "publishedKey", variables: "variables" }, ngImport: i0, template: `
4575
4734
  @if (css) {
4576
- <style data-rulecms-project-css-variables="" [innerText]="css"></style>
4735
+ <ng-container
4736
+ [rulecmsStyleElement]="css"
4737
+ rulecmsStyleElementMarker="data-rulecms-project-css-variables"
4738
+ />
4577
4739
  }
4578
- `, isInline: true }); }
4740
+ `, isInline: true, dependencies: [{ kind: "directive", type: StyleElementDirective, selector: "ng-container[rulecmsStyleElement]", inputs: ["rulecmsStyleElement", "rulecmsStyleElementMarker"] }] }); }
4579
4741
  }
4580
4742
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: ProjectCssVariablesStylesheetComponent, decorators: [{
4581
4743
  type: Component,
4582
4744
  args: [{
4583
4745
  selector: 'rulecms-project-css-variables-stylesheet',
4584
4746
  standalone: true,
4747
+ imports: [StyleElementDirective],
4585
4748
  template: `
4586
4749
  @if (css) {
4587
- <style data-rulecms-project-css-variables="" [innerText]="css"></style>
4750
+ <ng-container
4751
+ [rulecmsStyleElement]="css"
4752
+ rulecmsStyleElementMarker="data-rulecms-project-css-variables"
4753
+ />
4588
4754
  }
4589
4755
  `,
4590
4756
  }]
@@ -4695,18 +4861,25 @@ class ProjectCssWidgetChromeStylesheetComponent {
4695
4861
  static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: ProjectCssWidgetChromeStylesheetComponent, deps: [], target: i0.ɵɵFactoryTarget.Component }); }
4696
4862
  static { this.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: ProjectCssWidgetChromeStylesheetComponent, isStandalone: true, selector: "rulecms-project-css-widget-chrome-stylesheet", inputs: { publishedKey: "publishedKey", widgetChrome: "widgetChrome" }, ngImport: i0, template: `
4697
4863
  @if (css) {
4698
- <style data-rulecms-project-widget-chrome="" [innerText]="css"></style>
4864
+ <ng-container
4865
+ [rulecmsStyleElement]="css"
4866
+ rulecmsStyleElementMarker="data-rulecms-project-widget-chrome"
4867
+ />
4699
4868
  }
4700
- `, isInline: true }); }
4869
+ `, isInline: true, dependencies: [{ kind: "directive", type: StyleElementDirective, selector: "ng-container[rulecmsStyleElement]", inputs: ["rulecmsStyleElement", "rulecmsStyleElementMarker"] }] }); }
4701
4870
  }
4702
4871
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: ProjectCssWidgetChromeStylesheetComponent, decorators: [{
4703
4872
  type: Component,
4704
4873
  args: [{
4705
4874
  selector: 'rulecms-project-css-widget-chrome-stylesheet',
4706
4875
  standalone: true,
4876
+ imports: [StyleElementDirective],
4707
4877
  template: `
4708
4878
  @if (css) {
4709
- <style data-rulecms-project-widget-chrome="" [innerText]="css"></style>
4879
+ <ng-container
4880
+ [rulecmsStyleElement]="css"
4881
+ rulecmsStyleElementMarker="data-rulecms-project-widget-chrome"
4882
+ />
4710
4883
  }
4711
4884
  `,
4712
4885
  }]