@tamagui/static 3.0.0-beta.1093.1 → 3.0.0-beta.1099.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.
@@ -65,13 +65,6 @@ const nativeRuntimeOnlyStyleProperties = /* @__PURE__ */ new Set(["textIndent"])
65
65
  function componentKey(resolvedId, exportName) {
66
66
  return `${resolvedId}#${exportName}`;
67
67
  }
68
- function cssFromRules(rules) {
69
- return Object.values(rules).flatMap((styleObject) => {
70
- const identifier = styleObject?.[import_helpers.StyleObjectIdentifier];
71
- const styleRules = styleObject?.[import_helpers.StyleObjectRules];
72
- return identifier && Array.isArray(styleRules) ? styleRules : [];
73
- });
74
- }
75
68
  function jsxClassName(value) {
76
69
  return `className=${JSON.stringify(value)}`;
77
70
  }
@@ -95,7 +88,16 @@ function extractedStyleArtifacts(split, props, config, includeRuntimeBase = true
95
88
  const viewClassName = typeof split.viewProps?.className === "string" ? split.viewProps.className : "";
96
89
  const classNameWithoutCaller = callerClassName && viewClassName.endsWith(callerClassName) ? viewClassName.slice(0, -callerClassName.length).trimEnd() : viewClassName;
97
90
  const rules = split.rulesToInsert ?? {};
98
- const mediaNames = new Set(Object.keys(config.media ?? {}));
91
+ const mediaNames = Object.keys(config.media ?? {});
92
+ const rulesByIdentifier = /* @__PURE__ */ new Map();
93
+ for (const styleObject of Object.values(rules)) {
94
+ const identifier = styleObject?.[import_helpers.StyleObjectIdentifier];
95
+ const styleRules = styleObject?.[import_helpers.StyleObjectRules];
96
+ if (typeof identifier !== "string" || !Array.isArray(styleRules)) continue;
97
+ const existing = rulesByIdentifier.get(identifier);
98
+ if (existing) existing.push(...styleRules);
99
+ else rulesByIdentifier.set(identifier, [...styleRules]);
100
+ }
99
101
  const pseudoNames = [
100
102
  "hover",
101
103
  "press",
@@ -121,14 +123,14 @@ function extractedStyleArtifacts(split, props, config, includeRuntimeBase = true
121
123
  })]);
122
124
  for (const identifier of identifiers) {
123
125
  const key = classKeys.get(identifier) ?? "";
124
- const css2 = cssFromRules(Object.fromEntries(Object.entries(rules).filter(([, styleObject]) => styleObject?.[import_helpers.StyleObjectIdentifier] === identifier))).join("");
126
+ const css2 = (rulesByIdentifier.get(identifier) ?? []).join("");
125
127
  if (identifier.startsWith("t_group_")) {
126
128
  buckets.group.push(identifier);
127
129
  } else if (pseudoNames.some((name) => key.endsWith(`-${name}`))) {
128
130
  buckets.pseudo.push(identifier);
129
131
  } else if (css2.includes(".t_")) {
130
132
  buckets.theme.push(identifier);
131
- } else if ([...mediaNames].some((name) => key.endsWith(`-${name}`))) {
133
+ } else if (mediaNames.some((name) => key.endsWith(`-${name}`))) {
132
134
  buckets.media.push(identifier);
133
135
  } else {
134
136
  buckets.normal.push(identifier);
@@ -144,7 +146,7 @@ function extractedStyleArtifacts(split, props, config, includeRuntimeBase = true
144
146
  const orderedSet = new Set(orderedIdentifiers);
145
147
  const baseViewClassName = includeRuntimeBase ? classNameWithoutCaller.split(/\s+/).filter((token) => token && !orderedSet.has(token)).join(" ") : "";
146
148
  const css = orderedIdentifiers.flatMap((identifier) => {
147
- const identifierRules = cssFromRules(Object.fromEntries(Object.entries(rules).filter(([, styleObject]) => styleObject?.[import_helpers.StyleObjectIdentifier] === identifier)));
149
+ const identifierRules = rulesByIdentifier.get(identifier) ?? [];
148
150
  return buckets.theme.includes(identifier) ? identifierRules.map((rule) => rule.replace(":root:root:root.t_", ":root:root:root:root.t_")) : identifierRules;
149
151
  });
150
152
  return {
@@ -164,7 +164,8 @@ function generateIslandEntrySource(input) {
164
164
  const entry = input.island.entry;
165
165
  return `// generated by @tamagui/static zero-runtime. do not edit.
166
166
  import * as React from 'react'
167
- import { TamaguiProvider, Theme } from 'tamagui'
167
+ import { TamaguiProvider } from 'tamagui/provider'
168
+ import { Theme } from '@tamagui/core'
168
169
  import { createThemeUpdateState } from '@tamagui/web/theme-update'
169
170
  import config from ${JSON.stringify(importPath(entry, input.configPath))}
170
171
  import IslandRoot from ${JSON.stringify(importPath(entry, input.island.module))}
@@ -40,13 +40,6 @@ const nativeRuntimeOnlyStyleProperties = /* @__PURE__ */ new Set(["textIndent"])
40
40
  function componentKey(resolvedId, exportName) {
41
41
  return `${resolvedId}#${exportName}`;
42
42
  }
43
- function cssFromRules(rules) {
44
- return Object.values(rules).flatMap((styleObject) => {
45
- const identifier = styleObject?.[StyleObjectIdentifier];
46
- const styleRules = styleObject?.[StyleObjectRules];
47
- return identifier && Array.isArray(styleRules) ? styleRules : [];
48
- });
49
- }
50
43
  function jsxClassName(value) {
51
44
  return `className=${JSON.stringify(value)}`;
52
45
  }
@@ -70,7 +63,16 @@ function extractedStyleArtifacts(split, props, config, includeRuntimeBase = true
70
63
  const viewClassName = typeof split.viewProps?.className === "string" ? split.viewProps.className : "";
71
64
  const classNameWithoutCaller = callerClassName && viewClassName.endsWith(callerClassName) ? viewClassName.slice(0, -callerClassName.length).trimEnd() : viewClassName;
72
65
  const rules = split.rulesToInsert ?? {};
73
- const mediaNames = new Set(Object.keys(config.media ?? {}));
66
+ const mediaNames = Object.keys(config.media ?? {});
67
+ const rulesByIdentifier = /* @__PURE__ */ new Map();
68
+ for (const styleObject of Object.values(rules)) {
69
+ const identifier = styleObject?.[StyleObjectIdentifier];
70
+ const styleRules = styleObject?.[StyleObjectRules];
71
+ if (typeof identifier !== "string" || !Array.isArray(styleRules)) continue;
72
+ const existing = rulesByIdentifier.get(identifier);
73
+ if (existing) existing.push(...styleRules);
74
+ else rulesByIdentifier.set(identifier, [...styleRules]);
75
+ }
74
76
  const pseudoNames = [
75
77
  "hover",
76
78
  "press",
@@ -96,14 +98,14 @@ function extractedStyleArtifacts(split, props, config, includeRuntimeBase = true
96
98
  })]);
97
99
  for (const identifier of identifiers) {
98
100
  const key = classKeys.get(identifier) ?? "";
99
- const css2 = cssFromRules(Object.fromEntries(Object.entries(rules).filter(([, styleObject]) => styleObject?.[StyleObjectIdentifier] === identifier))).join("");
101
+ const css2 = (rulesByIdentifier.get(identifier) ?? []).join("");
100
102
  if (identifier.startsWith("t_group_")) {
101
103
  buckets.group.push(identifier);
102
104
  } else if (pseudoNames.some((name) => key.endsWith(`-${name}`))) {
103
105
  buckets.pseudo.push(identifier);
104
106
  } else if (css2.includes(".t_")) {
105
107
  buckets.theme.push(identifier);
106
- } else if ([...mediaNames].some((name) => key.endsWith(`-${name}`))) {
108
+ } else if (mediaNames.some((name) => key.endsWith(`-${name}`))) {
107
109
  buckets.media.push(identifier);
108
110
  } else {
109
111
  buckets.normal.push(identifier);
@@ -119,7 +121,7 @@ function extractedStyleArtifacts(split, props, config, includeRuntimeBase = true
119
121
  const orderedSet = new Set(orderedIdentifiers);
120
122
  const baseViewClassName = includeRuntimeBase ? classNameWithoutCaller.split(/\s+/).filter((token) => token && !orderedSet.has(token)).join(" ") : "";
121
123
  const css = orderedIdentifiers.flatMap((identifier) => {
122
- const identifierRules = cssFromRules(Object.fromEntries(Object.entries(rules).filter(([, styleObject]) => styleObject?.[StyleObjectIdentifier] === identifier)));
124
+ const identifierRules = rulesByIdentifier.get(identifier) ?? [];
123
125
  return buckets.theme.includes(identifier) ? identifierRules.map((rule) => rule.replace(":root:root:root.t_", ":root:root:root:root.t_")) : identifierRules;
124
126
  });
125
127
  return {