@yahoo/uds-create-config 2.45.0 → 3.0.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.
- package/README.md +129 -0
- package/dist/ai-lanes.d.ts +23 -0
- package/dist/ai-lanes.js +34 -0
- package/dist/authoring/define-component.d.ts +85 -0
- package/dist/configs/CanvasConfig.d.ts +3237 -0
- package/dist/configs/CanvasConfig.js +332 -0
- package/dist/configs/build-options.d.ts +10 -0
- package/dist/configs/build-options.js +68 -0
- package/dist/configs/platform.d.ts +15 -0
- package/dist/configs/platform.js +17 -0
- package/dist/configs/react-native-system.d.ts +3026 -0
- package/dist/configs/react-native-system.js +64 -0
- package/dist/configs/system.d.ts +2771 -0
- package/dist/configs/system.js +74 -0
- package/dist/css/properties.generated.d.ts +14 -0
- package/dist/css/properties.generated.js +6260 -0
- package/dist/css/value-type.d.ts +48 -0
- package/dist/css/value-type.js +131 -0
- package/dist/css/values.d.ts +33 -0
- package/dist/css/values.js +116 -0
- package/dist/entities/native/NativeModifier.d.ts +25 -0
- package/dist/entities/native/NativeModifier.js +41 -0
- package/dist/entities/native/NativeSettings.d.ts +44 -0
- package/dist/entities/native/NativeSettings.js +39 -0
- package/dist/entities/native/NativeStyleProperty.d.ts +355 -0
- package/dist/entities/native/NativeStyleProperty.js +28 -0
- package/dist/entities/native/NativeToken.d.ts +31 -0
- package/dist/entities/native/NativeToken.js +49 -0
- package/dist/entities/system/CanvasRole.d.ts +34 -0
- package/dist/entities/system/CanvasRole.js +45 -0
- package/dist/entities/system/Component.d.ts +1287 -0
- package/dist/entities/system/Component.js +1840 -0
- package/dist/entities/system/Composite.d.ts +12 -0
- package/dist/entities/system/Composite.js +26 -0
- package/dist/entities/system/Device.d.ts +11 -0
- package/dist/entities/system/Device.js +18 -0
- package/dist/entities/system/File.d.ts +72 -0
- package/dist/entities/system/File.js +136 -0
- package/dist/entities/system/Font.d.ts +48 -0
- package/dist/entities/system/Font.js +56 -0
- package/dist/entities/system/GlobalStyle.d.ts +26 -0
- package/dist/entities/system/GlobalStyle.js +54 -0
- package/dist/entities/system/Guidance.d.ts +85 -0
- package/dist/entities/system/Guidance.js +59 -0
- package/dist/entities/system/GuidanceStyle.d.ts +14 -0
- package/dist/entities/system/GuidanceStyle.js +8 -0
- package/dist/entities/system/Icon.d.ts +46 -0
- package/dist/entities/system/Icon.js +46 -0
- package/dist/entities/system/LinkedSystem.d.ts +504 -0
- package/dist/entities/system/LinkedSystem.js +814 -0
- package/dist/entities/system/Modifier.d.ts +92 -0
- package/dist/entities/system/Modifier.js +120 -0
- package/dist/entities/system/Motion.d.ts +28 -0
- package/dist/entities/system/Motion.js +48 -0
- package/dist/entities/system/Operation.d.ts +100 -0
- package/dist/entities/system/Operation.js +236 -0
- package/dist/entities/system/Package.d.ts +42 -0
- package/dist/entities/system/Package.js +75 -0
- package/dist/entities/system/Settings.d.ts +94 -0
- package/dist/entities/system/Settings.js +166 -0
- package/dist/entities/system/StyleProperty.d.ts +135 -0
- package/dist/entities/system/StyleProperty.js +438 -0
- package/dist/entities/system/Token.d.ts +67 -0
- package/dist/entities/system/Token.js +129 -0
- package/dist/entities/system/Tool.d.ts +134 -0
- package/dist/entities/system/Tool.js +124 -0
- package/dist/entities/system/color.d.ts +64 -0
- package/dist/entities/system/color.js +123 -0
- package/dist/entities/system/component-module.d.ts +63 -0
- package/dist/entities/system/component-module.js +258 -0
- package/dist/entities/system/copy-plan.d.ts +98 -0
- package/dist/entities/system/copy-plan.js +451 -0
- package/dist/entities/system/defineComponent.d.ts +428 -0
- package/dist/entities/system/defineComponent.js +337 -0
- package/dist/entities/system/element.d.ts +101 -0
- package/dist/entities/system/element.js +171 -0
- package/dist/entities/system/icon-library.d.ts +64 -0
- package/dist/entities/system/icon-library.js +112 -0
- package/dist/entities/system/icon-metadata.d.ts +72 -0
- package/dist/entities/system/icon-metadata.js +111 -0
- package/dist/entities/system/link-declaration.d.ts +27 -0
- package/dist/entities/system/link-declaration.js +64 -0
- package/dist/entities/system/link-plan.d.ts +160 -0
- package/dist/entities/system/link-plan.js +770 -0
- package/dist/entities/system/runtime-modules.d.ts +25 -0
- package/dist/entities/system/runtime-modules.js +38 -0
- package/dist/entities/system/style-bag.d.ts +20 -0
- package/dist/entities/system/style-bag.js +246 -0
- package/dist/entities/system/token-index.d.ts +89 -0
- package/dist/entities/system/token-index.js +112 -0
- package/dist/framework/Config.d.ts +2472 -0
- package/dist/framework/Config.js +5023 -0
- package/dist/framework/Entity.d.ts +127 -0
- package/dist/framework/Entity.js +125 -0
- package/dist/framework/authoring.d.ts +24 -0
- package/dist/framework/authoring.js +7 -0
- package/dist/framework/change-hooks.d.ts +119 -0
- package/dist/framework/change-hooks.js +131 -0
- package/dist/framework/changes.d.ts +88 -0
- package/dist/framework/changes.js +246 -0
- package/dist/framework/class-names.d.ts +260 -0
- package/dist/framework/class-names.js +630 -0
- package/dist/framework/coalesce.d.ts +25 -0
- package/dist/framework/coalesce.js +60 -0
- package/dist/framework/config-op.d.ts +76 -0
- package/dist/framework/config-op.js +43 -0
- package/dist/framework/config-operation-kind.d.ts +14 -0
- package/dist/framework/config-operation-kind.js +14 -0
- package/dist/framework/config-ops.d.ts +34 -0
- package/dist/framework/config-ops.js +187 -0
- package/dist/framework/defineConfig.d.ts +196 -0
- package/dist/framework/defineConfig.js +100 -0
- package/dist/framework/defineDerivedEntity.d.ts +74 -0
- package/dist/framework/defineDerivedEntity.js +83 -0
- package/dist/framework/defineEntity.d.ts +318 -0
- package/dist/framework/defineEntity.js +183 -0
- package/dist/framework/defineSubEntity.d.ts +148 -0
- package/dist/framework/defineSubEntity.js +121 -0
- package/dist/framework/derived-mutations.d.ts +20 -0
- package/dist/framework/derived-mutations.js +38 -0
- package/dist/framework/entity-search.d.ts +29 -0
- package/dist/framework/entity-search.js +117 -0
- package/dist/framework/inline-sources.d.ts +49 -0
- package/dist/framework/inline-sources.js +388 -0
- package/dist/framework/layer-styles.d.ts +25 -0
- package/dist/framework/layer-styles.js +49 -0
- package/dist/framework/memo.d.ts +48 -0
- package/dist/framework/memo.js +84 -0
- package/dist/framework/overlay.d.ts +49 -0
- package/dist/framework/overlay.js +17 -0
- package/dist/framework/plan.d.ts +49 -0
- package/dist/framework/plan.js +73 -0
- package/dist/framework/projections.d.ts +480 -0
- package/dist/framework/projections.js +974 -0
- package/dist/framework/prop-surface.d.ts +132 -0
- package/dist/framework/prop-surface.js +278 -0
- package/dist/framework/ref-graph.d.ts +71 -0
- package/dist/framework/ref-graph.js +158 -0
- package/dist/framework/ref-integrity.d.ts +55 -0
- package/dist/framework/ref-integrity.js +171 -0
- package/dist/framework/registered.d.ts +95 -0
- package/dist/framework/registry-dir.d.ts +42 -0
- package/dist/framework/registry-dir.js +48 -0
- package/dist/framework/registry.d.ts +300 -0
- package/dist/framework/registry.js +104 -0
- package/dist/framework/rejection.d.ts +58 -0
- package/dist/framework/rejection.js +111 -0
- package/dist/framework/rename-inference.d.ts +26 -0
- package/dist/framework/rename-inference.js +50 -0
- package/dist/framework/render-spec.d.ts +296 -0
- package/dist/framework/render-spec.js +809 -0
- package/dist/framework/schema-version.d.ts +140 -0
- package/dist/framework/schema-version.js +214 -0
- package/dist/framework/schemas.d.ts +109 -0
- package/dist/framework/schemas.js +615 -0
- package/dist/framework/session.d.ts +196 -0
- package/dist/framework/session.js +367 -0
- package/dist/framework/signature.d.ts +15 -0
- package/dist/framework/signature.js +83 -0
- package/dist/framework/snapshot.d.ts +115 -0
- package/dist/framework/snapshot.js +277 -0
- package/dist/framework/source-integrity.d.ts +226 -0
- package/dist/framework/source-integrity.js +478 -0
- package/dist/framework/sources.d.ts +211 -0
- package/dist/framework/sources.js +89 -0
- package/dist/framework/utils/compiled-schema.d.ts +23 -0
- package/dist/framework/utils/compiled-schema.js +46 -0
- package/dist/framework/utils/content-key.d.ts +15 -0
- package/dist/framework/utils/content-key.js +33 -0
- package/dist/framework/utils/enumerated.d.ts +13 -0
- package/dist/framework/utils/enumerated.js +19 -0
- package/dist/framework/utils/field-path.d.ts +95 -0
- package/dist/framework/utils/field-path.js +136 -0
- package/dist/framework/utils/field-schema.d.ts +55 -0
- package/dist/framework/utils/field-schema.js +183 -0
- package/dist/framework/utils/group.d.ts +37 -0
- package/dist/framework/utils/group.js +13 -0
- package/dist/framework/utils/package-path.d.ts +37 -0
- package/dist/framework/utils/package-path.js +61 -0
- package/dist/framework/utils/refs.d.ts +194 -0
- package/dist/framework/utils/refs.js +403 -0
- package/dist/framework/validate-spec.d.ts +27 -0
- package/dist/framework/validate-spec.js +45 -0
- package/dist/framework/value-domain.d.ts +26 -0
- package/dist/framework/value-domain.js +202 -0
- package/dist/framework/views-facade.d.ts +15 -0
- package/dist/framework/views-facade.js +19 -0
- package/dist/index.d.ts +90 -42
- package/dist/index.js +86 -37
- package/dist/migrations/2.0.0/raw-css.d.ts +11 -0
- package/dist/migrations/2.0.0/raw-css.js +72 -0
- package/dist/migrations/2.0.0/v1-artifact.d.ts +1559 -0
- package/dist/migrations/2.0.0/v1-artifact.js +1018 -0
- package/dist/migrations/20260908171448_settings_as_kind.d.ts +22 -0
- package/dist/migrations/20260908171448_settings_as_kind.js +89 -0
- package/dist/migrations/20260908194245_visible_state_pointer.d.ts +19 -0
- package/dist/migrations/20260908194245_visible_state_pointer.js +115 -0
- package/dist/migrations/20260909183001_icon_knockout_variants.d.ts +18 -0
- package/dist/migrations/20260909183001_icon_knockout_variants.js +8 -0
- package/dist/migrations/20260910212453_linked_system_link_ops.d.ts +13 -0
- package/dist/migrations/20260910212453_linked_system_link_ops.js +8 -0
- package/dist/migrations/index.d.ts +2 -0
- package/dist/migrations/index.js +2 -0
- package/dist/react-native/style-keys.generated.d.ts +10 -0
- package/dist/react-native/style-keys.generated.js +167 -0
- package/dist/renderer/RendererErrorBoundary.d.ts +32 -5
- package/dist/renderer/RendererErrorBoundary.js +59 -10
- package/dist/renderer/UdsRenderer.d.ts +11 -10
- package/dist/renderer/UdsRenderer.js +1 -1
- package/dist/renderer/assetEntries.d.ts +37 -0
- package/dist/renderer/assetEntries.js +39 -0
- package/dist/renderer/assetRenderable.d.ts +14 -6
- package/dist/renderer/assetRenderable.js +8 -2
- package/dist/renderer/componentEntry.d.ts +58 -0
- package/dist/renderer/componentEntry.js +71 -0
- package/dist/renderer/icon-library.d.ts +20 -0
- package/dist/renderer/index.d.ts +7 -7
- package/dist/renderer/index.js +5 -5
- package/dist/renderer/primitives/SlotRenderer.d.ts +1 -1
- package/dist/renderer/primitives/SlotRenderer.js +1 -1
- package/dist/renderer/runtimeComponent.d.ts +33 -0
- package/dist/renderer/runtimeComponent.js +113 -0
- package/dist/renderer/spec-content.d.ts +43 -0
- package/dist/renderer/spec-content.js +95 -0
- package/dist/renderer/wrapRegistry.d.ts +22 -37
- package/dist/renderer/wrapRegistry.js +10 -20
- package/dist/renderer/wrappers/event-bridge.js +6 -5
- package/dist/renderer/wrappers/hex-normalize.js +6 -5
- package/dist/renderer/wrappers/html-aliases.d.ts +7 -2
- package/dist/renderer/wrappers/html-aliases.js +36 -19
- package/dist/renderer/wrappers/inline-styles.js +7 -6
- package/dist/spec/asset-jsx.d.ts +18 -5
- package/dist/spec/asset-jsx.js +27 -16
- package/dist/spec/collapse-text-labels.d.ts +5 -15
- package/dist/spec/collapse-text-labels.js +26 -19
- package/dist/spec/empty-node-slots.d.ts +56 -34
- package/dist/spec/empty-node-slots.js +87 -47
- package/dist/spec/index.d.ts +21 -10
- package/dist/spec/index.js +21 -10
- package/dist/spec/jsxToSpec.d.ts +14 -9
- package/dist/spec/jsxToSpec.js +20 -3
- package/dist/spec/preview-elements.d.ts +63 -0
- package/dist/spec/preview-elements.js +89 -0
- package/dist/spec/rewrite-refs.d.ts +58 -0
- package/dist/spec/rewrite-refs.js +250 -0
- package/dist/spec/specToJsx.js +18 -29
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +39 -52
- package/dist/AssetGroup.d.ts +0 -77
- package/dist/AssetGroup.js +0 -125
- package/dist/Component.d.ts +0 -333
- package/dist/Component.js +0 -1061
- package/dist/ComponentGroup.d.ts +0 -22
- package/dist/ComponentGroup.js +0 -51
- package/dist/CompositeStyle.d.ts +0 -30
- package/dist/CompositeStyle.js +0 -59
- package/dist/Config.d.ts +0 -528
- package/dist/Config.js +0 -1712
- package/dist/Mode.d.ts +0 -41
- package/dist/Mode.js +0 -81
- package/dist/Modifier.d.ts +0 -51
- package/dist/Modifier.js +0 -97
- package/dist/MotionDef.d.ts +0 -81
- package/dist/MotionDef.js +0 -212
- package/dist/Props.d.ts +0 -332
- package/dist/Props.js +0 -35
- package/dist/Provider.d.ts +0 -20
- package/dist/Provider.js +0 -14
- package/dist/StyleProp.d.ts +0 -145
- package/dist/StyleProp.js +0 -239
- package/dist/Token.d.ts +0 -76
- package/dist/Token.js +0 -133
- package/dist/TokenGroup.d.ts +0 -33
- package/dist/TokenGroup.js +0 -69
- package/dist/asset-kind.d.ts +0 -55
- package/dist/asset-kind.js +0 -29
- package/dist/asset-value.d.ts +0 -23
- package/dist/asset-value.js +0 -40
- package/dist/brands.d.ts +0 -30
- package/dist/brands.js +0 -20
- package/dist/captureCallerPath.d.ts +0 -48
- package/dist/captureCallerPath.js +0 -95
- package/dist/colorExpressions.d.ts +0 -131
- package/dist/colorExpressions.js +0 -148
- package/dist/component-referrers.d.ts +0 -30
- package/dist/component-referrers.js +0 -40
- package/dist/config-diagnostics.d.ts +0 -21
- package/dist/config-diagnostics.js +0 -12
- package/dist/defineAssetGroup.d.ts +0 -200
- package/dist/defineAssetGroup.js +0 -323
- package/dist/defineProvider.d.ts +0 -29
- package/dist/defineProvider.js +0 -60
- package/dist/element-marker.d.ts +0 -63
- package/dist/element-marker.js +0 -113
- package/dist/entity-utils.d.ts +0 -56
- package/dist/entity-utils.js +0 -105
- package/dist/extension.d.ts +0 -55
- package/dist/extension.js +0 -214
- package/dist/factories.d.ts +0 -863
- package/dist/factories.js +0 -475
- package/dist/font-face.d.ts +0 -25
- package/dist/font-face.js +0 -72
- package/dist/foreign-component-name.d.ts +0 -21
- package/dist/foreign-component-name.js +0 -42
- package/dist/interpolate.d.ts +0 -20
- package/dist/interpolate.js +0 -10
- package/dist/jsx/__fixtures__/cross-component-preview.d.ts +0 -3
- package/dist/jsx/__fixtures__/cross-component-preview.js +0 -15
- package/dist/jsx/jsx-dev-runtime.d.ts +0 -15
- package/dist/jsx/jsx-dev-runtime.js +0 -11
- package/dist/jsx/jsx-runtime.d.ts +0 -48
- package/dist/jsx/jsx-runtime.js +0 -305
- package/dist/linked-system-pins.d.ts +0 -30
- package/dist/linked-system-pins.js +0 -45
- package/dist/linkedNodePrefixes.d.ts +0 -73
- package/dist/linkedNodePrefixes.js +0 -99
- package/dist/markers.d.ts +0 -235
- package/dist/markers.js +0 -70
- package/dist/motion-constants.d.ts +0 -37
- package/dist/motion-constants.js +0 -61
- package/dist/native/NativeConfig.d.ts +0 -56
- package/dist/native/NativeConfig.js +0 -162
- package/dist/native/assets.d.ts +0 -20
- package/dist/native/assets.js +0 -17
- package/dist/native/components.d.ts +0 -139
- package/dist/native/components.js +0 -67
- package/dist/native/index.d.ts +0 -18
- package/dist/native/index.js +0 -17
- package/dist/native/modes.d.ts +0 -10
- package/dist/native/modes.js +0 -11
- package/dist/native/types.d.ts +0 -95
- package/dist/native/types.js +0 -0
- package/dist/native/validation.d.ts +0 -8
- package/dist/native/validation.js +0 -885
- package/dist/native/values.d.ts +0 -7
- package/dist/native/values.js +0 -15
- package/dist/native.d.ts +0 -12
- package/dist/native.js +0 -10
- package/dist/refs.d.ts +0 -204
- package/dist/refs.js +0 -129
- package/dist/registry-aliases.d.ts +0 -33
- package/dist/registry-aliases.js +0 -35
- package/dist/registry-dir.d.ts +0 -22
- package/dist/registry-dir.js +0 -10
- package/dist/renderer/makeRegistry.d.ts +0 -34
- package/dist/renderer/makeRegistry.js +0 -52
- package/dist/renderer/makeUdsRenderer.d.ts +0 -13
- package/dist/renderer/makeUdsRenderer.js +0 -51
- package/dist/renderer/wrappers/component-slots.d.ts +0 -41
- package/dist/renderer/wrappers/component-slots.js +0 -66
- package/dist/renderer/wrappers/slot-resolution.d.ts +0 -25
- package/dist/renderer/wrappers/slot-resolution.js +0 -68
- package/dist/renderer/wrappers/void-elements.d.ts +0 -37
- package/dist/renderer/wrappers/void-elements.js +0 -40
- package/dist/spec/layer-props.d.ts +0 -52
- package/dist/spec/layer-props.js +0 -149
- package/dist/spec/preview-controls.d.ts +0 -44
- package/dist/spec/preview-controls.js +0 -139
- package/dist/spec/slot-refs.d.ts +0 -39
- package/dist/spec/slot-refs.js +0 -56
- package/dist/token-override-rows.d.ts +0 -68
- package/dist/token-override-rows.js +0 -233
- package/dist/tokenValueType.d.ts +0 -34
- package/dist/tokenValueType.js +0 -138
- package/dist/types/css-properties.d.ts +0 -233
- package/dist/types/css-properties.js +0 -14
- package/dist/types/css-property-keywords.d.ts +0 -156
- package/dist/types/css-property-keywords.js +0 -616
- package/dist/types/css-values.d.ts +0 -63
- package/dist/types/css-values.js +0 -16
- package/dist/types.d.ts +0 -1138
- package/dist/types.js +0 -12
- package/dist/units.d.ts +0 -14
- package/dist/units.js +0 -16
- package/dist/utils/index.d.ts +0 -4
- package/dist/utils/index.js +0 -4
package/dist/factories.js
DELETED
|
@@ -1,475 +0,0 @@
|
|
|
1
|
-
import { attachSourcePath, captureCallerPath } from "./captureCallerPath.js";
|
|
2
|
-
import { composite, styleProp, tag, token } from "./refs.js";
|
|
3
|
-
import { darken, lighten } from "./colorExpressions.js";
|
|
4
|
-
import "./defineProvider.js";
|
|
5
|
-
//#region src/factories.ts
|
|
6
|
-
/** @internal Platform-neutral implementation behind web and native factories. */
|
|
7
|
-
function defineTokenGroupValue(t) {
|
|
8
|
-
const out = {
|
|
9
|
-
tokens: t,
|
|
10
|
-
metadata(meta) {
|
|
11
|
-
if (meta.label !== void 0) out.label = meta.label;
|
|
12
|
-
if (meta.description !== void 0) out.description = meta.description;
|
|
13
|
-
return out;
|
|
14
|
-
}
|
|
15
|
-
};
|
|
16
|
-
attachSourcePath(out, captureCallerPath());
|
|
17
|
-
Object.defineProperty(out, "metadata", {
|
|
18
|
-
enumerable: false,
|
|
19
|
-
configurable: true,
|
|
20
|
-
writable: true,
|
|
21
|
-
value: out.metadata
|
|
22
|
-
});
|
|
23
|
-
return out;
|
|
24
|
-
}
|
|
25
|
-
function defineTokenGroup(t) {
|
|
26
|
-
return defineTokenGroupValue(t);
|
|
27
|
-
}
|
|
28
|
-
function defineModifier(t) {
|
|
29
|
-
return attachSourcePath(t, captureCallerPath());
|
|
30
|
-
}
|
|
31
|
-
function defineMode(t) {
|
|
32
|
-
return attachSourcePath(t, captureCallerPath());
|
|
33
|
-
}
|
|
34
|
-
function defineCompositeStyle(t) {
|
|
35
|
-
return attachSourcePath(t, captureCallerPath());
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Author a motion preset. Accepts the same `{ runtime, ... }` shape passed to
|
|
39
|
-
* `.registerMotion({...})`. Author-side `label` / `description` attach via the
|
|
40
|
-
* chained `.metadata({...})`, mirroring `defineTokenGroup`.
|
|
41
|
-
*/
|
|
42
|
-
function defineMotion(t) {
|
|
43
|
-
const out = attachSourcePath(t, captureCallerPath());
|
|
44
|
-
Object.defineProperty(out, "metadata", {
|
|
45
|
-
enumerable: false,
|
|
46
|
-
configurable: true,
|
|
47
|
-
writable: true,
|
|
48
|
-
value(meta) {
|
|
49
|
-
if (meta.label !== void 0) out.label = meta.label;
|
|
50
|
-
if (meta.description !== void 0) out.description = meta.description;
|
|
51
|
-
return out;
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
return out;
|
|
55
|
-
}
|
|
56
|
-
function defineComponentGroup(t) {
|
|
57
|
-
return attachSourcePath(t, captureCallerPath());
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Author a style-prop spec. `P` is inferred from `cssProperty` so the
|
|
61
|
-
* `values` array narrows against the chosen CSS property's accepted
|
|
62
|
-
* keyword union (`'transparent'` is OK for `border-color`, errors for
|
|
63
|
-
* `padding`). For custom properties (`--foo`), `values` accepts open
|
|
64
|
-
* strings — `cssType` constrains the runtime value space instead.
|
|
65
|
-
*
|
|
66
|
-
* Returns the spec with a non-enumerable `.metadata({...})` chain;
|
|
67
|
-
* the chain merges the supplied bag into `spec.metadata` so multiple
|
|
68
|
-
* `.metadata({...})` calls accumulate.
|
|
69
|
-
*/
|
|
70
|
-
function defineStyleProp(spec) {
|
|
71
|
-
const fieldMetadata = spec.metadata;
|
|
72
|
-
const attached = attachSourcePath(spec, captureCallerPath());
|
|
73
|
-
Object.defineProperty(attached, "metadata", {
|
|
74
|
-
enumerable: false,
|
|
75
|
-
configurable: true,
|
|
76
|
-
writable: true,
|
|
77
|
-
value(meta) {
|
|
78
|
-
attached.metadata = {
|
|
79
|
-
...attached.metadata ?? {},
|
|
80
|
-
...meta
|
|
81
|
-
};
|
|
82
|
-
return attached;
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
if (fieldMetadata && typeof fieldMetadata === "object") attached.metadata(fieldMetadata);
|
|
86
|
-
Object.defineProperty(attached, "withOpacity", {
|
|
87
|
-
enumerable: false,
|
|
88
|
-
configurable: true,
|
|
89
|
-
writable: true,
|
|
90
|
-
value(opacitySpec) {
|
|
91
|
-
attached.opacityPair = {
|
|
92
|
-
as: opacitySpec.as,
|
|
93
|
-
values: opacitySpec.values,
|
|
94
|
-
separator: opacitySpec.separator ?? "_",
|
|
95
|
-
ref: opacitySpec.as
|
|
96
|
-
};
|
|
97
|
-
return attached;
|
|
98
|
-
}
|
|
99
|
-
});
|
|
100
|
-
return attached;
|
|
101
|
-
}
|
|
102
|
-
function slot(pathOrOptions, options) {
|
|
103
|
-
let marker;
|
|
104
|
-
const openOptions = typeof pathOrOptions === "object" ? pathOrOptions : void 0;
|
|
105
|
-
const pathOrLayer = typeof pathOrOptions === "string" ? pathOrOptions : void 0;
|
|
106
|
-
const valueType = openOptions?.type ?? options?.type;
|
|
107
|
-
if (pathOrLayer === void 0) marker = { __kind: "slot" };
|
|
108
|
-
else if (options?.prop !== void 0) marker = {
|
|
109
|
-
__kind: "slot",
|
|
110
|
-
layer: pathOrLayer,
|
|
111
|
-
layerProp: options.prop
|
|
112
|
-
};
|
|
113
|
-
else {
|
|
114
|
-
const slash = pathOrLayer.indexOf("/");
|
|
115
|
-
marker = slash === -1 ? {
|
|
116
|
-
__kind: "slot",
|
|
117
|
-
layer: pathOrLayer,
|
|
118
|
-
layerProp: "children"
|
|
119
|
-
} : {
|
|
120
|
-
__kind: "slot",
|
|
121
|
-
layer: pathOrLayer.slice(0, slash),
|
|
122
|
-
layerProp: pathOrLayer.slice(slash + 1)
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
if (valueType !== void 0) Object.defineProperty(marker, "__valueType", {
|
|
126
|
-
enumerable: true,
|
|
127
|
-
configurable: true,
|
|
128
|
-
writable: true,
|
|
129
|
-
value: valueType
|
|
130
|
-
});
|
|
131
|
-
Object.defineProperty(marker, "required", {
|
|
132
|
-
enumerable: false,
|
|
133
|
-
configurable: true,
|
|
134
|
-
writable: true,
|
|
135
|
-
value() {
|
|
136
|
-
Object.defineProperty(marker, "__required", {
|
|
137
|
-
enumerable: true,
|
|
138
|
-
configurable: true,
|
|
139
|
-
writable: true,
|
|
140
|
-
value: true
|
|
141
|
-
});
|
|
142
|
-
return marker;
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
Object.defineProperty(marker, "accepts", {
|
|
146
|
-
enumerable: false,
|
|
147
|
-
configurable: true,
|
|
148
|
-
writable: true,
|
|
149
|
-
value(component) {
|
|
150
|
-
Object.defineProperty(marker, "__accepts", {
|
|
151
|
-
enumerable: true,
|
|
152
|
-
configurable: true,
|
|
153
|
-
writable: true,
|
|
154
|
-
value: Array.isArray(component) ? component : [component]
|
|
155
|
-
});
|
|
156
|
-
return marker;
|
|
157
|
-
}
|
|
158
|
-
});
|
|
159
|
-
Object.defineProperty(marker, "transform", {
|
|
160
|
-
enumerable: false,
|
|
161
|
-
configurable: true,
|
|
162
|
-
writable: true,
|
|
163
|
-
value(fn) {
|
|
164
|
-
Object.defineProperty(marker, "__transform", {
|
|
165
|
-
enumerable: true,
|
|
166
|
-
configurable: true,
|
|
167
|
-
writable: true,
|
|
168
|
-
value: fn
|
|
169
|
-
});
|
|
170
|
-
return marker;
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
return marker;
|
|
174
|
-
}
|
|
175
|
-
/**
|
|
176
|
-
* Attach a chainable `.required()` method to a marker that flips
|
|
177
|
-
* `__required: true` and returns the same marker reference (so further
|
|
178
|
-
* chaining still works).
|
|
179
|
-
*/
|
|
180
|
-
function attachRequired(marker) {
|
|
181
|
-
Object.defineProperty(marker, "required", {
|
|
182
|
-
enumerable: false,
|
|
183
|
-
configurable: true,
|
|
184
|
-
writable: true,
|
|
185
|
-
value() {
|
|
186
|
-
Object.defineProperty(marker, "__required", {
|
|
187
|
-
enumerable: true,
|
|
188
|
-
configurable: true,
|
|
189
|
-
writable: true,
|
|
190
|
-
value: true
|
|
191
|
-
});
|
|
192
|
-
return marker;
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
return marker;
|
|
196
|
-
}
|
|
197
|
-
/**
|
|
198
|
-
* Boolean-prop binding. Codegen emits the prop as `<name>?: boolean`
|
|
199
|
-
* and routes presence/absence into a per-layer `data-${name}` attribute
|
|
200
|
-
* the runtime selects on. Mirrors the old `@yahoo/uds-create-config` `helpers.boolean()`.
|
|
201
|
-
*
|
|
202
|
-
* The optional `values` argument carries per-state per-layer styles
|
|
203
|
-
* (`{ true: { root: {...} }, false: { root: {...} } }`) — codegen emits
|
|
204
|
-
* one variant CSS class per layer per state, same as `variant({...})`.
|
|
205
|
-
*
|
|
206
|
-
* `.required()` flips the prop to mandatory at JSX call sites.
|
|
207
|
-
*/
|
|
208
|
-
function boolean(values) {
|
|
209
|
-
return attachRequired(values === void 0 ? { __kind: "boolean" } : {
|
|
210
|
-
__kind: "boolean",
|
|
211
|
-
values
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* `asChild()` — opt a **single-layer** component into the polymorphic-child
|
|
216
|
-
* Slot pattern. Declare it as a prop (`props: { asChild: asChild() }`); when a
|
|
217
|
-
* consumer passes `asChild`, the component merges its computed props (className,
|
|
218
|
-
* style props, handlers) onto its single child element instead of rendering its
|
|
219
|
-
* own tag — codegen wires the `_renderAsChild` Slot. Typed as a boolean prop
|
|
220
|
-
* (`asChild?: boolean`), so no extra type plumbing.
|
|
221
|
-
*
|
|
222
|
-
* Opt-in only and single-layer only: multi-layer composites render multiple
|
|
223
|
-
* children and can't slot a single child, so the codegen Slot branch is emitted
|
|
224
|
-
* solely for inline single-layer FCs.
|
|
225
|
-
*/
|
|
226
|
-
function asChild() {
|
|
227
|
-
return {
|
|
228
|
-
__kind: "boolean",
|
|
229
|
-
__asChild: true
|
|
230
|
-
};
|
|
231
|
-
}
|
|
232
|
-
/**
|
|
233
|
-
* Cross-layer style override — `_hover: layer('close', { opacity: 1 })`
|
|
234
|
-
* declares "when this layer is hovered, apply these styles to the
|
|
235
|
-
* named layer". Codegen emits a descendant-combinator rule pointing
|
|
236
|
-
* from the source layer's selector to the target layer's selector.
|
|
237
|
-
* Mirrors the old `@yahoo/uds-create-config` `helpers.layer()`.
|
|
238
|
-
*/
|
|
239
|
-
function layer(layerName, styles) {
|
|
240
|
-
return {
|
|
241
|
-
__kind: "layer",
|
|
242
|
-
layer: layerName,
|
|
243
|
-
styles
|
|
244
|
-
};
|
|
245
|
-
}
|
|
246
|
-
function variant(values, defaultValue) {
|
|
247
|
-
return attachRequired(defaultValue === void 0 ? {
|
|
248
|
-
__kind: "variant",
|
|
249
|
-
values
|
|
250
|
-
} : {
|
|
251
|
-
__kind: "variant",
|
|
252
|
-
values,
|
|
253
|
-
default: defaultValue
|
|
254
|
-
});
|
|
255
|
-
}
|
|
256
|
-
/**
|
|
257
|
-
* Wide-string prop binding. Codegen emits the prop as `<name>?: string`
|
|
258
|
-
* (or required when chained with `.required()`). No CSS effect — use
|
|
259
|
-
* this for free-form text props (URLs, labels). When you want a
|
|
260
|
-
* constrained list of accepted strings, reach for the array form of
|
|
261
|
-
* `variant(...)` instead. Chain `.toggle()` when the prop reads as an on/off
|
|
262
|
-
* feature (e.g. `tooltip`) — editors show a switch that reveals the field.
|
|
263
|
-
*/
|
|
264
|
-
function string() {
|
|
265
|
-
const marker = attachRequired({ __kind: "string" });
|
|
266
|
-
Object.defineProperty(marker, "toggle", {
|
|
267
|
-
enumerable: false,
|
|
268
|
-
configurable: true,
|
|
269
|
-
writable: true,
|
|
270
|
-
value() {
|
|
271
|
-
Object.defineProperty(marker, "__toggle", {
|
|
272
|
-
enumerable: true,
|
|
273
|
-
configurable: true,
|
|
274
|
-
writable: true,
|
|
275
|
-
value: true
|
|
276
|
-
});
|
|
277
|
-
return marker;
|
|
278
|
-
}
|
|
279
|
-
});
|
|
280
|
-
return marker;
|
|
281
|
-
}
|
|
282
|
-
/**
|
|
283
|
-
* Wide-number prop binding. Codegen emits the prop as `<name>?: number`
|
|
284
|
-
* (or required when chained with `.required()`). No CSS effect — use
|
|
285
|
-
* this for free-form numeric props (tabIndex, count). When you want a
|
|
286
|
-
* constrained list of accepted numbers, reach for the array form of
|
|
287
|
-
* `variant(...)` instead.
|
|
288
|
-
*/
|
|
289
|
-
function number() {
|
|
290
|
-
return attachRequired({ __kind: "number" });
|
|
291
|
-
}
|
|
292
|
-
/**
|
|
293
|
-
* JS-motion prop binding. Emits `<name>?: SlotMotion | MotionName` — either an
|
|
294
|
-
* inline framer-motion config object (`{ initial, animate, whileHover,
|
|
295
|
-
* transition, … }`) or the name of a `registerMotion({...})` preset
|
|
296
|
-
* (`motion="fadeIn"`; `MotionName` narrows to the registered names in an
|
|
297
|
-
* augmented config, else `string`). The loader routes both through
|
|
298
|
-
* `_renderWithMotion` at runtime (preset name → registered JS/CSS motion;
|
|
299
|
-
* object → inline config), so
|
|
300
|
-
* it produces no CSS of its own — this is the JS-animation counterpart to the
|
|
301
|
-
* CSS `animation`/`transition` style props, not a `styleProp`. Chain
|
|
302
|
-
* `.required()` to force callers to pass it.
|
|
303
|
-
*/
|
|
304
|
-
function motion() {
|
|
305
|
-
return attachRequired({ __kind: "motion" });
|
|
306
|
-
}
|
|
307
|
-
/**
|
|
308
|
-
* Axis marker for `.preview({ matrix: { columns, rows } })`. The
|
|
309
|
-
* `kind` field discriminates between prop axes (varies a JSX prop
|
|
310
|
-
* across the grid) and modifier axes (toggles a `_${name}` modifier
|
|
311
|
-
* across the grid). Studio reads these to build the canvas preview;
|
|
312
|
-
* codegen round-trips them verbatim through `Component.preview`.
|
|
313
|
-
*
|
|
314
|
-
* `.nest(child)` builds a 2-D nesting — the outer axis steps once
|
|
315
|
-
* per child-axis sweep. Mirrors the old `@yahoo/uds-create-config` matrix shape.
|
|
316
|
-
*/
|
|
317
|
-
function makePreviewAxis(source, nested) {
|
|
318
|
-
return {
|
|
319
|
-
__kind: "previewAxis",
|
|
320
|
-
...source,
|
|
321
|
-
...nested !== void 0 ? { nested } : {},
|
|
322
|
-
nest(child) {
|
|
323
|
-
return makePreviewAxis(source, child);
|
|
324
|
-
}
|
|
325
|
-
};
|
|
326
|
-
}
|
|
327
|
-
const configHelpers = {
|
|
328
|
-
slot,
|
|
329
|
-
variant,
|
|
330
|
-
boolean,
|
|
331
|
-
asChild,
|
|
332
|
-
string,
|
|
333
|
-
number,
|
|
334
|
-
motion,
|
|
335
|
-
layer,
|
|
336
|
-
composite,
|
|
337
|
-
styleProp,
|
|
338
|
-
token,
|
|
339
|
-
darken,
|
|
340
|
-
lighten
|
|
341
|
-
};
|
|
342
|
-
/**
|
|
343
|
-
* Normalize the `props()` argument to a rule list: a flat bag becomes a
|
|
344
|
-
* single unconditional rule; a rule array passes through.
|
|
345
|
-
*/
|
|
346
|
-
function normalizePropsRules(arg) {
|
|
347
|
-
return Array.isArray(arg) ? arg : [{ props: arg }];
|
|
348
|
-
}
|
|
349
|
-
const previewHelpers = {
|
|
350
|
-
prop: (name) => makePreviewAxis({
|
|
351
|
-
kind: "prop",
|
|
352
|
-
prop: name
|
|
353
|
-
}),
|
|
354
|
-
modifier: (name) => makePreviewAxis({
|
|
355
|
-
kind: "modifier",
|
|
356
|
-
modifier: name
|
|
357
|
-
}),
|
|
358
|
-
props: (arg) => makePreviewAxis({
|
|
359
|
-
kind: "props",
|
|
360
|
-
rules: normalizePropsRules(arg)
|
|
361
|
-
}),
|
|
362
|
-
states: (values) => makePreviewAxis({
|
|
363
|
-
kind: "stateAxis",
|
|
364
|
-
states: values
|
|
365
|
-
})
|
|
366
|
-
};
|
|
367
|
-
/**
|
|
368
|
-
* Fields merged shallowly when `.config(cb)` runs — each subkey from a
|
|
369
|
-
* later call overlays the same subkey on the seed (so `defaultProps:
|
|
370
|
-
* { as: 'path' }` doesn't drop Box's inherited defaults). Other fields
|
|
371
|
-
* (`compoundProps`, `motion` scalar) overwrite.
|
|
372
|
-
*/
|
|
373
|
-
const MERGEABLE_NESTED_FIELDS = new Set([
|
|
374
|
-
"props",
|
|
375
|
-
"base",
|
|
376
|
-
"defaultProps",
|
|
377
|
-
"motion"
|
|
378
|
-
]);
|
|
379
|
-
function mergeConfigIntoSeed(seed, addition) {
|
|
380
|
-
for (const [key, value] of Object.entries(addition)) {
|
|
381
|
-
if (MERGEABLE_NESTED_FIELDS.has(key) && typeof value === "object" && value !== null) {
|
|
382
|
-
const existing = seed[key];
|
|
383
|
-
const base = typeof existing === "object" && existing !== null ? existing : {};
|
|
384
|
-
if (key === "base") {
|
|
385
|
-
const merged = { ...base };
|
|
386
|
-
for (const [layerName, layerStyles] of Object.entries(value)) {
|
|
387
|
-
const prevLayer = merged[layerName];
|
|
388
|
-
merged[layerName] = typeof prevLayer === "object" && prevLayer !== null && typeof layerStyles === "object" && layerStyles !== null ? {
|
|
389
|
-
...prevLayer,
|
|
390
|
-
...layerStyles
|
|
391
|
-
} : layerStyles;
|
|
392
|
-
}
|
|
393
|
-
seed[key] = merged;
|
|
394
|
-
continue;
|
|
395
|
-
}
|
|
396
|
-
seed[key] = {
|
|
397
|
-
...base,
|
|
398
|
-
...value
|
|
399
|
-
};
|
|
400
|
-
continue;
|
|
401
|
-
}
|
|
402
|
-
seed[key] = value;
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
function isComponentBuilderValue(value) {
|
|
406
|
-
return typeof value === "object" && value !== null && typeof value.config === "function";
|
|
407
|
-
}
|
|
408
|
-
function attachChainMethods(seed) {
|
|
409
|
-
const def = (key, value) => {
|
|
410
|
-
Object.defineProperty(seed, key, {
|
|
411
|
-
enumerable: false,
|
|
412
|
-
configurable: true,
|
|
413
|
-
writable: true,
|
|
414
|
-
value
|
|
415
|
-
});
|
|
416
|
-
};
|
|
417
|
-
def("config", function configMethod(cb) {
|
|
418
|
-
mergeConfigIntoSeed(seed, cb(configHelpers));
|
|
419
|
-
return seed;
|
|
420
|
-
});
|
|
421
|
-
def("render", function renderMethod(fn) {
|
|
422
|
-
def("__renderFn", fn);
|
|
423
|
-
def("__hasRenderFn", true);
|
|
424
|
-
return seed;
|
|
425
|
-
});
|
|
426
|
-
def("renderCanvas", function renderCanvasMethod(fn) {
|
|
427
|
-
def("__renderCanvasFn", fn);
|
|
428
|
-
def("__hasRenderCanvasFn", true);
|
|
429
|
-
return seed;
|
|
430
|
-
});
|
|
431
|
-
def("preview", function previewMethod(spec) {
|
|
432
|
-
def("__preview", typeof spec === "function" ? spec(previewHelpers) : spec);
|
|
433
|
-
return seed;
|
|
434
|
-
});
|
|
435
|
-
def("subcomponents", function subcomponentsMethod(children) {
|
|
436
|
-
for (const [childName, child] of Object.entries(children)) if (typeof child !== "object" || child === null || typeof child.layers !== "object") throw new Error(`subcomponents: entry "${childName}" is not a component definition`);
|
|
437
|
-
def("__subcomponents", children);
|
|
438
|
-
return seed;
|
|
439
|
-
});
|
|
440
|
-
def("metadata", function metadataMethod(meta) {
|
|
441
|
-
seed.metadata = {
|
|
442
|
-
...seed.metadata ?? {},
|
|
443
|
-
...meta
|
|
444
|
-
};
|
|
445
|
-
return seed;
|
|
446
|
-
});
|
|
447
|
-
return seed;
|
|
448
|
-
}
|
|
449
|
-
function defineComponentImpl(arg) {
|
|
450
|
-
let seed;
|
|
451
|
-
let extendsFromRef;
|
|
452
|
-
if (typeof arg === "string") seed = { layers: { root: tag(arg) } };
|
|
453
|
-
else if (isComponentBuilderValue(arg)) {
|
|
454
|
-
const source = arg;
|
|
455
|
-
seed = { ...source };
|
|
456
|
-
extendsFromRef = source;
|
|
457
|
-
} else seed = arg;
|
|
458
|
-
attachSourcePath(seed, captureCallerPath());
|
|
459
|
-
attachChainMethods(seed);
|
|
460
|
-
if (extendsFromRef !== void 0) Object.defineProperty(seed, "__extendsFrom", {
|
|
461
|
-
enumerable: false,
|
|
462
|
-
configurable: true,
|
|
463
|
-
writable: true,
|
|
464
|
-
value: extendsFromRef
|
|
465
|
-
});
|
|
466
|
-
return seed;
|
|
467
|
-
}
|
|
468
|
-
defineComponentImpl.layers = function layersEntry(layers) {
|
|
469
|
-
const seed = { layers };
|
|
470
|
-
attachSourcePath(seed, captureCallerPath());
|
|
471
|
-
return attachChainMethods(seed);
|
|
472
|
-
};
|
|
473
|
-
const defineComponent = defineComponentImpl;
|
|
474
|
-
//#endregion
|
|
475
|
-
export { asChild, boolean, defineComponent, defineComponentGroup, defineCompositeStyle, defineMode, defineModifier, defineMotion, defineStyleProp, defineTokenGroup, defineTokenGroupValue, motion, number, slot, string, variant };
|
package/dist/font-face.d.ts
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { FontAssetMember } from "./types.js";
|
|
2
|
-
import { Config } from "./Config.js";
|
|
3
|
-
|
|
4
|
-
//#region src/font-face.d.ts
|
|
5
|
-
/**
|
|
6
|
-
* Derive the `@font-face` block(s) for one font member — one block per
|
|
7
|
-
* declaration. Declarations missing a URL are skipped. Returns an empty
|
|
8
|
-
* string when the member yields no usable faces.
|
|
9
|
-
*/
|
|
10
|
-
declare function deriveFontFaceCss(member: FontAssetMember): string;
|
|
11
|
-
/**
|
|
12
|
-
* Family names already declared via `@font-face` in the config's raw CSS
|
|
13
|
-
* (`includeCss`). Used to enforce the single-path invariant: a family loaded
|
|
14
|
-
* that way must not be re-declared from the asset-group path.
|
|
15
|
-
*/
|
|
16
|
-
declare function familiesInRawCss(rawCss: readonly string[]): Set<string>;
|
|
17
|
-
/**
|
|
18
|
-
* Derive the `@font-face` stylesheet for every registered font member across
|
|
19
|
-
* all font-class asset groups, excluding any family already declared in the
|
|
20
|
-
* config's raw CSS (single-path invariant). Returns the stylesheet body, or an
|
|
21
|
-
* empty string when there's nothing to inject.
|
|
22
|
-
*/
|
|
23
|
-
declare function collectFontFaceCss(config: Config): string;
|
|
24
|
-
//#endregion
|
|
25
|
-
export { collectFontFaceCss, deriveFontFaceCss, familiesInRawCss };
|
package/dist/font-face.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
//#region src/font-face.ts
|
|
2
|
-
function str(value) {
|
|
3
|
-
return typeof value === "string" ? value : "";
|
|
4
|
-
}
|
|
5
|
-
/** The declaration's font file URL — real data uses `url`, older fixtures `src`. */
|
|
6
|
-
function declarationUrl(declaration) {
|
|
7
|
-
return str(declaration.url) || str(declaration.src);
|
|
8
|
-
}
|
|
9
|
-
function srcValue(url, format, isVariableFont) {
|
|
10
|
-
return isVariableFont ? `url('${url}') format("woff2 supports variations"), url('${url}') format('woff2-variations')` : `url('${url}') format('${format}')`;
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* Derive the `@font-face` block(s) for one font member — one block per
|
|
14
|
-
* declaration. Declarations missing a URL are skipped. Returns an empty
|
|
15
|
-
* string when the member yields no usable faces.
|
|
16
|
-
*/
|
|
17
|
-
function deriveFontFaceCss(member) {
|
|
18
|
-
const isVariableFont = member.isVariableFont === true;
|
|
19
|
-
const blocks = [];
|
|
20
|
-
for (const declaration of member.declarations) {
|
|
21
|
-
const url = declarationUrl(declaration);
|
|
22
|
-
if (!url) continue;
|
|
23
|
-
const lines = [` font-family: "${member.fontFamily}";`];
|
|
24
|
-
const style = str(declaration.style);
|
|
25
|
-
if (style) lines.push(` font-style: ${style};`);
|
|
26
|
-
const weight = declaration.weight;
|
|
27
|
-
if (typeof weight === "string" || typeof weight === "number") lines.push(` font-weight: ${weight};`);
|
|
28
|
-
lines.push(" font-display: swap;");
|
|
29
|
-
const format = str(declaration.format) || "woff2";
|
|
30
|
-
lines.push(` src: ${srcValue(url, format, isVariableFont)};`);
|
|
31
|
-
blocks.push(`@font-face {\n${lines.join("\n")}\n}`);
|
|
32
|
-
}
|
|
33
|
-
return blocks.join("\n\n");
|
|
34
|
-
}
|
|
35
|
-
const FONT_FACE_BLOCK = /@font-face\s*\{([^}]*)\}/g;
|
|
36
|
-
const FONT_FAMILY_DECL = /font-family\s*:\s*["']?([^;"']+)/;
|
|
37
|
-
/**
|
|
38
|
-
* Family names already declared via `@font-face` in the config's raw CSS
|
|
39
|
-
* (`includeCss`). Used to enforce the single-path invariant: a family loaded
|
|
40
|
-
* that way must not be re-declared from the asset-group path.
|
|
41
|
-
*/
|
|
42
|
-
function familiesInRawCss(rawCss) {
|
|
43
|
-
const families = /* @__PURE__ */ new Set();
|
|
44
|
-
const joined = rawCss.join("\n");
|
|
45
|
-
for (const [, body] of joined.matchAll(FONT_FACE_BLOCK)) {
|
|
46
|
-
const family = body.match(FONT_FAMILY_DECL)?.[1]?.trim();
|
|
47
|
-
if (family) families.add(family);
|
|
48
|
-
}
|
|
49
|
-
return families;
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Derive the `@font-face` stylesheet for every registered font member across
|
|
53
|
-
* all font-class asset groups, excluding any family already declared in the
|
|
54
|
-
* config's raw CSS (single-path invariant). Returns the stylesheet body, or an
|
|
55
|
-
* empty string when there's nothing to inject.
|
|
56
|
-
*/
|
|
57
|
-
function collectFontFaceCss(config) {
|
|
58
|
-
const excluded = familiesInRawCss(config.rawCss);
|
|
59
|
-
const blocks = [];
|
|
60
|
-
for (const group of config.assetGroups.values()) {
|
|
61
|
-
if (group.assetKind !== "font" || !group.members) continue;
|
|
62
|
-
for (const member of Object.values(group.members)) {
|
|
63
|
-
const font = member;
|
|
64
|
-
if (excluded.has(font.fontFamily)) continue;
|
|
65
|
-
const css = deriveFontFaceCss(font);
|
|
66
|
-
if (css) blocks.push(css);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
return blocks.join("\n\n");
|
|
70
|
-
}
|
|
71
|
-
//#endregion
|
|
72
|
-
export { collectFontFaceCss, deriveFontFaceCss, familiesInRawCss };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Reserved registry namespace for third-party leaf components — the prefix in a
|
|
3
|
-
* `foreign:<displayName>` key. Not a peer design-system namespace (those are
|
|
4
|
-
* meaningful disambiguation); it marks "not a UDS component," so display
|
|
5
|
-
* surfaces strip it to the bare name.
|
|
6
|
-
*/
|
|
7
|
-
export declare const FOREIGN_NAMESPACE = "foreign";
|
|
8
|
-
/**
|
|
9
|
-
* Display name for a `forwardRef`/`memo` component object — preferring its own
|
|
10
|
-
* `displayName`, then the wrapped function's name. Returns `null` for anything
|
|
11
|
-
* that isn't one of those wrappers, and for an anonymous wrapper with no
|
|
12
|
-
* resolvable name (so the JSX runtime can keep it as a pending ref instead).
|
|
13
|
-
*/
|
|
14
|
-
export declare function foreignComponentName(type: unknown): string | null;
|
|
15
|
-
/**
|
|
16
|
-
* Registry key for a foreign component: `foreign:<displayName>`. The
|
|
17
|
-
* `foreign:` namespace keeps a third-party component (e.g. an icon named
|
|
18
|
-
* `Button`) from clobbering a registered UDS component of the same name.
|
|
19
|
-
* Returns `null` when the component has no resolvable foreign name.
|
|
20
|
-
*/
|
|
21
|
-
export declare function foreignRegistryKey(type: unknown): string | null;
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
//#region src/foreign-component-name.ts
|
|
2
|
-
/**
|
|
3
|
-
* Reserved registry namespace for third-party leaf components — the prefix in a
|
|
4
|
-
* `foreign:<displayName>` key. Not a peer design-system namespace (those are
|
|
5
|
-
* meaningful disambiguation); it marks "not a UDS component," so display
|
|
6
|
-
* surfaces strip it to the bare name.
|
|
7
|
-
*/
|
|
8
|
-
const FOREIGN_NAMESPACE = "foreign";
|
|
9
|
-
const FORWARD_REF_TYPE = Symbol.for("react.forward_ref");
|
|
10
|
-
const MEMO_TYPE = Symbol.for("react.memo");
|
|
11
|
-
function nameOf(value) {
|
|
12
|
-
if (typeof value !== "object" && typeof value !== "function") return null;
|
|
13
|
-
const named = value;
|
|
14
|
-
if (typeof named.displayName === "string" && named.displayName.length > 0) return named.displayName;
|
|
15
|
-
if (typeof named.name === "string" && named.name.length > 0) return named.name;
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
/**
|
|
19
|
-
* Display name for a `forwardRef`/`memo` component object — preferring its own
|
|
20
|
-
* `displayName`, then the wrapped function's name. Returns `null` for anything
|
|
21
|
-
* that isn't one of those wrappers, and for an anonymous wrapper with no
|
|
22
|
-
* resolvable name (so the JSX runtime can keep it as a pending ref instead).
|
|
23
|
-
*/
|
|
24
|
-
function foreignComponentName(type) {
|
|
25
|
-
if (type === null || typeof type !== "object") return null;
|
|
26
|
-
const wrapper = type;
|
|
27
|
-
if (wrapper.$$typeof === FORWARD_REF_TYPE) return nameOf(type) ?? nameOf(wrapper.render);
|
|
28
|
-
if (wrapper.$$typeof === MEMO_TYPE) return nameOf(type) ?? nameOf(wrapper.type);
|
|
29
|
-
return null;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Registry key for a foreign component: `foreign:<displayName>`. The
|
|
33
|
-
* `foreign:` namespace keeps a third-party component (e.g. an icon named
|
|
34
|
-
* `Button`) from clobbering a registered UDS component of the same name.
|
|
35
|
-
* Returns `null` when the component has no resolvable foreign name.
|
|
36
|
-
*/
|
|
37
|
-
function foreignRegistryKey(type) {
|
|
38
|
-
const name = foreignComponentName(type);
|
|
39
|
-
return name === null ? null : `${FOREIGN_NAMESPACE}:${name}`;
|
|
40
|
-
}
|
|
41
|
-
//#endregion
|
|
42
|
-
export { FOREIGN_NAMESPACE, foreignComponentName, foreignRegistryKey };
|
package/dist/interpolate.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
//#region src/interpolate.d.ts
|
|
2
|
-
/**
|
|
3
|
-
* Motion interpolation marker — used inside `JsMotionDefinition`
|
|
4
|
-
* keyframes to declare an index-based interpolation (e.g. stagger).
|
|
5
|
-
*
|
|
6
|
-
* Codegen's `motion-transform.ts` detects `{ __type: 'interpolate' }`
|
|
7
|
-
* shapes on keyframe values and lifts them into the renderer's
|
|
8
|
-
* `useTransform`-style interpolation.
|
|
9
|
-
*/
|
|
10
|
-
interface InterpolateMarker {
|
|
11
|
-
readonly __type: 'interpolate';
|
|
12
|
-
readonly output: readonly number[];
|
|
13
|
-
readonly extrapolate: 'clamp' | 'extend' | 'identity';
|
|
14
|
-
}
|
|
15
|
-
declare function interpolate(config: {
|
|
16
|
-
output: readonly number[];
|
|
17
|
-
extrapolate?: 'clamp' | 'extend' | 'identity';
|
|
18
|
-
}): InterpolateMarker;
|
|
19
|
-
//#endregion
|
|
20
|
-
export { interpolate };
|
package/dist/interpolate.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
// Fixture for the `jsx-runtime` Bun.build integration test.
|
|
3
|
-
//
|
|
4
|
-
// Bundled with `jsx: { runtime: 'automatic', importSource: '@yahoo/uds-create-config/jsx' }`
|
|
5
|
-
// so the JSX expression below compiles into calls against our custom JSX
|
|
6
|
-
// runtime instead of React. Exercises the cross-component preview reference
|
|
7
|
-
// timing — `<Icon />` evaluates inside Button's `.preview(...)` callback,
|
|
8
|
-
// BEFORE `registerComponents` stamps `__componentName` on Icon.
|
|
9
|
-
import { Config, defineComponent } from '../../index';
|
|
10
|
-
const Icon = defineComponent('span');
|
|
11
|
-
const Button = defineComponent('button').preview({
|
|
12
|
-
defaultProps: { children: _jsx(Icon, {}) },
|
|
13
|
-
});
|
|
14
|
-
const config = new Config().registerComponents({ Button, Icon });
|
|
15
|
-
export default config;
|