@stratakit/structures 0.5.2 → 0.5.3

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.3
4
+
5
+ - [#1108](https://github.com/iTwin/design-system/pull/1108): Decoupled the styles for `@stratakit/bricks` and `@stratakit/structures` from `@stratakit/foundations` so that the latter does not indirectly depend on the former two. This change also reduces the need for these packages to remain in lockstep.
6
+ - Updated dependencies:
7
+ - @stratakit/foundations@0.4.3
8
+ - @stratakit/bricks@0.5.3
9
+
3
10
  ## 0.5.2
4
11
 
5
12
  - [#1078](https://github.com/iTwin/design-system/pull/1078): Added `DropdownMenu.Group` component used to group menu items within a dropdown menu.
@@ -3,7 +3,9 @@ import { Role } from "@ariakit/react/role";
3
3
  import { Text } from "@stratakit/bricks";
4
4
  import { forwardRef } from "@stratakit/foundations/secret-internals";
5
5
  import cx from "classnames";
6
+ import { useInit } from "./~utils.useInit.js";
6
7
  const ListItem = forwardRef((props, forwardedRef) => {
8
+ useInit();
7
9
  return /* @__PURE__ */ jsx(
8
10
  Role.div,
9
11
  {
@@ -1,15 +1,21 @@
1
1
  import * as React from "react";
2
- import { RootContext } from "@stratakit/foundations/secret-internals";
2
+ import {
3
+ RootContext,
4
+ useSafeContext
5
+ } from "@stratakit/foundations/secret-internals";
6
+ import css from "./styles.css.js";
3
7
  const packageName = "@stratakit/structures";
8
+ const key = `${packageName}@${"0.5.3"}`;
4
9
  function useInit() {
5
- const rootContext = React.useContext(RootContext);
6
- if (!rootContext) {
7
- DEV: console.error(
8
- `All ${packageName} components must be used within a <Root> component from @stratakit/foundations.`
9
- );
10
- } else {
11
- rootContext.versions?.set(packageName, "0.5.2");
12
- }
10
+ const rootContext = useSafeContext(RootContext);
11
+ if (!rootContext.versions?.has(packageName))
12
+ rootContext.versions?.set(packageName, "0.5.3");
13
+ const { rootNode, loadStyles } = rootContext;
14
+ React.useInsertionEffect(() => {
15
+ if (!rootNode || !loadStyles) return;
16
+ const { cleanup } = loadStyles(rootNode, { css, key });
17
+ return cleanup;
18
+ }, [rootNode, loadStyles]);
13
19
  }
14
20
  export {
15
21
  useInit
@@ -3,7 +3,9 @@ import { Role } from "@ariakit/react/role";
3
3
  import { Text } from "@stratakit/bricks";
4
4
  import { forwardRef } from "@stratakit/foundations/secret-internals";
5
5
  import cx from "classnames";
6
+ import { useInit } from "./~utils.useInit.js";
6
7
  const ListItem = forwardRef((props, forwardedRef) => {
8
+ useInit();
7
9
  return /* @__PURE__ */ jsx(Role.div, {
8
10
  role: "listitem",
9
11
  ...props,
@@ -1,12 +1,44 @@
1
+ import { c as _c } from "react-compiler-runtime";
1
2
  import * as React from "react";
2
- import { RootContext } from "@stratakit/foundations/secret-internals";
3
+ import { RootContext, useSafeContext } from "@stratakit/foundations/secret-internals";
4
+ import css from "./styles.css.js";
3
5
  const packageName = "@stratakit/structures";
6
+ const key = `${packageName}@${"0.5.3"}`;
4
7
  function useInit() {
5
- const rootContext = React.useContext(RootContext);
6
- if (!rootContext) {
8
+ const $ = _c(4);
9
+ const rootContext = useSafeContext(RootContext);
10
+ if (!rootContext.versions?.has(packageName)) {
11
+ rootContext.versions?.set(packageName, "0.5.3");
12
+ }
13
+ const {
14
+ rootNode,
15
+ loadStyles
16
+ } = rootContext;
17
+ let t0;
18
+ let t1;
19
+ if ($[0] !== loadStyles || $[1] !== rootNode) {
20
+ t0 = () => {
21
+ if (!rootNode || !loadStyles) {
22
+ return;
23
+ }
24
+ const {
25
+ cleanup
26
+ } = loadStyles(rootNode, {
27
+ css,
28
+ key
29
+ });
30
+ return cleanup;
31
+ };
32
+ t1 = [rootNode, loadStyles];
33
+ $[0] = loadStyles;
34
+ $[1] = rootNode;
35
+ $[2] = t0;
36
+ $[3] = t1;
7
37
  } else {
8
- rootContext.versions?.set(packageName, "0.5.2");
38
+ t0 = $[2];
39
+ t1 = $[3];
9
40
  }
41
+ React.useInsertionEffect(t0, t1);
10
42
  }
11
43
  export {
12
44
  useInit
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@stratakit/structures",
3
3
  "type": "module",
4
- "version": "0.5.2",
4
+ "version": "0.5.3",
5
5
  "license": "MIT",
6
6
  "sideEffects": false,
7
7
  "types": "./dist/index.d.ts",
@@ -119,24 +119,24 @@
119
119
  "ui"
120
120
  ],
121
121
  "dependencies": {
122
- "@ariakit/react": "^0.4.19",
123
- "@stratakit/bricks": "^0.5.2",
122
+ "@ariakit/react": "^0.4.20",
123
+ "@stratakit/bricks": "^0.5.3",
124
124
  "classnames": "^2.5.1",
125
125
  "react-compiler-runtime": "^1.0.0",
126
- "zustand": "^5.0.8"
126
+ "zustand": "^5.0.9"
127
127
  },
128
128
  "devDependencies": {
129
129
  "@types/node": "^22.19.1",
130
- "@types/react": "^19.2.2",
130
+ "@types/react": "^19.2.7",
131
131
  "@types/react-dom": "^19.2.3",
132
132
  "esbuild": "^0.27.0",
133
- "react": "^19.2.0",
134
- "react-dom": "^19.2.0",
133
+ "react": "^19.2.1",
134
+ "react-dom": "^19.2.1",
135
135
  "typescript": "~5.9.3",
136
- "@stratakit/foundations": "0.4.2"
136
+ "@stratakit/foundations": "0.4.3"
137
137
  },
138
138
  "peerDependencies": {
139
- "@stratakit/foundations": "^0.4.2",
139
+ "@stratakit/foundations": "^0.4.3",
140
140
  "react": ">=18.0.0",
141
141
  "react-dom": ">=18.0.0"
142
142
  },