orvyn-lang 0.2.0 → 0.3.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 (55) hide show
  1. package/GUIDE.md +149 -0
  2. package/LANGUAGE.md +744 -27
  3. package/README.md +211 -250
  4. package/brand/orvyn-sunset-animated.svg +15 -0
  5. package/package.json +3 -1
  6. package/src/cli/orvyn.js +186 -10
  7. package/src/core/signal.js +104 -6
  8. package/src/devtools/runtime.js +25 -1
  9. package/src/lang/a11y.js +102 -0
  10. package/src/lang/auth.js +239 -0
  11. package/src/lang/bundle-native.js +10 -6
  12. package/src/lang/codegen.js +428 -57
  13. package/src/lang/device.js +41 -0
  14. package/src/lang/doctor.js +60 -0
  15. package/src/lang/env.js +27 -0
  16. package/src/lang/errors.js +513 -0
  17. package/src/lang/form.js +69 -8
  18. package/src/lang/index.js +2 -1
  19. package/src/lang/lexer.js +2 -0
  20. package/src/lang/list.js +44 -0
  21. package/src/lang/native/android/MainActivity.kt +43 -4
  22. package/src/lang/native/android/OrvynDevice.kt +163 -0
  23. package/src/lang/native/android/OrvynEngine.kt +154 -7
  24. package/src/lang/native/android/OrvynRenderer.kt +518 -44
  25. package/src/lang/native/android.js +74 -11
  26. package/src/lang/native/build.js +130 -60
  27. package/src/lang/native/config.js +108 -0
  28. package/src/lang/native/ios/OrvynApp.swift +6 -0
  29. package/src/lang/native/ios/OrvynEngine.swift +266 -4
  30. package/src/lang/native/ios/OrvynViews.swift +429 -34
  31. package/src/lang/native/ios.js +75 -2
  32. package/src/lang/native-runtime.js +406 -56
  33. package/src/lang/page.js +52 -0
  34. package/src/lang/parser.js +243 -15
  35. package/src/lang/prerender.js +300 -0
  36. package/src/lang/read-import.js +11 -0
  37. package/src/lang/router.js +266 -0
  38. package/src/lang/runtime-shared.js +792 -10
  39. package/src/lang/runtime.js +362 -52
  40. package/src/lang/select.js +13 -0
  41. package/src/lang/server-code.js +233 -0
  42. package/src/lang/server-export.js +78 -0
  43. package/src/lang/server-libs.js +53 -0
  44. package/src/lang/server.js +409 -0
  45. package/src/lang/test-runner.js +134 -0
  46. package/src/lang/types.js +312 -0
  47. package/src/lang/vite-plugin.js +82 -3
  48. package/src/lang/web-overlay.js +578 -0
  49. package/src/lang/widgets.js +94 -0
  50. package/src/lang/words.js +38 -0
  51. package/src/runtime/mount.js +116 -27
  52. package/src/runtime/patch.js +90 -11
  53. package/src/runtime/style.js +11 -1
  54. package/src/styling/fluid.js +91 -4
  55. package/src/styling/spec.js +306 -0
@@ -0,0 +1,38 @@
1
+ const matches = (item, wanted) => !wanted || Object.entries(wanted).every(([key, value]) => item?.[key] === value);
2
+ const text = (value) => String(value ?? "").toLowerCase();
3
+ const WORDS = {
4
+ where: (list, wanted) => list.filter((item) => matches(item, wanted)),
5
+ count: (list, wanted) => list.filter((item) => matches(item, wanted)).length,
6
+ first: (list, wanted) => list.find((item) => matches(item, wanted)) ?? null,
7
+ // without a field name, every text in the item is searched
8
+ search: (list, query, field) => {
9
+ const needle = text(query).trim();
10
+ if (!needle) return [...list];
11
+ return list.filter((item) => {
12
+ const values = field ? [item?.[field]] : item && typeof item === "object" ? Object.values(item) : [item];
13
+ return values.some((v) => (typeof v === "string" || typeof v === "number") && text(v).includes(needle));
14
+ });
15
+ },
16
+ pick: (list, field) => list.map((item) => item?.[field]),
17
+ total: (list, field, times) => list.reduce((sum, item) => {
18
+ const value = Number(field ? item?.[field] : item) || 0;
19
+ return sum + value * (times ? Number(item?.[times]) || 0 : 1);
20
+ }, 0),
21
+ sortBy: (list, field, order) => {
22
+ const sorted = [...list].sort((a, b) => {
23
+ const [x, y] = [a?.[field], b?.[field]];
24
+ return typeof x === "number" && typeof y === "number" ? x - y : String(x ?? "").localeCompare(String(y ?? ""));
25
+ });
26
+ return order === "high" ? sorted.reverse() : sorted;
27
+ }
28
+ };
29
+ const LIST_WORDS = Object.keys(WORDS);
30
+ function words(target, name, args) {
31
+ if (target === null || target === void 0) return WORDS[name]([], ...args);
32
+ if (Array.isArray(target)) return WORDS[name](target, ...args);
33
+ return target[name](...args);
34
+ }
35
+ export {
36
+ LIST_WORDS,
37
+ words
38
+ };
@@ -1,12 +1,74 @@
1
- import { effect } from "../core/signal.js";
1
+ import {
2
+ createOwner,
3
+ disposeOwner,
4
+ effect,
5
+ runWithOwner,
6
+ signal
7
+ } from "../core/signal.js";
2
8
  import {
3
9
  beginComponentRender,
4
10
  endComponentRender,
5
- registerComponent
11
+ registerComponent,
12
+ unregisterComponent
6
13
  } from "../devtools/runtime.js";
14
+ import {
15
+ createComponentInstance,
16
+ runWithComponentInstance
17
+ } from "../lang/runtime-shared.js";
7
18
  import { isStyleProp } from "../styling/fluid.js";
8
19
  import { applyStyles } from "./style.js";
9
- import { patchChildren, setDomProp } from "./patch.js";
20
+ import { attachDomEvent, patchChildren, setDomProp, syncElementState } from "./patch.js";
21
+ const nodeCleanups = /* @__PURE__ */ new WeakMap();
22
+ const mountedComponents = /* @__PURE__ */ new WeakMap();
23
+ function registerNodeCleanup(node, fn) {
24
+ let list = nodeCleanups.get(node);
25
+ if (!list) {
26
+ list = [];
27
+ nodeCleanups.set(node, list);
28
+ }
29
+ list.push(fn);
30
+ }
31
+ function disposeDomTree(node) {
32
+ if (!node || typeof node !== "object") return;
33
+ const list = nodeCleanups.get(node);
34
+ if (list) {
35
+ nodeCleanups.delete(node);
36
+ for (let i = list.length - 1; i >= 0; i--) {
37
+ try {
38
+ list[i]();
39
+ } catch (error) {
40
+ console.error("[Orvyn] cleanup failed", error);
41
+ }
42
+ }
43
+ }
44
+ const children = node.childNodes;
45
+ if (children && children.length) {
46
+ for (let i = 0; i < children.length; i++) {
47
+ disposeDomTree(children[i]);
48
+ }
49
+ }
50
+ }
51
+ function updateMountedComponent(node, nextProps) {
52
+ const update = mountedComponents.get(node);
53
+ if (!update) return false;
54
+ update(nextProps);
55
+ return true;
56
+ }
57
+ function shallowPropsEqual(prev, next) {
58
+ const keysA = Object.keys(prev);
59
+ const keysB = Object.keys(next);
60
+ if (keysA.length !== keysB.length) return false;
61
+ for (const key of keysA) {
62
+ if (!Object.prototype.hasOwnProperty.call(next, key)) return false;
63
+ if (key === "children") {
64
+ if (Array.isArray(prev.children) && Array.isArray(next.children) && prev.children.length === 0 && next.children.length === 0) {
65
+ continue;
66
+ }
67
+ }
68
+ if (!Object.is(prev[key], next[key])) return false;
69
+ }
70
+ return true;
71
+ }
10
72
  function isSignal(value) {
11
73
  return value && typeof value.get === "function";
12
74
  }
@@ -50,33 +112,59 @@ function mount(vnode) {
50
112
  }
51
113
  if (typeof vnode.tag === "function") {
52
114
  const container = document.createElement("div");
115
+ container.style.display = "contents";
53
116
  const componentId = registerComponent(
54
117
  vnode.tag.name || "Anonymous"
55
118
  );
119
+ const componentOwner = createOwner();
120
+ let latestProps = {
121
+ ...vnode.props,
122
+ children: vnode.children
123
+ };
124
+ const propsSignal = signal(latestProps);
125
+ const instance = createComponentInstance();
56
126
  let previous;
57
127
  let mounted = false;
58
- effect(() => {
59
- const startedAt = beginComponentRender(componentId);
60
- try {
61
- const rendered = vnode.tag({
62
- ...vnode.props,
63
- children: vnode.children
64
- });
65
- const list = Array.isArray(rendered) ? rendered : [rendered];
66
- if (mounted) {
67
- patchChildren(container, previous, list);
68
- } else {
69
- container.appendChild(mount(list));
70
- mounted = true;
128
+ const stopComponent = runWithOwner(
129
+ componentOwner,
130
+ () => effect(() => {
131
+ const startedAt = beginComponentRender(componentId);
132
+ try {
133
+ const props2 = propsSignal.get();
134
+ const rendered = runWithComponentInstance(
135
+ instance,
136
+ () => vnode.tag(props2)
137
+ );
138
+ const list = Array.isArray(rendered) ? rendered : [rendered];
139
+ if (mounted) {
140
+ patchChildren(container, previous, list);
141
+ } else {
142
+ container.appendChild(mount(list));
143
+ mounted = true;
144
+ }
145
+ previous = list;
146
+ } finally {
147
+ endComponentRender(
148
+ componentId,
149
+ startedAt
150
+ );
71
151
  }
72
- previous = list;
73
- } finally {
74
- endComponentRender(
75
- componentId,
76
- startedAt
77
- );
152
+ })
153
+ );
154
+ mountedComponents.set(container, (nextProps) => {
155
+ if (!shallowPropsEqual(latestProps, nextProps)) {
156
+ latestProps = nextProps;
157
+ propsSignal.set(nextProps);
78
158
  }
79
159
  });
160
+ registerNodeCleanup(container, () => {
161
+ mountedComponents.delete(container);
162
+ stopComponent();
163
+ disposeOwner(componentOwner);
164
+ propsSignal.dispose();
165
+ instance.dispose();
166
+ unregisterComponent(componentId);
167
+ });
80
168
  return container;
81
169
  }
82
170
  const el = document.createElement(vnode.tag);
@@ -88,14 +176,12 @@ function mount(vnode) {
88
176
  continue;
89
177
  }
90
178
  if (key.startsWith("on")) {
91
- el.addEventListener(
92
- key.slice(2).toLowerCase(),
93
- value
94
- );
179
+ attachDomEvent(el, key, value);
95
180
  } else if (!isStyleProp(key)) {
96
181
  setDomProp(el, key, value);
97
182
  }
98
183
  }
184
+ syncElementState(el, props);
99
185
  for (const child of vnode.children) {
100
186
  if (isEmpty(child)) continue;
101
187
  el.appendChild(
@@ -105,5 +191,8 @@ function mount(vnode) {
105
191
  return el;
106
192
  }
107
193
  export {
108
- mount
194
+ disposeDomTree,
195
+ mount,
196
+ registerNodeCleanup,
197
+ updateMountedComponent
109
198
  };
@@ -1,5 +1,5 @@
1
1
  import { applyStyles } from "./style.js";
2
- import { mount } from "./mount.js";
2
+ import { disposeDomTree, mount, updateMountedComponent } from "./mount.js";
3
3
  import {
4
4
  getStylePropTargets,
5
5
  isStyleProp
@@ -13,7 +13,82 @@ function clearStyle(el, property) {
13
13
  el.style[property] = "";
14
14
  }
15
15
  const LIVE_PROPS = /* @__PURE__ */ new Set(["value", "checked", "selected"]);
16
+ const pendingButtons = /* @__PURE__ */ new WeakSet();
17
+ const latestNodeProps = /* @__PURE__ */ new WeakMap();
18
+ const nodeEventWrappers = /* @__PURE__ */ new WeakMap();
19
+ function attachDomEvent(el, key, raw) {
20
+ if (typeof raw !== "function") return;
21
+ const eventName = key.slice(2).toLowerCase();
22
+ const isAsyncButtonClick = eventName === "click" && el.nodeName?.toUpperCase() === "BUTTON" && el.type !== "submit";
23
+ const wrapped = isAsyncButtonClick ? (event) => {
24
+ if (pendingButtons.has(el)) return;
25
+ const outcome = raw(event);
26
+ if (outcome && typeof outcome.then === "function") {
27
+ pendingButtons.add(el);
28
+ syncElementState(el, latestNodeProps.get(el) || {});
29
+ return Promise.resolve(outcome).finally(() => {
30
+ pendingButtons.delete(el);
31
+ syncElementState(el, latestNodeProps.get(el) || {});
32
+ });
33
+ }
34
+ return outcome;
35
+ } : raw;
36
+ let map = nodeEventWrappers.get(el);
37
+ if (!map) {
38
+ map = /* @__PURE__ */ new Map();
39
+ nodeEventWrappers.set(el, map);
40
+ }
41
+ const prev = map.get(eventName);
42
+ if (prev) el.removeEventListener(eventName, prev.wrapped);
43
+ map.set(eventName, { raw, wrapped });
44
+ el.addEventListener(eventName, wrapped);
45
+ }
46
+ function detachDomEvent(el, key, oldRaw) {
47
+ const eventName = key.slice(2).toLowerCase();
48
+ const map = nodeEventWrappers.get(el);
49
+ const entry = map?.get(eventName);
50
+ if (entry && entry.raw === oldRaw) {
51
+ el.removeEventListener(eventName, entry.wrapped);
52
+ map.delete(eventName);
53
+ } else {
54
+ el.removeEventListener(eventName, oldRaw);
55
+ }
56
+ }
57
+ function syncElementState(el, props = {}) {
58
+ latestNodeProps.set(el, props);
59
+ const autoLoading = pendingButtons.has(el);
60
+ const lazy = props.loading === "lazy" || props.loading === "eager";
61
+ if (lazy) el.setAttribute("loading", props.loading);
62
+ const isLoading = Boolean(props.loading && !lazy || autoLoading);
63
+ const isDisabled = Boolean(props.disabled || isLoading);
64
+ const tag = el.nodeName?.toUpperCase();
65
+ if (tag === "BUTTON" || tag === "INPUT" || "disabled" in el) {
66
+ el.disabled = isDisabled;
67
+ }
68
+ if (props.disabled) el.setAttribute("aria-disabled", "true");
69
+ else el.removeAttribute("aria-disabled");
70
+ if (isLoading) {
71
+ el.setAttribute("aria-busy", "true");
72
+ el.setAttribute("data-orvyn-loading", "true");
73
+ } else {
74
+ el.removeAttribute("aria-busy");
75
+ el.removeAttribute("data-orvyn-loading");
76
+ }
77
+ if (props.error) {
78
+ el.setAttribute("aria-invalid", "true");
79
+ el.setAttribute("data-orvyn-error", "true");
80
+ } else if (!("aria-invalid" in props)) {
81
+ el.removeAttribute("aria-invalid");
82
+ el.removeAttribute("data-orvyn-error");
83
+ }
84
+ if (props.rtl === true) el.setAttribute("dir", "rtl");
85
+ else if (props.rtl === false) el.setAttribute("dir", "ltr");
86
+ else if (!("dir" in props)) el.removeAttribute("dir");
87
+ }
16
88
  function setDomProp(el, key, value) {
89
+ if (key === "disabled" || key === "loading" || key === "error" || key === "rtl") {
90
+ return;
91
+ }
17
92
  if (LIVE_PROPS.has(key)) {
18
93
  const next = key === "value" ? value ?? "" : Boolean(value);
19
94
  if (el[key] !== next) el[key] = next;
@@ -63,10 +138,7 @@ function patchProps(el, oldProps = {}, newProps = {}) {
63
138
  const newValue = newProps[key];
64
139
  if (oldValue === newValue) continue;
65
140
  if (key.startsWith("on")) {
66
- el.removeEventListener(
67
- key.slice(2).toLowerCase(),
68
- oldValue
69
- );
141
+ detachDomEvent(el, key, oldValue);
70
142
  } else if (isStyleProp(key) && !(key in newProps)) {
71
143
  getStylePropTargets(key, "dom").forEach((target) => {
72
144
  clearStyle(el, target);
@@ -86,14 +158,12 @@ function patchProps(el, oldProps = {}, newProps = {}) {
86
158
  const newValue = newProps[key];
87
159
  if (oldValue === newValue) continue;
88
160
  if (key.startsWith("on")) {
89
- el.addEventListener(
90
- key.slice(2).toLowerCase(),
91
- newValue
92
- );
161
+ attachDomEvent(el, key, newValue);
93
162
  } else if (!isStyleProp(key)) {
94
163
  setDomProp(el, key, newValue);
95
164
  }
96
165
  }
166
+ syncElementState(el, newProps);
97
167
  }
98
168
  function patchChildren(el, oldChildren = [], newChildren = []) {
99
169
  const oldList = normalizeChildren(oldChildren);
@@ -150,12 +220,13 @@ function patchChildren(el, oldChildren = [], newChildren = []) {
150
220
  });
151
221
  oldRecords.forEach((record) => {
152
222
  if (!used.has(record)) {
223
+ disposeDomTree(record.el);
153
224
  record.el?.remove();
154
225
  }
155
226
  });
156
227
  }
157
228
  function patch(parent, el, oldVNode, newVNode) {
158
- if (oldVNode === newVNode) {
229
+ if (oldVNode === newVNode && isTextVNode(newVNode)) {
159
230
  return el;
160
231
  }
161
232
  if (isTextVNode(oldVNode) && isTextVNode(newVNode)) {
@@ -166,6 +237,7 @@ function patch(parent, el, oldVNode, newVNode) {
166
237
  }
167
238
  if (isTextVNode(oldVNode) || isTextVNode(newVNode) || !canPatch(oldVNode, newVNode)) {
168
239
  const newEl = mount(newVNode);
240
+ disposeDomTree(el);
169
241
  parent.replaceChild(
170
242
  newEl,
171
243
  el
@@ -173,7 +245,11 @@ function patch(parent, el, oldVNode, newVNode) {
173
245
  return newEl;
174
246
  }
175
247
  if (typeof newVNode.tag === "function") {
248
+ if (updateMountedComponent(el, { ...newVNode.props, children: newVNode.children })) {
249
+ return el;
250
+ }
176
251
  const newEl = mount(newVNode);
252
+ disposeDomTree(el);
177
253
  parent.replaceChild(
178
254
  newEl,
179
255
  el
@@ -193,7 +269,10 @@ function patch(parent, el, oldVNode, newVNode) {
193
269
  return el;
194
270
  }
195
271
  export {
272
+ attachDomEvent,
273
+ detachDomEvent,
196
274
  patch,
197
275
  patchChildren,
198
- setDomProp
276
+ setDomProp,
277
+ syncElementState
199
278
  };
@@ -3,8 +3,10 @@ import {
3
3
  ensureFluidUtilityStyles,
4
4
  getResolvedClassName,
5
5
  getStyleDeclarations,
6
- getStylePropTargets
6
+ getStylePropTargets,
7
+ isStyleProp
7
8
  } from "../styling/fluid.js";
9
+ import { autoButtonColor, warnStyle } from "../styling/spec.js";
8
10
  function isSignal(value) {
9
11
  return value && typeof value.get === "function" && typeof value.subscribe === "function";
10
12
  }
@@ -39,6 +41,10 @@ function applyStyles(el, props = {}) {
39
41
  if (key === "class" || key === "className") {
40
42
  continue;
41
43
  }
44
+ if (!isStyleProp(key)) {
45
+ warnStyle(key, "web");
46
+ continue;
47
+ }
42
48
  const applyValue = (value2) => {
43
49
  const declarations = getStyleDeclarations(
44
50
  key,
@@ -69,6 +75,10 @@ function applyStyles(el, props = {}) {
69
75
  applyValue(value);
70
76
  }
71
77
  }
78
+ if (el.nodeName?.toUpperCase() === "BUTTON" && props.bg && !("color" in props)) {
79
+ const fg = autoButtonColor(typeof props.bg.get === "function" ? props.bg.get() : props.bg);
80
+ if (fg) setStyle(el, "color", fg);
81
+ }
72
82
  }
73
83
  export {
74
84
  applyStyles
@@ -1,3 +1,8 @@
1
+ import {
2
+ resolveFontFamily,
3
+ resolveThemeToken,
4
+ theme
5
+ } from "./spec.js";
1
6
  const fluidProps = /* @__PURE__ */ new Set([
2
7
  "size",
3
8
  "gap",
@@ -29,6 +34,7 @@ const containerSafeProps = /* @__PURE__ */ new Set([
29
34
  const stateStyleProps = /* @__PURE__ */ new Set([
30
35
  "hover",
31
36
  "active",
37
+ "pressed",
32
38
  "focus"
33
39
  ]);
34
40
  const unitlessProps = /* @__PURE__ */ new Set([
@@ -100,7 +106,8 @@ const domStyleProps = {
100
106
  zIndex: ["zIndex"],
101
107
  opacity: ["opacity"],
102
108
  fontWeight: ["fontWeight"],
103
- weight: ["fontWeight"]
109
+ weight: ["fontWeight"],
110
+ font: ["fontFamily"]
104
111
  };
105
112
  const cssStyleProps = {
106
113
  display: ["display"],
@@ -158,7 +165,8 @@ const cssStyleProps = {
158
165
  zIndex: ["z-index"],
159
166
  opacity: ["opacity"],
160
167
  fontWeight: ["font-weight"],
161
- weight: ["font-weight"]
168
+ weight: ["font-weight"],
169
+ font: ["font-family"]
162
170
  };
163
171
  const utilityProps = {
164
172
  text: "size",
@@ -344,11 +352,63 @@ function responsiveFluid(value, prop) {
344
352
  }
345
353
  return toCssLength(desktop);
346
354
  }
355
+ const WEB_THEME_VARS = {
356
+ bg: "var(--orvyn-bg, #ffffff)",
357
+ surface: "var(--orvyn-surface, #f8fafc)",
358
+ card: "var(--orvyn-card, #f1f5f9)",
359
+ text: "var(--orvyn-text, #0f172a)",
360
+ muted: "var(--orvyn-muted, #64748b)",
361
+ primary: "var(--orvyn-primary, #007aff)",
362
+ onPrimary: "var(--orvyn-on-primary, #ffffff)",
363
+ border: "var(--orvyn-border, #cbd5e1)",
364
+ danger: "var(--orvyn-danger, #ef4444)",
365
+ success: "var(--orvyn-success, #16a34a)",
366
+ warning: "var(--orvyn-warning, #f59e0b)"
367
+ };
368
+ function resolveWebThemeColor(value) {
369
+ const trimmed = value.trim();
370
+ return Object.hasOwn(WEB_THEME_VARS, trimmed) ? WEB_THEME_VARS[trimmed] : trimmed;
371
+ }
372
+ const ALIGN_MAP = {
373
+ start: "flex-start",
374
+ end: "flex-end"
375
+ };
376
+ const JUSTIFY_MAP = {
377
+ start: "flex-start",
378
+ end: "flex-end",
379
+ between: "space-between",
380
+ around: "space-around",
381
+ evenly: "space-evenly"
382
+ };
347
383
  function formatStyleValue(prop, value, options = {}) {
384
+ const css = formatValue(prop, value, options);
385
+ if (prop !== "size" || css === null) return css;
386
+ return css.replace(/(\d*\.?\d+)px/g, (_, n) => `${formatNumber(Number(n) / 16)}rem`);
387
+ }
388
+ function formatValue(prop, value, options = {}) {
348
389
  const fluidNumbers = options.fluidNumbers ?? true;
349
390
  if (value === null || value === void 0 || value === false) {
350
391
  return null;
351
392
  }
393
+ if (prop === "bg" || prop === "color") {
394
+ if (typeof value === "string") value = resolveWebThemeColor(value);
395
+ } else if (prop === "border" && typeof value === "string") {
396
+ value = value.trim().split(/\s+/).map(resolveWebThemeColor).join(" ");
397
+ } else {
398
+ value = resolveThemeToken(prop, value, theme());
399
+ }
400
+ if (prop === "font") {
401
+ return resolveFontFamily(value, "web");
402
+ }
403
+ if (prop === "grow" && value === true) {
404
+ return "1";
405
+ }
406
+ if (prop === "align" && typeof value === "string") {
407
+ return ALIGN_MAP[value] ?? value;
408
+ }
409
+ if (prop === "justify" && typeof value === "string") {
410
+ return JUSTIFY_MAP[value] ?? value;
411
+ }
352
412
  if (prop === "flex" && value === true) {
353
413
  return "flex";
354
414
  }
@@ -452,9 +512,15 @@ function isFluidProp(prop) {
452
512
  return fluidProps.has(prop);
453
513
  }
454
514
  function isStyleProp(prop) {
455
- return prop in domStyleProps || stateStyleProps.has(prop);
515
+ return prop in domStyleProps || stateStyleProps.has(prop) || prop === "center" || prop === "scroll";
456
516
  }
457
517
  function getStylePropTargets(prop, target) {
518
+ if (prop === "center") {
519
+ return target === "dom" ? ["display", "alignItems", "justifyContent", "textAlign"] : ["display", "align-items", "justify-content", "text-align"];
520
+ }
521
+ if (prop === "scroll") {
522
+ return target === "dom" ? ["overflow", "overflowX", "overflowY"] : ["overflow", "overflow-x", "overflow-y"];
523
+ }
458
524
  return getStyleProps(target)[prop] || [];
459
525
  }
460
526
  function getStyleDeclarations(prop, value, target) {
@@ -469,6 +535,26 @@ function getStyleDeclarationsForValue(prop, value, target, options) {
469
535
  if (isBreakpointValue(value)) {
470
536
  return [];
471
537
  }
538
+ if (prop === "center") {
539
+ if (value !== true) return [];
540
+ const align = target === "dom" ? "alignItems" : "align-items";
541
+ const justify = target === "dom" ? "justifyContent" : "justify-content";
542
+ const textAlign = target === "dom" ? "textAlign" : "text-align";
543
+ return [
544
+ { property: "display", value: "flex" },
545
+ { property: align, value: "center" },
546
+ { property: justify, value: "center" },
547
+ { property: textAlign, value: "center" }
548
+ ];
549
+ }
550
+ if (prop === "scroll") {
551
+ if (!value) return [];
552
+ const ox = target === "dom" ? "overflowX" : "overflow-x";
553
+ const oy = target === "dom" ? "overflowY" : "overflow-y";
554
+ if (value === "horizontal") return [{ property: ox, value: "auto" }];
555
+ if (value === "both") return [{ property: "overflow", value: "auto" }];
556
+ return [{ property: oy, value: "auto" }];
557
+ }
472
558
  if (prop === "columns") {
473
559
  const property = target === "dom" ? "gridTemplateColumns" : "grid-template-columns";
474
560
  const template = gridTemplateColumns(value);
@@ -571,11 +657,12 @@ function getStateDeclarationGroups(props = {}) {
571
657
  if (!value || typeof value !== "object" || Array.isArray(value)) {
572
658
  return;
573
659
  }
660
+ const cssState = state === "pressed" ? "active" : state;
574
661
  for (const key in value) {
575
662
  if (!isStyleProp(key)) {
576
663
  continue;
577
664
  }
578
- groups[state].push(
665
+ groups[cssState].push(
579
666
  ...getStyleDeclarationsForValue(
580
667
  key,
581
668
  readValue(value[key]),