@pairdraw/dom-css 0.16.0 → 0.16.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pairdraw/dom-css",
3
- "version": "0.16.0",
3
+ "version": "0.16.2",
4
4
  "license": "MIT",
5
5
  "files": [
6
6
  "dist",
@@ -11,7 +11,7 @@
11
11
  "types": "./dist/index.d.ts",
12
12
  "dependencies": {
13
13
  "@acemir/cssom": "^0.9.31",
14
- "@pairdraw/emit": "^0.16.0",
14
+ "@pairdraw/emit": "^0.16.2",
15
15
  "css-tree": "^3.2.1",
16
16
  "cssesc": "^3.0.0",
17
17
  "dedent": "^1.7.2",
@@ -24,7 +24,7 @@
24
24
  "twirlwind": "^0.4.1"
25
25
  },
26
26
  "peerDependencies": {
27
- "@pairdraw/scene-graph": "^0.16.0"
27
+ "@pairdraw/scene-graph": "^0.16.2"
28
28
  },
29
29
  "exports": {
30
30
  ".": {
@@ -65,6 +65,21 @@
65
65
  },
66
66
  "#dom-css-tests/*": "./tests/*.ts"
67
67
  },
68
+ "description": "DOM, CSS, HTML, JSX, and Tailwind projection between Pairdraw documents and SceneGraph, with browser and headless CSS runtimes.",
69
+ "keywords": [
70
+ "pairdraw",
71
+ "design",
72
+ "html",
73
+ "css",
74
+ "tailwind",
75
+ "jsx",
76
+ "export"
77
+ ],
78
+ "author": "Badryansah Bangsawan",
79
+ "homepage": "https://github.com/BadryansahBangsawan/pairdraw/tree/main/packages/dom-css#readme",
80
+ "bugs": {
81
+ "url": "https://github.com/BadryansahBangsawan/pairdraw/issues"
82
+ },
68
83
  "type": "module",
69
84
  "sideEffects": false,
70
85
  "repository": {
@@ -387,7 +387,7 @@ async function exportStandaloneHTML(
387
387
  ): Promise<ExportHTMLBundle> {
388
388
  const size = standaloneSize(document)
389
389
  const doc = standaloneDocument(document, size)
390
- const stageCSS = `.op-stage{position:relative;width:${size.width}px;height:${size.height}px;overflow:hidden;background:transparent}`
390
+ const stageCSS = `.pairdraw-stage{position:relative;width:${size.width}px;height:${size.height}px;overflow:hidden;background:transparent}`
391
391
  let body: string
392
392
  let css = `${RESET_CSS}${stageCSS}`
393
393
 
@@ -417,7 +417,7 @@ async function exportStandaloneHTML(
417
417
  ])
418
418
  body = extracted.html
419
419
  const cssPath = `${options.assetBasePath}/pairdraw.css`
420
- const html = `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">${stylesheetLink(cssPath)}</head><body><main data-pairdraw-html="standalone" class="op-stage">${body}</main></body></html>`
420
+ const html = `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">${stylesheetLink(cssPath)}</head><body><main data-pairdraw-html="standalone" class="pairdraw-stage">${body}</main></body></html>`
421
421
  return {
422
422
  entrypoint: 'index.html',
423
423
  files: [
@@ -429,7 +429,7 @@ async function exportStandaloneHTML(
429
429
  }
430
430
  }
431
431
 
432
- const html = `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">${styleTag(css)}</head><body><main data-pairdraw-html="standalone" class="op-stage">${body}</main></body></html>`
432
+ const html = `<!doctype html><html><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">${styleTag(css)}</head><body><main data-pairdraw-html="standalone" class="pairdraw-stage">${body}</main></body></html>`
433
433
  return { entrypoint: 'index.html', files: [{ path: 'index.html', content: html }] }
434
434
  }
435
435
 
@@ -3,20 +3,13 @@ import { stateStylesToCSS } from '#dom-css/behaviours/states/css'
3
3
  import dedent from 'dedent'
4
4
  import { compact } from 'es-toolkit/array'
5
5
  import { omit } from 'es-toolkit/object'
6
- import { camelCase, upperFirst } from 'es-toolkit/string'
6
+ import { camelCase } from 'es-toolkit/string'
7
7
 
8
8
  import { es, jsx } from '@pairdraw/emit'
9
9
  import type { ShaderComponent } from '@pairdraw/scene-graph/shaders'
10
10
 
11
11
  import { drawingImports, iconDrawing, iconImportDeclarations, iconNamer } from '../icons'
12
- import type {
13
- ComponentElement,
14
- ComponentGenerator,
15
- GeneratedComponent,
16
- ComponentModel,
17
- ComponentNode,
18
- GeneratedKind
19
- } from '../model'
12
+ import type { ComponentElement, ComponentGenerator, ComponentNode, GeneratedKind } from '../model'
20
13
  import type { ComponentReference, IconReference } from '../references'
21
14
  import {
22
15
  drawnEffects,
@@ -31,63 +24,21 @@ import { componentClasses } from '../styling'
31
24
  import {
32
25
  INPUT_PROPS,
33
26
  inputElement,
34
- kindParameters,
35
27
  NUMBER_STATE,
36
28
  partAttributes,
37
29
  prepend,
38
- STEPPERS,
39
- type Parameter
30
+ STEPPERS
40
31
  } from './fields'
32
+ import { parameters, propsType, reactImport, SINGLE_PROPS, valueArg } from './props'
33
+ import { defaultOf, PRIMITIVE, RADIX } from './radix'
41
34
  import { classValue, drawing, elementLayers, moduleClass, numeric, type MarkupUses } from './shared'
42
35
 
43
- /**
44
- * The Radix primitive a kind renders, from the unified `radix-ui` package, and the component
45
- * of it each part uses. Its root takes the value two ways (`checked` and `onCheckedChange`,
46
- * `pressed`, `open`) and `disabled` itself, so the generated props extend the root's.
47
- */
48
- const RADIX: Record<GeneratedKind, { namespace: string; parts: Record<string, string> } | null> = {
49
- button: null,
50
- switch: { namespace: 'Switch', parts: { root: 'Root', thumb: 'Thumb' } },
51
- checkbox: { namespace: 'Checkbox', parts: { root: 'Root', indicator: 'Indicator' } },
52
- toggle: { namespace: 'Toggle', parts: { root: 'Root' } },
53
- collapsible: {
54
- namespace: 'Collapsible',
55
- parts: { root: 'Root', trigger: 'Trigger', content: 'Content' }
56
- },
57
- tabs: {
58
- namespace: 'Tabs',
59
- parts: { root: 'Root', list: 'List', trigger: 'Trigger', content: 'Content' }
60
- },
61
- radioGroup: { namespace: 'RadioGroup', parts: { root: 'Root' } },
62
- toggleGroup: { namespace: 'ToggleGroup', parts: { root: 'Root' } },
63
- accordion: { namespace: 'Accordion', parts: { root: 'Root' } },
64
- radioGroupItem: { namespace: 'RadioGroup', parts: { root: 'Item', indicator: 'Indicator' } },
65
- toggleGroupItem: { namespace: 'ToggleGroup', parts: { root: 'Item' } },
66
- accordionItem: {
67
- namespace: 'Accordion',
68
- parts: { root: 'Item', trigger: 'Trigger', content: 'Content' }
69
- },
70
- slider: {
71
- namespace: 'Slider',
72
- parts: { root: 'Root', track: 'Track', range: 'Range', thumb: 'Thumb' }
73
- },
74
- progress: { namespace: 'Progress', parts: { root: 'Root', indicator: 'Indicator' } },
75
- // Radix has no number or text field; these are native inputs in the design's own elements.
76
- numberField: null,
77
- textField: null,
78
- textarea: null,
79
- // A component without a behaviour is the design's own elements.
80
- plain: null
81
- }
82
-
83
36
  /** What a group's root fixes: one item chosen at a time, and an accordion that can all close. */
84
37
  const ROOT_ATTRIBUTES: Partial<Record<GeneratedKind, es.SyntaxNode[]>> = {
85
38
  toggleGroup: [jsx.attribute('type', jsx.stringValue('single'))],
86
39
  accordion: [jsx.attribute('type', jsx.stringValue('single')), jsx.attribute('collapsible', null)]
87
40
  }
88
41
 
89
- const PRIMITIVE = (namespace: string) => `${namespace}Primitive`
90
-
91
42
  const HEADING_STYLE = jsx.container(
92
43
  es.object(
93
44
  Object.entries(HEADING_RESET).map(
@@ -145,9 +96,6 @@ function iconElement(node: IconReference, uses: MarkupUses, depth: number): es.S
145
96
  )
146
97
  }
147
98
 
148
- /** `defaultChecked`: Radix's uncontrolled value, which a nested control starts from. */
149
- const defaultOf = (model: string) => `default${upperFirst(model)}`
150
-
151
99
  /** A reference's prop value: a bare name for true, `{false}`, or a string. */
152
100
  function referenceValue(value: string | boolean): es.SyntaxNode | null {
153
101
  if (value === true) return null
@@ -360,148 +308,6 @@ const RADIX_IMPORT = es.parseModule(`import { $Namespace as $Primitive } from 'r
360
308
  const ICONIFY_IMPORT = es.parseModule(`import { Icon as ${ICONIFY} } from '@iconify/react'`).body
361
309
  const IMPORT_COMPONENT = es.parseModule(`import { $Component } from '$path'`)
362
310
 
363
- /**
364
- * The props of a group that fixes one choice at a time, without the `type` it fixes. The
365
- * root's own props join the single and multiple choice, which a single value can't satisfy.
366
- */
367
- const SINGLE_PROPS: Partial<Record<GeneratedKind, string>> = {
368
- toggleGroup: 'ToggleGroupSingleProps',
369
- accordion: 'AccordionSingleProps'
370
- }
371
-
372
- const qualified = (namespace: string, name: string) => ({
373
- type: 'TSQualifiedName',
374
- left: es.identifier(PRIMITIVE(namespace)),
375
- right: es.identifier(name)
376
- })
377
-
378
- /** Props a kind declares itself, where no Radix root has them. */
379
- const OWN_PROPS: Partial<Record<GeneratedKind, string>> = {
380
- progress: "Omit<ComponentProps<typeof ProgressPrimitive.Root>, 'value'> & { value?: number }",
381
- numberField:
382
- "Omit<ComponentProps<'div'>, 'defaultValue' | 'onChange'> & { defaultValue?: number; onValueChange?: (value: number) => void; disabled?: boolean }",
383
- textField: "ComponentProps<'input'>",
384
- textarea: "ComponentProps<'textarea'>"
385
- }
386
-
387
- /** The root's own props, or a single choice group's. */
388
- function rootPropsType(kind: GeneratedKind, tag: string): es.SyntaxNode {
389
- const own = OWN_PROPS[kind]
390
- if (own) return es.parseType(own)
391
- // A component without a behaviour takes its root element's props.
392
- if (kind === 'plain') return es.parseType(`ComponentProps<'${tag}'>`)
393
- const radix = RADIX[kind]
394
- if (!radix) return es.parseType("ComponentProps<'button'>")
395
- const single = SINGLE_PROPS[kind]
396
- if (single)
397
- return es.fill(es.parseType("Omit<$Props, 'type'>"), {
398
- $Props: qualified(radix.namespace, single)
399
- })
400
- return es.fill(es.parseType('ComponentProps<typeof $Root>'), {
401
- $Root: qualified(radix.namespace, radix.parts.root)
402
- })
403
- }
404
-
405
- /** The root's own props, extended with the component's variant props when it has any. */
406
- function propsType(component: ComponentModel): es.SyntaxNode {
407
- const base = rootPropsType(component.kind, component.tree.tag)
408
- const own = [component.props, component.texts, component.booleans, component.slots]
409
- if (own.every((list) => list.length === 0)) return base
410
- return {
411
- type: 'TSIntersectionType',
412
- types: [
413
- base,
414
- es.objectType([
415
- ...component.props.map((prop): [string, es.SyntaxNode, boolean] => [
416
- prop.name,
417
- es.stringUnionType(prop.options),
418
- true
419
- ]),
420
- ...component.texts.map((text): [string, es.SyntaxNode, boolean] => [
421
- text.name,
422
- es.parseType('string'),
423
- true
424
- ]),
425
- ...component.booleans.map((prop): [string, es.SyntaxNode, boolean] => [
426
- prop.name,
427
- es.parseType('boolean'),
428
- true
429
- ]),
430
- ...component.slots.map((slot): [string, es.SyntaxNode, boolean] => [
431
- slot.name,
432
- es.parseType('ReactNode'),
433
- true
434
- ])
435
- ])
436
- ]
437
- }
438
- }
439
-
440
- /**
441
- * `{ size = 'Small', label = 'Save', ...props }`: variant and text props with their defaults,
442
- * kept off the root, and the rest passed on.
443
- */
444
- function parameters(component: ComponentModel): es.SyntaxNode {
445
- const own: Parameter[] = [
446
- ...kindParameters(component),
447
- ...[...component.props, ...component.texts].map((prop) => ({
448
- name: prop.name,
449
- default: es.string(prop.default)
450
- })),
451
- ...component.booleans.map((prop) => ({
452
- name: prop.name,
453
- default: es.parseExpression(String(prop.default))
454
- })),
455
- // Slots are kept off the root too, which would otherwise get them as attributes.
456
- ...component.slots.map((slot) => ({ name: slot.name }))
457
- ]
458
- if (own.length === 0) return es.identifier('props')
459
- return {
460
- type: 'ObjectPattern',
461
- properties: [
462
- ...own.map((prop) => ({
463
- type: 'Property',
464
- kind: 'init',
465
- key: es.identifier(prop.name),
466
- value: prop.default
467
- ? { type: 'AssignmentPattern', left: es.identifier(prop.name), right: prop.default }
468
- : es.identifier(prop.name),
469
- computed: false,
470
- method: false,
471
- shorthand: true
472
- })),
473
- { type: 'RestElement', argument: es.identifier('props') }
474
- ]
475
- }
476
- }
477
-
478
- /**
479
- * `import { useState, type ComponentProps, type ReactNode } from 'react'` with only what the
480
- * component uses: a number field's state, its root's props, and its slots' content.
481
- */
482
- function reactImport(uses: { state: boolean; props: boolean; slots: boolean }): es.SyntaxNode[] {
483
- const types = [...(uses.props ? ['ComponentProps'] : []), ...(uses.slots ? ['ReactNode'] : [])]
484
- if (!uses.state && types.length === 0) return []
485
- const specifiers = uses.state
486
- ? ['useState', ...types.map((name) => `type ${name}`)].join(', ')
487
- : types.join(', ')
488
- return es.parseModule(`import ${uses.state ? '' : 'type '}{ ${specifiers} } from 'react'`).body
489
- }
490
-
491
- /**
492
- * The prop a story sets the value with: Radix's uncontrolled value, so a story's control and
493
- * its play function can both change it, which a slider takes as a list; a progress bar's own
494
- * value, which nothing else changes.
495
- */
496
- function valueArg(
497
- kind: GeneratedKind,
498
- model: string | null
499
- ): Pick<GeneratedComponent, 'valueArg' | 'valueList'> {
500
- if (!model) return { valueArg: null }
501
- if (kind === 'progress') return { valueArg: 'value' }
502
- return { valueArg: defaultOf(model), ...(kind === 'slider' ? { valueList: true } : {}) }
503
- }
504
-
505
311
  /**
506
312
  * A component as a React component on Radix UI: its parts as Radix primitives from the
507
313
  * `radix-ui` package, its variants' state styles in a CSS module, and props that extend the
@@ -0,0 +1,151 @@
1
+ import { es } from '@pairdraw/emit'
2
+
3
+ import type { ComponentModel, GeneratedComponent, GeneratedKind } from '../model'
4
+ import { kindParameters, type Parameter } from './fields'
5
+ import { defaultOf, PRIMITIVE, RADIX } from './radix'
6
+
7
+ /**
8
+ * The props of a group that fixes one choice at a time, without the `type` it fixes. The
9
+ * root's own props join the single and multiple choice, which a single value can't satisfy.
10
+ */
11
+ export const SINGLE_PROPS: Partial<Record<GeneratedKind, string>> = {
12
+ toggleGroup: 'ToggleGroupSingleProps',
13
+ accordion: 'AccordionSingleProps'
14
+ }
15
+
16
+ const qualified = (namespace: string, name: string) => ({
17
+ type: 'TSQualifiedName',
18
+ left: es.identifier(PRIMITIVE(namespace)),
19
+ right: es.identifier(name)
20
+ })
21
+
22
+ /** Props a kind declares itself, where no Radix root has them. */
23
+ const OWN_PROPS: Partial<Record<GeneratedKind, string>> = {
24
+ progress: "Omit<ComponentProps<typeof ProgressPrimitive.Root>, 'value'> & { value?: number }",
25
+ numberField:
26
+ "Omit<ComponentProps<'div'>, 'defaultValue' | 'onChange'> & { defaultValue?: number; onValueChange?: (value: number) => void; disabled?: boolean }",
27
+ textField: "ComponentProps<'input'>",
28
+ textarea: "ComponentProps<'textarea'>"
29
+ }
30
+
31
+ /** The root's own props, or a single choice group's. */
32
+ function rootPropsType(kind: GeneratedKind, tag: string): es.SyntaxNode {
33
+ const own = OWN_PROPS[kind]
34
+ if (own) return es.parseType(own)
35
+ // A component without a behaviour takes its root element's props.
36
+ if (kind === 'plain') return es.parseType(`ComponentProps<'${tag}'>`)
37
+ const radix = RADIX[kind]
38
+ if (!radix) return es.parseType("ComponentProps<'button'>")
39
+ const single = SINGLE_PROPS[kind]
40
+ if (single)
41
+ return es.fill(es.parseType("Omit<$Props, 'type'>"), {
42
+ $Props: qualified(radix.namespace, single)
43
+ })
44
+ return es.fill(es.parseType('ComponentProps<typeof $Root>'), {
45
+ $Root: qualified(radix.namespace, radix.parts.root)
46
+ })
47
+ }
48
+
49
+ /** The root's own props, extended with the component's variant props when it has any. */
50
+ export function propsType(component: ComponentModel): es.SyntaxNode {
51
+ const base = rootPropsType(component.kind, component.tree.tag)
52
+ const own = [component.props, component.texts, component.booleans, component.slots]
53
+ if (own.every((list) => list.length === 0)) return base
54
+ return {
55
+ type: 'TSIntersectionType',
56
+ types: [
57
+ base,
58
+ es.objectType([
59
+ ...component.props.map((prop): [string, es.SyntaxNode, boolean] => [
60
+ prop.name,
61
+ es.stringUnionType(prop.options),
62
+ true
63
+ ]),
64
+ ...component.texts.map((text): [string, es.SyntaxNode, boolean] => [
65
+ text.name,
66
+ es.parseType('string'),
67
+ true
68
+ ]),
69
+ ...component.booleans.map((prop): [string, es.SyntaxNode, boolean] => [
70
+ prop.name,
71
+ es.parseType('boolean'),
72
+ true
73
+ ]),
74
+ ...component.slots.map((slot): [string, es.SyntaxNode, boolean] => [
75
+ slot.name,
76
+ es.parseType('ReactNode'),
77
+ true
78
+ ])
79
+ ])
80
+ ]
81
+ }
82
+ }
83
+
84
+ /**
85
+ * `{ size = 'Small', label = 'Save', ...props }`: variant and text props with their defaults,
86
+ * kept off the root, and the rest passed on.
87
+ */
88
+ export function parameters(component: ComponentModel): es.SyntaxNode {
89
+ const own: Parameter[] = [
90
+ ...kindParameters(component),
91
+ ...[...component.props, ...component.texts].map((prop) => ({
92
+ name: prop.name,
93
+ default: es.string(prop.default)
94
+ })),
95
+ ...component.booleans.map((prop) => ({
96
+ name: prop.name,
97
+ default: es.parseExpression(String(prop.default))
98
+ })),
99
+ // Slots are kept off the root too, which would otherwise get them as attributes.
100
+ ...component.slots.map((slot) => ({ name: slot.name }))
101
+ ]
102
+ if (own.length === 0) return es.identifier('props')
103
+ return {
104
+ type: 'ObjectPattern',
105
+ properties: [
106
+ ...own.map((prop) => ({
107
+ type: 'Property',
108
+ kind: 'init',
109
+ key: es.identifier(prop.name),
110
+ value: prop.default
111
+ ? { type: 'AssignmentPattern', left: es.identifier(prop.name), right: prop.default }
112
+ : es.identifier(prop.name),
113
+ computed: false,
114
+ method: false,
115
+ shorthand: true
116
+ })),
117
+ { type: 'RestElement', argument: es.identifier('props') }
118
+ ]
119
+ }
120
+ }
121
+
122
+ /**
123
+ * `import { useState, type ComponentProps, type ReactNode } from 'react'` with only what the
124
+ * component uses: a number field's state, its root's props, and its slots' content.
125
+ */
126
+ export function reactImport(uses: {
127
+ state: boolean
128
+ props: boolean
129
+ slots: boolean
130
+ }): es.SyntaxNode[] {
131
+ const types = [...(uses.props ? ['ComponentProps'] : []), ...(uses.slots ? ['ReactNode'] : [])]
132
+ if (!uses.state && types.length === 0) return []
133
+ const specifiers = uses.state
134
+ ? ['useState', ...types.map((name) => `type ${name}`)].join(', ')
135
+ : types.join(', ')
136
+ return es.parseModule(`import ${uses.state ? '' : 'type '}{ ${specifiers} } from 'react'`).body
137
+ }
138
+
139
+ /**
140
+ * The prop a story sets the value with: Radix's uncontrolled value, so a story's control and
141
+ * its play function can both change it, which a slider takes as a list; a progress bar's own
142
+ * value, which nothing else changes.
143
+ */
144
+ export function valueArg(
145
+ kind: GeneratedKind,
146
+ model: string | null
147
+ ): Pick<GeneratedComponent, 'valueArg' | 'valueList'> {
148
+ if (!model) return { valueArg: null }
149
+ if (kind === 'progress') return { valueArg: 'value' }
150
+ return { valueArg: defaultOf(model), ...(kind === 'slider' ? { valueList: true } : {}) }
151
+ }
@@ -0,0 +1,52 @@
1
+ import { upperFirst } from 'es-toolkit/string'
2
+
3
+ import type { GeneratedKind } from '../model'
4
+
5
+ /**
6
+ * The Radix primitive a kind renders, from the unified `radix-ui` package, and the component
7
+ * of it each part uses. Its root takes the value two ways (`checked` and `onCheckedChange`,
8
+ * `pressed`, `open`) and `disabled` itself, so the generated props extend the root's.
9
+ */
10
+ export const RADIX: Record<
11
+ GeneratedKind,
12
+ { namespace: string; parts: Record<string, string> } | null
13
+ > = {
14
+ button: null,
15
+ switch: { namespace: 'Switch', parts: { root: 'Root', thumb: 'Thumb' } },
16
+ checkbox: { namespace: 'Checkbox', parts: { root: 'Root', indicator: 'Indicator' } },
17
+ toggle: { namespace: 'Toggle', parts: { root: 'Root' } },
18
+ collapsible: {
19
+ namespace: 'Collapsible',
20
+ parts: { root: 'Root', trigger: 'Trigger', content: 'Content' }
21
+ },
22
+ tabs: {
23
+ namespace: 'Tabs',
24
+ parts: { root: 'Root', list: 'List', trigger: 'Trigger', content: 'Content' }
25
+ },
26
+ radioGroup: { namespace: 'RadioGroup', parts: { root: 'Root' } },
27
+ toggleGroup: { namespace: 'ToggleGroup', parts: { root: 'Root' } },
28
+ accordion: { namespace: 'Accordion', parts: { root: 'Root' } },
29
+ radioGroupItem: { namespace: 'RadioGroup', parts: { root: 'Item', indicator: 'Indicator' } },
30
+ toggleGroupItem: { namespace: 'ToggleGroup', parts: { root: 'Item' } },
31
+ accordionItem: {
32
+ namespace: 'Accordion',
33
+ parts: { root: 'Item', trigger: 'Trigger', content: 'Content' }
34
+ },
35
+ slider: {
36
+ namespace: 'Slider',
37
+ parts: { root: 'Root', track: 'Track', range: 'Range', thumb: 'Thumb' }
38
+ },
39
+ progress: { namespace: 'Progress', parts: { root: 'Root', indicator: 'Indicator' } },
40
+ // Radix has no number or text field; these are native inputs in the design's own elements.
41
+ numberField: null,
42
+ textField: null,
43
+ textarea: null,
44
+ // A component without a behaviour is the design's own elements.
45
+ plain: null
46
+ }
47
+
48
+ /** The local name a Radix namespace is imported as, such as `SwitchPrimitive`. */
49
+ export const PRIMITIVE = (namespace: string) => `${namespace}Primitive`
50
+
51
+ /** `defaultChecked`: Radix's uncontrolled value, which a nested control starts from. */
52
+ export const defaultOf = (model: string) => `default${upperFirst(model)}`