@rindo/core 4.20.0 → 4.22.0

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 (40) hide show
  1. package/cli/index.cjs +1 -1
  2. package/cli/index.js +1 -1
  3. package/cli/package.json +1 -1
  4. package/compiler/lib.es2023.array.d.ts +5 -5
  5. package/compiler/package.json +1 -1
  6. package/compiler/rindo.js +3534 -273
  7. package/dev-server/client/index.js +1 -1
  8. package/dev-server/client/package.json +1 -1
  9. package/dev-server/connector.html +2 -2
  10. package/dev-server/index.js +1 -1
  11. package/dev-server/package.json +1 -1
  12. package/dev-server/server-process.js +2 -2
  13. package/internal/app-data/index.cjs +1 -1
  14. package/internal/app-data/index.js +1 -1
  15. package/internal/app-data/package.json +1 -1
  16. package/internal/client/index.js +25 -13
  17. package/internal/client/package.json +1 -1
  18. package/internal/client/patch-browser.js +1 -1
  19. package/internal/hydrate/index.js +27 -19
  20. package/internal/hydrate/package.json +1 -1
  21. package/internal/hydrate/runner.d.ts +10 -4
  22. package/internal/hydrate/runner.js +389 -239
  23. package/internal/package.json +1 -1
  24. package/internal/rindo-public-compiler.d.ts +43 -4
  25. package/internal/rindo-public-runtime.d.ts +4 -0
  26. package/internal/testing/index.js +24 -12
  27. package/internal/testing/package.json +1 -1
  28. package/mock-doc/index.cjs +32 -1
  29. package/mock-doc/index.d.ts +8 -0
  30. package/mock-doc/index.js +32 -1
  31. package/mock-doc/package.json +1 -1
  32. package/package.json +9 -7
  33. package/screenshot/index.js +1 -1
  34. package/screenshot/package.json +1 -1
  35. package/screenshot/pixel-match.js +1 -1
  36. package/sys/node/index.js +47 -45
  37. package/sys/node/package.json +1 -1
  38. package/sys/node/worker.js +2 -2
  39. package/testing/index.js +39 -1
  40. package/testing/package.json +1 -1
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rindo/core/internal",
3
- "version": "4.20.0",
3
+ "version": "4.22.0",
4
4
  "description": "Rindo internals only to be imported by the Rindo Compiler. Breaking changes can and will happen at any time.",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -2,6 +2,7 @@ import type { ConfigFlags } from '../cli/config-flags';
2
2
  import type { PrerenderUrlResults, PrintLine } from '../internal';
3
3
  import type { BuildCtx, CompilerCtx } from './rindo-private';
4
4
  import type { JsonDocs } from './rindo-public-docs';
5
+ import type { ResolutionHandler } from './rindo-public-runtime';
5
6
  export * from './rindo-public-docs';
6
7
  /**
7
8
  * https://rindojs.web.app/docs/config/
@@ -246,6 +247,7 @@ export interface RindoConfig {
246
247
  env?: {
247
248
  [prop: string]: string | undefined;
248
249
  };
250
+ docs?: RindoDocsConfig;
249
251
  globalScript?: string;
250
252
  srcIndexHtml?: string;
251
253
  watch?: boolean;
@@ -847,10 +849,10 @@ export interface SerializeDocumentOptions extends HydrateDocumentOptions {
847
849
  */
848
850
  removeHtmlComments?: boolean;
849
851
  /**
850
- * If set to `false` Rindo will ignore the fact that a component has a `shadow: true`
851
- * flag and serializes it as a scoped component. If set to `true` the component will
852
- * be rendered within a Declarative Shadow DOM.
853
- * @default false
852
+ * If set to `true` the component will be rendered within a Declarative Shadow DOM.
853
+ * If set to `false` Rindo will ignore the contents of the shadow root and render the
854
+ * element as given in provided template.
855
+ * @default true
854
856
  */
855
857
  serializeShadowRoot?: boolean;
856
858
  /**
@@ -859,6 +861,11 @@ export interface SerializeDocumentOptions extends HydrateDocumentOptions {
859
861
  * @default true
860
862
  */
861
863
  fullDocument?: boolean;
864
+ /**
865
+ * Style modes to render the component in.
866
+ * @see https://rindojs.web.app/docs/styling#style-modes
867
+ */
868
+ modes?: ResolutionHandler[];
862
869
  }
863
870
  export interface HydrateFactoryOptions extends SerializeDocumentOptions {
864
871
  serializeToHtml: boolean;
@@ -1504,6 +1511,11 @@ export interface CopyTask {
1504
1511
  * the output target for which this copy operation is configured.
1505
1512
  */
1506
1513
  dest?: string;
1514
+ /**
1515
+ * An optional array of glob patterns to exclude from the copy operation.
1516
+ * @default ['**\/__mocks__/**', '**\/__fixtures__/**', '**\/dist/**', '**\/.{idea,git,cache,output,temp}/**', '**\/.ds_store', '**\/.gitignore', '**\/desktop.ini', '**\/thumbs.db']
1517
+ */
1518
+ ignore?: string[];
1507
1519
  /**
1508
1520
  * Whether or not Rindo should issue warnings if it cannot find the
1509
1521
  * specified source files or directories. Defaults to `false`.
@@ -1553,6 +1565,33 @@ export interface CopyTask {
1553
1565
  */
1554
1566
  keepDirStructure?: boolean;
1555
1567
  }
1568
+ /**
1569
+ * Configuration for generating documentation from Rindo components.
1570
+ */
1571
+ export interface RindoDocsConfig {
1572
+ /**
1573
+ * Options for processing and rendering Markdown documentation files.
1574
+ */
1575
+ markdown?: {
1576
+ /**
1577
+ * Styling for how the target component will be represented within documentation (e.g., in component diagrams).
1578
+ */
1579
+ targetComponent?: {
1580
+ /**
1581
+ * Background color used for nodes representing the component in diagrams (e.g., Mermaid graphs).
1582
+ * Use standard color names or hex codes.
1583
+ * @example '#f0f0f0' (light gray)
1584
+ */
1585
+ background?: string;
1586
+ /**
1587
+ * Text color used within nodes representing the component in diagrams (e.g., Mermaid graphs).
1588
+ * Use standard color names or hex codes.
1589
+ * @example '#333' (dark gray)
1590
+ */
1591
+ textColor?: string;
1592
+ };
1593
+ };
1594
+ }
1556
1595
  export interface BundlingConfig {
1557
1596
  /**
1558
1597
  * @deprecated the `namedExports` field is no longer honored by `@rollup/plugin-commonjs` and is not used by Rindo.
@@ -1564,6 +1564,10 @@ export declare namespace JSXBase {
1564
1564
  onSubmitCapture?: (event: Event) => void;
1565
1565
  onInvalid?: (event: Event) => void;
1566
1566
  onInvalidCapture?: (event: Event) => void;
1567
+ onBeforeToggle?: (event: Event) => void;
1568
+ onBeforeToggleCapture?: (event: Event) => void;
1569
+ onToggle?: (event: Event) => void;
1570
+ onToggleCapture?: (event: Event) => void;
1567
1571
  onLoad?: (event: Event) => void;
1568
1572
  onLoadCapture?: (event: Event) => void;
1569
1573
  onError?: (event: Event) => void;
@@ -1014,17 +1014,19 @@ var addStyle = (styleContainerNode, cmpMeta, mode) => {
1014
1014
  if ((import_app_data7.BUILD.hydrateServerSide || import_app_data7.BUILD.hotModuleReplacement) && cmpMeta.$flags$ & 2 /* scopedCssEncapsulation */) {
1015
1015
  styleElm.setAttribute(HYDRATED_STYLE_ID, scopeId2);
1016
1016
  }
1017
- const injectStyle = (
1018
- /**
1019
- * we render a scoped component
1020
- */
1021
- !(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */) || /**
1022
- * we are using shadow dom and render the style tag within the shadowRoot
1023
- */
1024
- cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD"
1025
- );
1026
- if (injectStyle) {
1027
- styleContainerNode.insertBefore(styleElm, styleContainerNode.querySelector("link"));
1017
+ if (!(cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */)) {
1018
+ if (styleContainerNode.nodeName === "HEAD") {
1019
+ const preconnectLinks = styleContainerNode.querySelectorAll("link[rel=preconnect]");
1020
+ const referenceNode2 = preconnectLinks.length > 0 ? preconnectLinks[preconnectLinks.length - 1].nextSibling : styleContainerNode.querySelector("style");
1021
+ styleContainerNode.insertBefore(styleElm, referenceNode2);
1022
+ } else if ("host" in styleContainerNode) {
1023
+ styleContainerNode.prepend(styleElm, null);
1024
+ } else {
1025
+ styleContainerNode.append(styleElm);
1026
+ }
1027
+ }
1028
+ if (cmpMeta.$flags$ & 1 /* shadowDomEncapsulation */ && styleContainerNode.nodeName !== "HEAD") {
1029
+ styleContainerNode.insertBefore(styleElm, null);
1028
1030
  }
1029
1031
  }
1030
1032
  if (cmpMeta.$flags$ & 4 /* hasSlotRelocation */) {
@@ -1132,7 +1134,11 @@ var setAccessor = (elm, memberName, oldValue, newValue, isSvg, flags) => {
1132
1134
  if (memberName === "list") {
1133
1135
  isProp = false;
1134
1136
  } else if (oldValue == null || elm[memberName] != n) {
1135
- elm[memberName] = n;
1137
+ if (typeof elm.__lookupSetter__(memberName) === "function") {
1138
+ elm[memberName] = n;
1139
+ } else {
1140
+ elm.setAttribute(memberName, n);
1141
+ }
1136
1142
  }
1137
1143
  } else {
1138
1144
  elm[memberName] = newValue;
@@ -2508,6 +2514,11 @@ var patchSlotAppendChild = (HostElementPrototype) => {
2508
2514
  const slotName = newChild["s-sn"] = getSlotName(newChild);
2509
2515
  const slotNode = getHostSlotNode(this.childNodes, slotName, this.tagName);
2510
2516
  if (slotNode) {
2517
+ const slotPlaceholder = document.createTextNode("");
2518
+ slotPlaceholder["s-nr"] = newChild;
2519
+ slotNode["s-cr"].parentNode.__appendChild(slotPlaceholder);
2520
+ newChild["s-ol"] = slotPlaceholder;
2521
+ newChild["s-sh"] = slotNode["s-hn"];
2511
2522
  const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
2512
2523
  const appendAfter = slotChildNodes[slotChildNodes.length - 1];
2513
2524
  const insertedNode = insertBefore(appendAfter.parentNode, newChild, appendAfter.nextSibling);
@@ -2549,6 +2560,7 @@ var patchSlotPrepend = (HostElementPrototype) => {
2549
2560
  slotPlaceholder["s-nr"] = newChild;
2550
2561
  slotNode["s-cr"].parentNode.__appendChild(slotPlaceholder);
2551
2562
  newChild["s-ol"] = slotPlaceholder;
2563
+ newChild["s-sh"] = slotNode["s-hn"];
2552
2564
  const slotChildNodes = getHostSlotChildNodes(slotNode, slotName);
2553
2565
  const appendAfter = slotChildNodes[0];
2554
2566
  return insertBefore(appendAfter.parentNode, newChild, appendAfter.nextSibling);
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rindo/core/internal/testing",
3
- "version": "4.20.0",
3
+ "version": "4.22.0",
4
4
  "description": "Rindo internal testing platform to be imported by the Rindo Compiler. Breaking changes can and will happen at any time.",
5
5
  "main": "./index.js",
6
6
  "private": true
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Rindo Mock Doc (CommonJS) v4.20.0 | MIT Licensed | https://rindojs.web.app
2
+ Rindo Mock Doc (CommonJS) v4.22.0 | MIT Licensed | https://rindojs.web.app
3
3
  */
4
4
  "use strict";
5
5
  var __defProp = Object.defineProperty;
@@ -60,6 +60,7 @@ var CONTENT_REF_ID = "r";
60
60
  var ORG_LOCATION_ID = "o";
61
61
  var SLOT_NODE_ID = "s";
62
62
  var TEXT_NODE_ID = "t";
63
+ var HYDRATE_ID = "s-id";
63
64
  var XLINK_NS = "http://www.w3.org/1999/xlink";
64
65
 
65
66
  // src/mock-doc/attribute.ts
@@ -6438,6 +6439,13 @@ style="${cssText}">`;
6438
6439
  output.indent = output.indent + ((_h = opts.indentSpaces) != null ? _h : 0);
6439
6440
  }
6440
6441
  for (let i = 0; i < childNodeLength; i++) {
6442
+ const sId = node.attributes.getNamedItem(HYDRATE_ID);
6443
+ const isRindoDeclarativeShadowDOM = childNodes[i].nodeName.toLowerCase() === "template" && sId;
6444
+ if (isRindoDeclarativeShadowDOM) {
6445
+ yield `
6446
+ ${" ".repeat(output.indent)}<!--r.${sId.value}-->`;
6447
+ continue;
6448
+ }
6441
6449
  yield* streamToHtml(childNodes[i], opts, output);
6442
6450
  }
6443
6451
  if (ignoreTag === false) {
@@ -7853,6 +7861,11 @@ patchPropAttributes(
7853
7861
  type: "submit"
7854
7862
  }
7855
7863
  );
7864
+ Object.defineProperty(MockButtonElement.prototype, "form", {
7865
+ get() {
7866
+ return this.hasAttribute("form") ? this.getAttribute("form") : null;
7867
+ }
7868
+ });
7856
7869
  var MockImageElement = class extends MockHTMLElement {
7857
7870
  constructor(ownerDocument) {
7858
7871
  super(ownerDocument, "img");
@@ -8921,6 +8934,21 @@ function resetPerformance(perf) {
8921
8934
  }
8922
8935
  }
8923
8936
 
8937
+ // src/mock-doc/resize-observer.ts
8938
+ var MockResizeObserver = class {
8939
+ constructor() {
8940
+ }
8941
+ disconnect() {
8942
+ }
8943
+ observe() {
8944
+ }
8945
+ takeRecords() {
8946
+ return [];
8947
+ }
8948
+ unobserve() {
8949
+ }
8950
+ };
8951
+
8924
8952
  // src/mock-doc/storage.ts
8925
8953
  var MockStorage = class {
8926
8954
  constructor() {
@@ -9160,6 +9188,9 @@ var MockWindow = class {
9160
9188
  get IntersectionObserver() {
9161
9189
  return MockIntersectionObserver;
9162
9190
  }
9191
+ get ResizeObserver() {
9192
+ return MockResizeObserver;
9193
+ }
9163
9194
  get localStorage() {
9164
9195
  if (this.__localStorage == null) {
9165
9196
  this.__localStorage = new MockStorage();
@@ -825,6 +825,13 @@ declare class MockResponse {
825
825
  text(): Promise<string>;
826
826
  clone(): MockResponse;
827
827
  }
828
+ declare class MockResizeObserver {
829
+ constructor();
830
+ disconnect(): void;
831
+ observe(): void;
832
+ takeRecords(): any[];
833
+ unobserve(): void;
834
+ }
828
835
  /**
829
836
  * Check whether an element of interest matches a given selector.
830
837
  *
@@ -963,6 +970,7 @@ declare class MockWindow {
963
970
  get HTMLElement(): any;
964
971
  set HTMLElement(htmlElementCstr: any);
965
972
  get IntersectionObserver(): typeof MockIntersectionObserver;
973
+ get ResizeObserver(): typeof MockResizeObserver;
966
974
  get localStorage(): MockStorage;
967
975
  set localStorage(locStorage: MockStorage);
968
976
  get location(): MockLocation;
package/mock-doc/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- Rindo Mock Doc v4.20.0 | MIT Licensed | https://rindojs.web.app
2
+ Rindo Mock Doc v4.22.0 | MIT Licensed | https://rindojs.web.app
3
3
  */
4
4
 
5
5
  // src/runtime/runtime-constants.ts
@@ -7,6 +7,7 @@ var CONTENT_REF_ID = "r";
7
7
  var ORG_LOCATION_ID = "o";
8
8
  var SLOT_NODE_ID = "s";
9
9
  var TEXT_NODE_ID = "t";
10
+ var HYDRATE_ID = "s-id";
10
11
  var XLINK_NS = "http://www.w3.org/1999/xlink";
11
12
 
12
13
  // src/mock-doc/attribute.ts
@@ -6385,6 +6386,13 @@ style="${cssText}">`;
6385
6386
  output.indent = output.indent + ((_h = opts.indentSpaces) != null ? _h : 0);
6386
6387
  }
6387
6388
  for (let i = 0; i < childNodeLength; i++) {
6389
+ const sId = node.attributes.getNamedItem(HYDRATE_ID);
6390
+ const isRindoDeclarativeShadowDOM = childNodes[i].nodeName.toLowerCase() === "template" && sId;
6391
+ if (isRindoDeclarativeShadowDOM) {
6392
+ yield `
6393
+ ${" ".repeat(output.indent)}<!--r.${sId.value}-->`;
6394
+ continue;
6395
+ }
6388
6396
  yield* streamToHtml(childNodes[i], opts, output);
6389
6397
  }
6390
6398
  if (ignoreTag === false) {
@@ -7800,6 +7808,11 @@ patchPropAttributes(
7800
7808
  type: "submit"
7801
7809
  }
7802
7810
  );
7811
+ Object.defineProperty(MockButtonElement.prototype, "form", {
7812
+ get() {
7813
+ return this.hasAttribute("form") ? this.getAttribute("form") : null;
7814
+ }
7815
+ });
7803
7816
  var MockImageElement = class extends MockHTMLElement {
7804
7817
  constructor(ownerDocument) {
7805
7818
  super(ownerDocument, "img");
@@ -8868,6 +8881,21 @@ function resetPerformance(perf) {
8868
8881
  }
8869
8882
  }
8870
8883
 
8884
+ // src/mock-doc/resize-observer.ts
8885
+ var MockResizeObserver = class {
8886
+ constructor() {
8887
+ }
8888
+ disconnect() {
8889
+ }
8890
+ observe() {
8891
+ }
8892
+ takeRecords() {
8893
+ return [];
8894
+ }
8895
+ unobserve() {
8896
+ }
8897
+ };
8898
+
8871
8899
  // src/mock-doc/storage.ts
8872
8900
  var MockStorage = class {
8873
8901
  constructor() {
@@ -9107,6 +9135,9 @@ var MockWindow = class {
9107
9135
  get IntersectionObserver() {
9108
9136
  return MockIntersectionObserver;
9109
9137
  }
9138
+ get ResizeObserver() {
9139
+ return MockResizeObserver;
9140
+ }
9110
9141
  get localStorage() {
9111
9142
  if (this.__localStorage == null) {
9112
9143
  this.__localStorage = new MockStorage();
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rindo/core/mock-doc",
3
- "version": "4.20.0",
3
+ "version": "4.22.0",
4
4
  "description": "Mock window, document and DOM outside of a browser environment.",
5
5
  "main": "./index.cjs",
6
6
  "module": "./index.js",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rindo/core",
3
- "version": "4.20.0",
3
+ "version": "4.22.0",
4
4
  "license": "MIT",
5
5
  "main": "./internal/rindo-core/index.cjs",
6
6
  "module": "./internal/rindo-core/index.js",
@@ -96,11 +96,11 @@
96
96
  "build": "npm run clean && npm run tsc.prod && npm run ts scripts/index.ts -- --prod --ci",
97
97
  "build.watch": "npm run build -- --watch",
98
98
  "build.updateSelectorEngine": "npm run ts scripts/updateSelectorEngine.ts",
99
- "clean": "rm -rf build/ cli/ compiler/ dev-server/ internal/ mock-doc/ sys/ testing/ && npm run clean:scripts && npm run clean.screenshots",
100
- "clean.screenshots": "rm -rf test/end-to-end/screenshot/builds test/end-to-end/screenshot/images",
101
- "clean:scripts": "rm -rf scripts/build",
99
+ "clean": "rimraf build/ cli/ compiler/ dev-server/ internal/ mock-doc/ sys/ testing/ && npm run clean:scripts && npm run clean.screenshots",
100
+ "clean.screenshots": "rimraf test/end-to-end/screenshot/builds test/end-to-end/screenshot/images",
101
+ "clean:scripts": "rimraf scripts/build",
102
102
  "lint": "eslint 'bin/*' 'scripts/*.ts' 'scripts/**/*.ts' 'src/*.ts' 'src/**/*.ts' 'src/**/*.tsx'",
103
- "install.jest": "bash ./src/testing/jest/install-dependencies.sh",
103
+ "install.jest": "npx tsx ./src/testing/jest/install-dependencies.mts",
104
104
  "prettier": "npm run prettier.base -- --write",
105
105
  "prettier.base": "prettier --cache \"./({bin,scripts,src,test}/**/*.{ts,tsx,js,jsx})|bin/rindo|.github/(**/)?*.(yml|yaml)|*.js\"",
106
106
  "prettier.dry-run": "npm run prettier.base -- --list-different",
@@ -109,6 +109,7 @@
109
109
  "test": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js --coverage",
110
110
  "test.analysis": "cd test && npm run analysis.build-and-analyze",
111
111
  "test.bundlers": "cd test && npm run bundlers",
112
+ "test.copytask": "cd test/copy-task && npm ci && npm run test",
112
113
  "test.dist": "npm run ts scripts/index.ts -- --validate-build",
113
114
  "test.end-to-end": "cd test/end-to-end && npm ci && npm test && npm run test.dist",
114
115
  "test.jest": "node --experimental-vm-modules ./node_modules/jest/bin/jest.js",
@@ -152,7 +153,7 @@
152
153
  "eslint": "^8.23.1",
153
154
  "eslint-config-prettier": "^9.0.0",
154
155
  "eslint-plugin-jest": "^28.0.0",
155
- "eslint-plugin-jsdoc": "^48.0.0",
156
+ "eslint-plugin-jsdoc": "^50.0.0",
156
157
  "eslint-plugin-simple-import-sort": "^12.0.0",
157
158
  "execa": "9.3.0",
158
159
  "exit": "^0.1.2",
@@ -177,11 +178,12 @@
177
178
  "prettier": "3.3.1",
178
179
  "prompts": "2.4.2",
179
180
  "puppeteer": "^21.0.0",
181
+ "rimraf": "^6.0.1",
180
182
  "rollup": "2.56.3",
181
183
  "semver": "^7.3.7",
182
184
  "terser": "5.31.1",
183
185
  "tsx": "^4.10.3",
184
- "typescript": "~5.5.3",
186
+ "typescript": "~5.5.4",
185
187
  "webpack": "^5.75.0",
186
188
  "ws": "8.17.1"
187
189
  },
@@ -1,5 +1,5 @@
1
1
  /*
2
- Rindo Screenshot v4.20.0 | MIT Licensed | https://rindojs.web.app
2
+ Rindo Screenshot v4.22.0 | MIT Licensed | https://rindojs.web.app
3
3
  */
4
4
  "use strict";
5
5
  var __create = Object.create;
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rindo/core/screenshot",
3
- "version": "4.20.0",
3
+ "version": "4.22.0",
4
4
  "description": "Rindo Screenshot.",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -1,5 +1,5 @@
1
1
  /*
2
- Rindo Screenshot Pixel Match v4.20.0 | MIT Licensed | https://rindojs.web.app
2
+ Rindo Screenshot Pixel Match v4.22.0 | MIT Licensed | https://rindojs.web.app
3
3
  */
4
4
  "use strict";
5
5
  var __create = Object.create;