@workday/canvas-kit-docs 14.0.0-alpha.1165-next.0 → 14.0.0-alpha.1167-next.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.
package/dist/es6/lib/docs.js
CHANGED
|
@@ -411376,12 +411376,12 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
411376
411376
|
},
|
|
411377
411377
|
{
|
|
411378
411378
|
"name": "createConfig",
|
|
411379
|
-
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/index.
|
|
411379
|
+
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/index.ts",
|
|
411380
411380
|
"description": "",
|
|
411381
411381
|
"declarations": [
|
|
411382
411382
|
{
|
|
411383
411383
|
"name": "createConfig",
|
|
411384
|
-
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/index.
|
|
411384
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/index.ts"
|
|
411385
411385
|
}
|
|
411386
411386
|
],
|
|
411387
411387
|
"tags": {},
|
|
@@ -411402,7 +411402,7 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
411402
411402
|
"declarations": [
|
|
411403
411403
|
{
|
|
411404
411404
|
"name": "config",
|
|
411405
|
-
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/index.
|
|
411405
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/index.ts"
|
|
411406
411406
|
}
|
|
411407
411407
|
],
|
|
411408
411408
|
"tags": {}
|
|
@@ -411500,6 +411500,214 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
411500
411500
|
}
|
|
411501
411501
|
}
|
|
411502
411502
|
},
|
|
411503
|
+
{
|
|
411504
|
+
"name": "getTSConfigFile",
|
|
411505
|
+
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/createTypeScriptWatchProgram.ts",
|
|
411506
|
+
"description": "Get the contents of the tsconfig in the system",
|
|
411507
|
+
"declarations": [
|
|
411508
|
+
{
|
|
411509
|
+
"name": "getTSConfigFile",
|
|
411510
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/createTypeScriptWatchProgram.ts"
|
|
411511
|
+
}
|
|
411512
|
+
],
|
|
411513
|
+
"tags": {},
|
|
411514
|
+
"type": {
|
|
411515
|
+
"kind": "function",
|
|
411516
|
+
"parameters": [
|
|
411517
|
+
{
|
|
411518
|
+
"kind": "parameter",
|
|
411519
|
+
"name": "tsconfigPath",
|
|
411520
|
+
"type": {
|
|
411521
|
+
"kind": "primitive",
|
|
411522
|
+
"value": "string"
|
|
411523
|
+
},
|
|
411524
|
+
"required": true,
|
|
411525
|
+
"rest": false,
|
|
411526
|
+
"description": "",
|
|
411527
|
+
"declarations": [
|
|
411528
|
+
{
|
|
411529
|
+
"name": "tsconfigPath",
|
|
411530
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/createTypeScriptWatchProgram.ts"
|
|
411531
|
+
}
|
|
411532
|
+
],
|
|
411533
|
+
"tags": {}
|
|
411534
|
+
}
|
|
411535
|
+
],
|
|
411536
|
+
"members": [],
|
|
411537
|
+
"returnType": {
|
|
411538
|
+
"kind": "symbol",
|
|
411539
|
+
"name": "ParsedCommandLine",
|
|
411540
|
+
"value": "ParsedCommandLine"
|
|
411541
|
+
}
|
|
411542
|
+
}
|
|
411543
|
+
},
|
|
411544
|
+
{
|
|
411545
|
+
"name": "getCompilerOptions",
|
|
411546
|
+
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/createTypeScriptWatchProgram.ts",
|
|
411547
|
+
"description": "",
|
|
411548
|
+
"declarations": [
|
|
411549
|
+
{
|
|
411550
|
+
"name": "getCompilerOptions",
|
|
411551
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/createTypeScriptWatchProgram.ts"
|
|
411552
|
+
}
|
|
411553
|
+
],
|
|
411554
|
+
"tags": {},
|
|
411555
|
+
"type": {
|
|
411556
|
+
"kind": "function",
|
|
411557
|
+
"parameters": [
|
|
411558
|
+
{
|
|
411559
|
+
"kind": "parameter",
|
|
411560
|
+
"name": "tsconfigPath",
|
|
411561
|
+
"type": {
|
|
411562
|
+
"kind": "primitive",
|
|
411563
|
+
"value": "string"
|
|
411564
|
+
},
|
|
411565
|
+
"required": true,
|
|
411566
|
+
"rest": false,
|
|
411567
|
+
"description": "",
|
|
411568
|
+
"declarations": [
|
|
411569
|
+
{
|
|
411570
|
+
"name": "tsconfigPath",
|
|
411571
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/createTypeScriptWatchProgram.ts"
|
|
411572
|
+
}
|
|
411573
|
+
],
|
|
411574
|
+
"tags": {}
|
|
411575
|
+
}
|
|
411576
|
+
],
|
|
411577
|
+
"members": [],
|
|
411578
|
+
"returnType": {
|
|
411579
|
+
"kind": "symbol",
|
|
411580
|
+
"name": "CompilerOptions",
|
|
411581
|
+
"value": "CompilerOptions"
|
|
411582
|
+
}
|
|
411583
|
+
}
|
|
411584
|
+
},
|
|
411585
|
+
{
|
|
411586
|
+
"name": "startWatch",
|
|
411587
|
+
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/createTypeScriptWatchProgram.ts",
|
|
411588
|
+
"description": "Create a watch program for TypeScript with transformers. It watches the specified\ntsconfigPath for changes and updates the program when changes are detected.",
|
|
411589
|
+
"declarations": [
|
|
411590
|
+
{
|
|
411591
|
+
"name": "startWatch",
|
|
411592
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/createTypeScriptWatchProgram.ts"
|
|
411593
|
+
}
|
|
411594
|
+
],
|
|
411595
|
+
"tags": {
|
|
411596
|
+
"param": "compilerOptions\n \n- The compiler options to use.\ntsconfigPath\n \n- The path to the tsconfig file.\nonProgramCreatedOrUpdated\n \n- A callback function\nthat is called when the program is created or updated.",
|
|
411597
|
+
"returns": ""
|
|
411598
|
+
},
|
|
411599
|
+
"type": {
|
|
411600
|
+
"kind": "function",
|
|
411601
|
+
"parameters": [
|
|
411602
|
+
{
|
|
411603
|
+
"kind": "parameter",
|
|
411604
|
+
"name": "compilerOptions",
|
|
411605
|
+
"type": {
|
|
411606
|
+
"kind": "symbol",
|
|
411607
|
+
"name": "ts.CompilerOptions",
|
|
411608
|
+
"value": "CompilerOptions"
|
|
411609
|
+
},
|
|
411610
|
+
"required": true,
|
|
411611
|
+
"rest": false,
|
|
411612
|
+
"description": "- The compiler options to use.",
|
|
411613
|
+
"declarations": [
|
|
411614
|
+
{
|
|
411615
|
+
"name": "compilerOptions",
|
|
411616
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/createTypeScriptWatchProgram.ts"
|
|
411617
|
+
}
|
|
411618
|
+
],
|
|
411619
|
+
"tags": {
|
|
411620
|
+
"param": "compilerOptions\n \n- The compiler options to use."
|
|
411621
|
+
}
|
|
411622
|
+
},
|
|
411623
|
+
{
|
|
411624
|
+
"kind": "parameter",
|
|
411625
|
+
"name": "tsconfigPath",
|
|
411626
|
+
"type": {
|
|
411627
|
+
"kind": "primitive",
|
|
411628
|
+
"value": "string"
|
|
411629
|
+
},
|
|
411630
|
+
"required": true,
|
|
411631
|
+
"rest": false,
|
|
411632
|
+
"description": "- The path to the tsconfig file.",
|
|
411633
|
+
"declarations": [
|
|
411634
|
+
{
|
|
411635
|
+
"name": "tsconfigPath",
|
|
411636
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/createTypeScriptWatchProgram.ts"
|
|
411637
|
+
}
|
|
411638
|
+
],
|
|
411639
|
+
"tags": {
|
|
411640
|
+
"param": "tsconfigPath\n \n- The path to the tsconfig file."
|
|
411641
|
+
}
|
|
411642
|
+
},
|
|
411643
|
+
{
|
|
411644
|
+
"kind": "parameter",
|
|
411645
|
+
"name": "onProgramCreatedOrUpdated",
|
|
411646
|
+
"type": {
|
|
411647
|
+
"kind": "function",
|
|
411648
|
+
"parameters": [
|
|
411649
|
+
{
|
|
411650
|
+
"kind": "parameter",
|
|
411651
|
+
"name": "program",
|
|
411652
|
+
"type": {
|
|
411653
|
+
"kind": "symbol",
|
|
411654
|
+
"name": "ts.BuilderProgram",
|
|
411655
|
+
"value": "BuilderProgram"
|
|
411656
|
+
},
|
|
411657
|
+
"required": true,
|
|
411658
|
+
"rest": false,
|
|
411659
|
+
"description": "",
|
|
411660
|
+
"declarations": [
|
|
411661
|
+
{
|
|
411662
|
+
"name": "program",
|
|
411663
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/createTypeScriptWatchProgram.ts"
|
|
411664
|
+
}
|
|
411665
|
+
],
|
|
411666
|
+
"tags": {}
|
|
411667
|
+
}
|
|
411668
|
+
],
|
|
411669
|
+
"members": [],
|
|
411670
|
+
"returnType": {
|
|
411671
|
+
"kind": "primitive",
|
|
411672
|
+
"value": "void"
|
|
411673
|
+
}
|
|
411674
|
+
},
|
|
411675
|
+
"required": true,
|
|
411676
|
+
"rest": false,
|
|
411677
|
+
"description": "- A callback function\nthat is called when the program is created or updated.",
|
|
411678
|
+
"declarations": [
|
|
411679
|
+
{
|
|
411680
|
+
"name": "onProgramCreatedOrUpdated",
|
|
411681
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/createTypeScriptWatchProgram.ts"
|
|
411682
|
+
}
|
|
411683
|
+
],
|
|
411684
|
+
"tags": {
|
|
411685
|
+
"param": "onProgramCreatedOrUpdated\n \n- A callback function\nthat is called when the program is created or updated."
|
|
411686
|
+
}
|
|
411687
|
+
}
|
|
411688
|
+
],
|
|
411689
|
+
"members": [],
|
|
411690
|
+
"returnType": {
|
|
411691
|
+
"kind": "tuple",
|
|
411692
|
+
"value": [
|
|
411693
|
+
{
|
|
411694
|
+
"kind": "symbol",
|
|
411695
|
+
"name": "ts.BuilderProgram",
|
|
411696
|
+
"value": "BuilderProgram"
|
|
411697
|
+
},
|
|
411698
|
+
{
|
|
411699
|
+
"kind": "function",
|
|
411700
|
+
"parameters": [],
|
|
411701
|
+
"members": [],
|
|
411702
|
+
"returnType": {
|
|
411703
|
+
"kind": "primitive",
|
|
411704
|
+
"value": "void"
|
|
411705
|
+
}
|
|
411706
|
+
}
|
|
411707
|
+
]
|
|
411708
|
+
}
|
|
411709
|
+
}
|
|
411710
|
+
},
|
|
411503
411711
|
{
|
|
411504
411712
|
"name": "NestedStyleObject",
|
|
411505
411713
|
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/styleTransform.ts",
|
|
@@ -411922,6 +412130,23 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
411922
412130
|
}
|
|
411923
412131
|
],
|
|
411924
412132
|
"tags": {}
|
|
412133
|
+
},
|
|
412134
|
+
{
|
|
412135
|
+
"kind": "property",
|
|
412136
|
+
"name": "seed",
|
|
412137
|
+
"required": true,
|
|
412138
|
+
"type": {
|
|
412139
|
+
"kind": "primitive",
|
|
412140
|
+
"value": "string"
|
|
412141
|
+
},
|
|
412142
|
+
"description": "",
|
|
412143
|
+
"declarations": [
|
|
412144
|
+
{
|
|
412145
|
+
"name": "seed",
|
|
412146
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/utils/types.ts"
|
|
412147
|
+
}
|
|
412148
|
+
],
|
|
412149
|
+
"tags": {}
|
|
411925
412150
|
}
|
|
411926
412151
|
]
|
|
411927
412152
|
}
|
|
@@ -411948,12 +412173,12 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
411948
412173
|
}
|
|
411949
412174
|
},
|
|
411950
412175
|
{
|
|
411951
|
-
"name": "
|
|
412176
|
+
"name": "styleTransformer",
|
|
411952
412177
|
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/styleTransform.ts",
|
|
411953
412178
|
"description": "",
|
|
411954
412179
|
"declarations": [
|
|
411955
412180
|
{
|
|
411956
|
-
"name": "
|
|
412181
|
+
"name": "styleTransformer",
|
|
411957
412182
|
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/styleTransform.ts"
|
|
411958
412183
|
}
|
|
411959
412184
|
],
|
|
@@ -412457,6 +412682,66 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
412457
412682
|
}
|
|
412458
412683
|
}
|
|
412459
412684
|
},
|
|
412685
|
+
{
|
|
412686
|
+
"name": "getHash",
|
|
412687
|
+
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/utils/createStyleObjectNode.ts",
|
|
412688
|
+
"description": "Generate a deterministic hash that is unique to the seed +",
|
|
412689
|
+
"declarations": [
|
|
412690
|
+
{
|
|
412691
|
+
"name": "getHash",
|
|
412692
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/utils/createStyleObjectNode.ts"
|
|
412693
|
+
}
|
|
412694
|
+
],
|
|
412695
|
+
"tags": {},
|
|
412696
|
+
"type": {
|
|
412697
|
+
"kind": "function",
|
|
412698
|
+
"parameters": [
|
|
412699
|
+
{
|
|
412700
|
+
"kind": "parameter",
|
|
412701
|
+
"name": "node",
|
|
412702
|
+
"type": {
|
|
412703
|
+
"kind": "symbol",
|
|
412704
|
+
"name": "ts.Node",
|
|
412705
|
+
"value": "Node"
|
|
412706
|
+
},
|
|
412707
|
+
"required": true,
|
|
412708
|
+
"rest": false,
|
|
412709
|
+
"description": "",
|
|
412710
|
+
"declarations": [
|
|
412711
|
+
{
|
|
412712
|
+
"name": "node",
|
|
412713
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/utils/createStyleObjectNode.ts"
|
|
412714
|
+
}
|
|
412715
|
+
],
|
|
412716
|
+
"tags": {}
|
|
412717
|
+
},
|
|
412718
|
+
{
|
|
412719
|
+
"kind": "parameter",
|
|
412720
|
+
"name": "context",
|
|
412721
|
+
"type": {
|
|
412722
|
+
"kind": "symbol",
|
|
412723
|
+
"name": "TransformerContext",
|
|
412724
|
+
"value": "TransformerContext"
|
|
412725
|
+
},
|
|
412726
|
+
"required": true,
|
|
412727
|
+
"rest": false,
|
|
412728
|
+
"description": "",
|
|
412729
|
+
"declarations": [
|
|
412730
|
+
{
|
|
412731
|
+
"name": "context",
|
|
412732
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/utils/createStyleObjectNode.ts"
|
|
412733
|
+
}
|
|
412734
|
+
],
|
|
412735
|
+
"tags": {}
|
|
412736
|
+
}
|
|
412737
|
+
],
|
|
412738
|
+
"members": [],
|
|
412739
|
+
"returnType": {
|
|
412740
|
+
"kind": "primitive",
|
|
412741
|
+
"value": "string"
|
|
412742
|
+
}
|
|
412743
|
+
}
|
|
412744
|
+
},
|
|
412460
412745
|
{
|
|
412461
412746
|
"name": "getVariablesFromFiles",
|
|
412462
412747
|
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/utils/getCssVariables.ts",
|
|
@@ -414172,6 +414457,23 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
414172
414457
|
}
|
|
414173
414458
|
],
|
|
414174
414459
|
"tags": {}
|
|
414460
|
+
},
|
|
414461
|
+
{
|
|
414462
|
+
"kind": "property",
|
|
414463
|
+
"name": "seed",
|
|
414464
|
+
"required": true,
|
|
414465
|
+
"type": {
|
|
414466
|
+
"kind": "primitive",
|
|
414467
|
+
"value": "string"
|
|
414468
|
+
},
|
|
414469
|
+
"description": "",
|
|
414470
|
+
"declarations": [
|
|
414471
|
+
{
|
|
414472
|
+
"name": "seed",
|
|
414473
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/utils/types.ts"
|
|
414474
|
+
}
|
|
414475
|
+
],
|
|
414476
|
+
"tags": {}
|
|
414175
414477
|
}
|
|
414176
414478
|
]
|
|
414177
414479
|
}
|
|
@@ -414538,6 +414840,23 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
414538
414840
|
}
|
|
414539
414841
|
],
|
|
414540
414842
|
"tags": {}
|
|
414843
|
+
},
|
|
414844
|
+
{
|
|
414845
|
+
"kind": "property",
|
|
414846
|
+
"name": "seed",
|
|
414847
|
+
"required": false,
|
|
414848
|
+
"type": {
|
|
414849
|
+
"kind": "primitive",
|
|
414850
|
+
"value": "string"
|
|
414851
|
+
},
|
|
414852
|
+
"description": "Optional seed for the hash. This can be useful if you want each build to have a different hash.\nIf you provide the same seed, the same hash will be generated for every style.",
|
|
414853
|
+
"declarations": [
|
|
414854
|
+
{
|
|
414855
|
+
"name": "seed",
|
|
414856
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/utils/types.ts"
|
|
414857
|
+
}
|
|
414858
|
+
],
|
|
414859
|
+
"tags": {}
|
|
414541
414860
|
}
|
|
414542
414861
|
]
|
|
414543
414862
|
}
|
|
@@ -414689,6 +415008,289 @@ export const docs = (typeof window !== 'undefined' && window.__docs) ||
|
|
|
414689
415008
|
}
|
|
414690
415009
|
}
|
|
414691
415010
|
},
|
|
415011
|
+
{
|
|
415012
|
+
"name": "default",
|
|
415013
|
+
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpack-loader.ts",
|
|
415014
|
+
"description": "",
|
|
415015
|
+
"declarations": [
|
|
415016
|
+
{
|
|
415017
|
+
"name": "default",
|
|
415018
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpack-loader.ts"
|
|
415019
|
+
}
|
|
415020
|
+
],
|
|
415021
|
+
"tags": {},
|
|
415022
|
+
"type": {
|
|
415023
|
+
"kind": "function",
|
|
415024
|
+
"parameters": [
|
|
415025
|
+
{
|
|
415026
|
+
"kind": "parameter",
|
|
415027
|
+
"name": "source",
|
|
415028
|
+
"type": {
|
|
415029
|
+
"kind": "primitive",
|
|
415030
|
+
"value": "string"
|
|
415031
|
+
},
|
|
415032
|
+
"required": true,
|
|
415033
|
+
"rest": false,
|
|
415034
|
+
"description": "",
|
|
415035
|
+
"declarations": [
|
|
415036
|
+
{
|
|
415037
|
+
"name": "source",
|
|
415038
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpack-loader.ts"
|
|
415039
|
+
}
|
|
415040
|
+
],
|
|
415041
|
+
"tags": {}
|
|
415042
|
+
}
|
|
415043
|
+
],
|
|
415044
|
+
"members": [],
|
|
415045
|
+
"returnType": {
|
|
415046
|
+
"kind": "primitive",
|
|
415047
|
+
"value": "string"
|
|
415048
|
+
}
|
|
415049
|
+
}
|
|
415050
|
+
},
|
|
415051
|
+
{
|
|
415052
|
+
"name": "StylingWebpackPlugin",
|
|
415053
|
+
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpackPlugin.ts",
|
|
415054
|
+
"description": "",
|
|
415055
|
+
"declarations": [
|
|
415056
|
+
{
|
|
415057
|
+
"name": "StylingWebpackPlugin",
|
|
415058
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpackPlugin.ts"
|
|
415059
|
+
}
|
|
415060
|
+
],
|
|
415061
|
+
"tags": {},
|
|
415062
|
+
"type": {
|
|
415063
|
+
"kind": "object",
|
|
415064
|
+
"properties": [
|
|
415065
|
+
{
|
|
415066
|
+
"kind": "property",
|
|
415067
|
+
"name": "compilerOptions",
|
|
415068
|
+
"type": {
|
|
415069
|
+
"kind": "symbol",
|
|
415070
|
+
"name": "CompilerOptions",
|
|
415071
|
+
"value": "CompilerOptions"
|
|
415072
|
+
},
|
|
415073
|
+
"description": "",
|
|
415074
|
+
"declarations": [
|
|
415075
|
+
{
|
|
415076
|
+
"name": "compilerOptions",
|
|
415077
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpackPlugin.ts"
|
|
415078
|
+
}
|
|
415079
|
+
],
|
|
415080
|
+
"tags": {}
|
|
415081
|
+
},
|
|
415082
|
+
{
|
|
415083
|
+
"kind": "property",
|
|
415084
|
+
"name": "builderProgram",
|
|
415085
|
+
"type": {
|
|
415086
|
+
"kind": "symbol",
|
|
415087
|
+
"name": "BuilderProgram",
|
|
415088
|
+
"value": "BuilderProgram"
|
|
415089
|
+
},
|
|
415090
|
+
"description": "",
|
|
415091
|
+
"declarations": [
|
|
415092
|
+
{
|
|
415093
|
+
"name": "builderProgram",
|
|
415094
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpackPlugin.ts"
|
|
415095
|
+
}
|
|
415096
|
+
],
|
|
415097
|
+
"tags": {}
|
|
415098
|
+
},
|
|
415099
|
+
{
|
|
415100
|
+
"kind": "property",
|
|
415101
|
+
"name": "transformers",
|
|
415102
|
+
"type": {
|
|
415103
|
+
"kind": "array",
|
|
415104
|
+
"value": {
|
|
415105
|
+
"kind": "symbol",
|
|
415106
|
+
"name": "TransformerFactory",
|
|
415107
|
+
"typeParameters": [
|
|
415108
|
+
{
|
|
415109
|
+
"kind": "symbol",
|
|
415110
|
+
"name": "SourceFile",
|
|
415111
|
+
"value": "any"
|
|
415112
|
+
}
|
|
415113
|
+
],
|
|
415114
|
+
"value": "any"
|
|
415115
|
+
}
|
|
415116
|
+
},
|
|
415117
|
+
"description": "",
|
|
415118
|
+
"declarations": [
|
|
415119
|
+
{
|
|
415120
|
+
"name": "transformers",
|
|
415121
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpackPlugin.ts"
|
|
415122
|
+
}
|
|
415123
|
+
],
|
|
415124
|
+
"tags": {}
|
|
415125
|
+
},
|
|
415126
|
+
{
|
|
415127
|
+
"kind": "property",
|
|
415128
|
+
"name": "postTransform",
|
|
415129
|
+
"type": {
|
|
415130
|
+
"kind": "union",
|
|
415131
|
+
"value": [
|
|
415132
|
+
{
|
|
415133
|
+
"kind": "parenthesis",
|
|
415134
|
+
"value": {
|
|
415135
|
+
"kind": "function",
|
|
415136
|
+
"parameters": [
|
|
415137
|
+
{
|
|
415138
|
+
"kind": "parameter",
|
|
415139
|
+
"name": "code",
|
|
415140
|
+
"type": {
|
|
415141
|
+
"kind": "primitive",
|
|
415142
|
+
"value": "string"
|
|
415143
|
+
},
|
|
415144
|
+
"required": true,
|
|
415145
|
+
"rest": false,
|
|
415146
|
+
"description": "",
|
|
415147
|
+
"declarations": [
|
|
415148
|
+
{
|
|
415149
|
+
"name": "code",
|
|
415150
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpackPlugin.ts"
|
|
415151
|
+
}
|
|
415152
|
+
],
|
|
415153
|
+
"tags": {}
|
|
415154
|
+
},
|
|
415155
|
+
{
|
|
415156
|
+
"kind": "parameter",
|
|
415157
|
+
"name": "id",
|
|
415158
|
+
"type": {
|
|
415159
|
+
"kind": "primitive",
|
|
415160
|
+
"value": "string"
|
|
415161
|
+
},
|
|
415162
|
+
"required": true,
|
|
415163
|
+
"rest": false,
|
|
415164
|
+
"description": "",
|
|
415165
|
+
"declarations": [
|
|
415166
|
+
{
|
|
415167
|
+
"name": "id",
|
|
415168
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpackPlugin.ts"
|
|
415169
|
+
}
|
|
415170
|
+
],
|
|
415171
|
+
"tags": {}
|
|
415172
|
+
}
|
|
415173
|
+
],
|
|
415174
|
+
"members": [],
|
|
415175
|
+
"returnType": {
|
|
415176
|
+
"kind": "union",
|
|
415177
|
+
"value": [
|
|
415178
|
+
{
|
|
415179
|
+
"kind": "primitive",
|
|
415180
|
+
"value": "string"
|
|
415181
|
+
},
|
|
415182
|
+
{
|
|
415183
|
+
"kind": "primitive",
|
|
415184
|
+
"value": "undefined"
|
|
415185
|
+
}
|
|
415186
|
+
]
|
|
415187
|
+
}
|
|
415188
|
+
}
|
|
415189
|
+
},
|
|
415190
|
+
{
|
|
415191
|
+
"kind": "primitive",
|
|
415192
|
+
"value": "undefined"
|
|
415193
|
+
}
|
|
415194
|
+
]
|
|
415195
|
+
},
|
|
415196
|
+
"description": "",
|
|
415197
|
+
"declarations": [
|
|
415198
|
+
{
|
|
415199
|
+
"name": "postTransform",
|
|
415200
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpackPlugin.ts"
|
|
415201
|
+
}
|
|
415202
|
+
],
|
|
415203
|
+
"tags": {}
|
|
415204
|
+
},
|
|
415205
|
+
{
|
|
415206
|
+
"kind": "property",
|
|
415207
|
+
"name": "close",
|
|
415208
|
+
"type": {
|
|
415209
|
+
"kind": "function",
|
|
415210
|
+
"parameters": [],
|
|
415211
|
+
"members": [],
|
|
415212
|
+
"returnType": {
|
|
415213
|
+
"kind": "primitive",
|
|
415214
|
+
"value": "void"
|
|
415215
|
+
}
|
|
415216
|
+
},
|
|
415217
|
+
"description": "",
|
|
415218
|
+
"declarations": [
|
|
415219
|
+
{
|
|
415220
|
+
"name": "close",
|
|
415221
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpackPlugin.ts"
|
|
415222
|
+
}
|
|
415223
|
+
],
|
|
415224
|
+
"tags": {}
|
|
415225
|
+
},
|
|
415226
|
+
{
|
|
415227
|
+
"kind": "property",
|
|
415228
|
+
"name": "getLoaderOptions",
|
|
415229
|
+
"type": {
|
|
415230
|
+
"kind": "function",
|
|
415231
|
+
"parameters": [],
|
|
415232
|
+
"members": [],
|
|
415233
|
+
"returnType": {
|
|
415234
|
+
"kind": "unknown",
|
|
415235
|
+
"value": "unknown",
|
|
415236
|
+
"text": "SyntheticNode - ThisType"
|
|
415237
|
+
}
|
|
415238
|
+
},
|
|
415239
|
+
"required": true,
|
|
415240
|
+
"description": "",
|
|
415241
|
+
"declarations": [
|
|
415242
|
+
{
|
|
415243
|
+
"name": "getLoaderOptions",
|
|
415244
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpackPlugin.ts"
|
|
415245
|
+
}
|
|
415246
|
+
],
|
|
415247
|
+
"tags": {}
|
|
415248
|
+
},
|
|
415249
|
+
{
|
|
415250
|
+
"kind": "property",
|
|
415251
|
+
"name": "apply",
|
|
415252
|
+
"type": {
|
|
415253
|
+
"kind": "function",
|
|
415254
|
+
"parameters": [
|
|
415255
|
+
{
|
|
415256
|
+
"kind": "parameter",
|
|
415257
|
+
"name": "compiler",
|
|
415258
|
+
"type": {
|
|
415259
|
+
"kind": "unknown",
|
|
415260
|
+
"value": "unknown",
|
|
415261
|
+
"text": "import('webpack').Compiler"
|
|
415262
|
+
},
|
|
415263
|
+
"required": true,
|
|
415264
|
+
"rest": false,
|
|
415265
|
+
"description": "",
|
|
415266
|
+
"declarations": [
|
|
415267
|
+
{
|
|
415268
|
+
"name": "compiler",
|
|
415269
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpackPlugin.ts"
|
|
415270
|
+
}
|
|
415271
|
+
],
|
|
415272
|
+
"tags": {}
|
|
415273
|
+
}
|
|
415274
|
+
],
|
|
415275
|
+
"members": [],
|
|
415276
|
+
"returnType": {
|
|
415277
|
+
"kind": "primitive",
|
|
415278
|
+
"value": "void"
|
|
415279
|
+
}
|
|
415280
|
+
},
|
|
415281
|
+
"required": true,
|
|
415282
|
+
"description": "",
|
|
415283
|
+
"declarations": [
|
|
415284
|
+
{
|
|
415285
|
+
"name": "apply",
|
|
415286
|
+
"filePath": "/home/runner/work/canvas-kit/canvas-kit/modules/styling-transform/lib/webpackPlugin.ts"
|
|
415287
|
+
}
|
|
415288
|
+
],
|
|
415289
|
+
"tags": {}
|
|
415290
|
+
}
|
|
415291
|
+
]
|
|
415292
|
+
}
|
|
415293
|
+
},
|
|
414692
415294
|
{
|
|
414693
415295
|
"name": "calc",
|
|
414694
415296
|
"fileName": "/home/runner/work/canvas-kit/canvas-kit/modules/styling/lib/calc.ts",
|
|
@@ -18,11 +18,11 @@ export const packageJSONFile = `{
|
|
|
18
18
|
"@emotion/react": "11.11.4",
|
|
19
19
|
"@types/react": "18.2.60",
|
|
20
20
|
"@types/react-dom": "18.2.19",
|
|
21
|
-
"@workday/canvas-kit-labs-react": "13.2.
|
|
22
|
-
"@workday/canvas-kit-preview-react": "13.2.
|
|
23
|
-
"@workday/canvas-kit-react": "13.2.
|
|
24
|
-
"@workday/canvas-kit-react-fonts": "^13.2.
|
|
25
|
-
"@workday/canvas-kit-styling": "13.2.
|
|
21
|
+
"@workday/canvas-kit-labs-react": "13.2.2",
|
|
22
|
+
"@workday/canvas-kit-preview-react": "13.2.2",
|
|
23
|
+
"@workday/canvas-kit-react": "13.2.2",
|
|
24
|
+
"@workday/canvas-kit-react-fonts": "^13.2.2",
|
|
25
|
+
"@workday/canvas-kit-styling": "13.2.2",
|
|
26
26
|
"@workday/canvas-system-icons-web": "3.0.22",
|
|
27
27
|
"@workday/canvas-tokens-web": "2.0.0"
|
|
28
28
|
},
|
|
@@ -18,11 +18,11 @@ export const packageJSONFile = `{
|
|
|
18
18
|
"@emotion/react": "11.11.4",
|
|
19
19
|
"@types/react": "18.2.60",
|
|
20
20
|
"@types/react-dom": "18.2.19",
|
|
21
|
-
"@workday/canvas-kit-labs-react": "13.2.
|
|
22
|
-
"@workday/canvas-kit-preview-react": "13.2.
|
|
23
|
-
"@workday/canvas-kit-react": "13.2.
|
|
24
|
-
"@workday/canvas-kit-react-fonts": "^13.2.
|
|
25
|
-
"@workday/canvas-kit-styling": "13.2.
|
|
21
|
+
"@workday/canvas-kit-labs-react": "13.2.2",
|
|
22
|
+
"@workday/canvas-kit-preview-react": "13.2.2",
|
|
23
|
+
"@workday/canvas-kit-react": "13.2.2",
|
|
24
|
+
"@workday/canvas-kit-react-fonts": "^13.2.2",
|
|
25
|
+
"@workday/canvas-kit-styling": "13.2.2",
|
|
26
26
|
"@workday/canvas-system-icons-web": "3.0.22",
|
|
27
27
|
"@workday/canvas-tokens-web": "2.0.0"
|
|
28
28
|
},
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {InformationHighlight} from '@workday/canvas-kit-preview-react/information-highlight';
|
|
2
2
|
import {Hyperlink} from '@workday/canvas-kit-react/button';
|
|
3
|
-
import {system} from '@workday/canvas-tokens-web'
|
|
3
|
+
import {system} from '@workday/canvas-tokens-web';
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
# Canvas Kit Styling
|
|
@@ -27,7 +27,8 @@ The Canvas Kit styling system consists of two main packages:
|
|
|
27
27
|
- `@workday/canvas-kit-styling` - Core styling utilities for runtime use
|
|
28
28
|
- `@workday/canvas-kit-styling-transform` - Build-time optimization tools
|
|
29
29
|
|
|
30
|
-
These packages work together to provide a CSS-in-JS experience during development while enabling
|
|
30
|
+
These packages work together to provide a CSS-in-JS experience during development while enabling
|
|
31
|
+
optimized static CSS in production.
|
|
31
32
|
|
|
32
33
|
## Installation
|
|
33
34
|
|
|
@@ -55,74 +56,219 @@ const root = createRoot(domNode);
|
|
|
55
56
|
root.render(<div className={myStyles}>Hello!</div>);
|
|
56
57
|
```
|
|
57
58
|
|
|
59
|
+
## Style Merging
|
|
60
|
+
|
|
61
|
+
The `@workday/canvas-kit-styling` package uses `@emotion/css` to inject styles during JavaScript
|
|
62
|
+
evaluation time rather than `@emotion/react` or `@emotion/styled` injecting when a component is
|
|
63
|
+
rendered. This means the Emotion cache needs to be known before any style is created. In order to
|
|
64
|
+
properly merge styles with components using either dynamic styling package, the Emotion cache must
|
|
65
|
+
be changed on any React application. Without this, styles will not be merged correctly when static
|
|
66
|
+
and dynamic styles are used on the same element.
|
|
67
|
+
|
|
68
|
+
If you're using Canvas Kit React, you should use the `<CanvasProvider>` which includes Emotion's
|
|
69
|
+
`<CacheProvider>` with the proper cache already set. If you're not using Canvas Kit React, you
|
|
70
|
+
should use the `<CacheProvider>`:
|
|
71
|
+
|
|
72
|
+
```tsx
|
|
73
|
+
// ONLY use if not using the <CanvasProvider>
|
|
74
|
+
import {getCache} from '@workday/canvas-kit-styling';
|
|
75
|
+
|
|
76
|
+
// in your application bootstrap
|
|
77
|
+
const root = React.createRoot(document.getElementById('root'));
|
|
78
|
+
|
|
79
|
+
root.render(
|
|
80
|
+
<CacheProvider value={getCache()}>
|
|
81
|
+
<App />
|
|
82
|
+
</CacheProvider>
|
|
83
|
+
);
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Known issues
|
|
87
|
+
|
|
88
|
+
### Hot Reloading
|
|
89
|
+
|
|
90
|
+
Style merging works by using CSS specificity rather than JavaScript runtime. This can cause problems
|
|
91
|
+
during hot reloading. If you specify all styles in the same file, hot reloading shouldn't result in
|
|
92
|
+
any style merging problems. But if you use `extends` in `createStencil` that references another
|
|
93
|
+
file, you may run into style merge issues.
|
|
94
|
+
|
|
95
|
+
For example:
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
// base.tsx file
|
|
99
|
+
export const baseStencil = createStencil({
|
|
100
|
+
base: {
|
|
101
|
+
color: 'red',
|
|
102
|
+
},
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
// extended.tsx file
|
|
106
|
+
import {baseStencil} from './base';
|
|
107
|
+
|
|
108
|
+
export const extendedStencil = createStencil({
|
|
109
|
+
extends: baseStencil,
|
|
110
|
+
base: {
|
|
111
|
+
color: 'blue',
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
This will render correctly until you change `color` in `base.tsx` and get a hot reload:
|
|
117
|
+
|
|
118
|
+
```tsx
|
|
119
|
+
// base.tsx file
|
|
120
|
+
export const baseStencil = createStencil({
|
|
121
|
+
base: {
|
|
122
|
+
color: 'purple',
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
The hot reload will evaluate this update and inject a new style.
|
|
128
|
+
|
|
58
129
|
## Development
|
|
59
130
|
|
|
60
|
-
Canvas Kit Styling comes with a runtime that doesn't need anything special for
|
|
61
|
-
runtime uses `@emotion/css` to include your styles on the page.
|
|
131
|
+
Canvas Kit Styling comes with a runtime that doesn't need anything special for development. The
|
|
132
|
+
runtime uses `@emotion/css` to include your styles on the page. If you plan to use static
|
|
133
|
+
compilation, we recommend enabling in production as well so you can fix static compilation errors as
|
|
134
|
+
you develop rather than get errors only in production builds.
|
|
62
135
|
|
|
63
|
-
##
|
|
136
|
+
## Static compilation
|
|
64
137
|
|
|
65
|
-
|
|
66
|
-
|
|
138
|
+
The `@workday/canvas-kit-styling-transform` package can to pre-build styles. This process takes
|
|
139
|
+
style objects and turns them into CSS strings. This process moves serialization and hashing to build
|
|
140
|
+
time rather than browser runtime when `@emotion/css` is processing styles. This will speed up
|
|
141
|
+
production builds at runtime.
|
|
67
142
|
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
143
|
+
Static compilation has stricter requirements than when doing runtime styling. The static compiler
|
|
144
|
+
uses the TypeScript type system to statically analyze style values and thus requires value types to
|
|
145
|
+
be known by TypeScript. See [Restrictions](#restrictions).
|
|
146
|
+
|
|
147
|
+
Static compilation may be required for server side rendering (SSR), especially when using React
|
|
148
|
+
Server Components.
|
|
149
|
+
|
|
150
|
+
### Hash generation
|
|
151
|
+
|
|
152
|
+
Emotion generates hashes based on the serialized style object. This means a style should always give
|
|
153
|
+
the same hash. Static styling hashes differently. Every `createStyles` or `createStencil` call will
|
|
154
|
+
generate a unique hash even if the style object is the same. This is required for proper style
|
|
155
|
+
merging because static styling doesn't give single class names, but rather merges styles using CSS
|
|
156
|
+
specificity.
|
|
157
|
+
|
|
158
|
+
For runtime development, the hash is always unique. For static compilation, the hash is based on the
|
|
159
|
+
start and end character count in the source file of the style block. This is required for SSR so
|
|
160
|
+
that the server and client agree on the same value during hydration. This means that while
|
|
161
|
+
debugging, the hash depends on any code before it. If you add a `console.log` for example, the
|
|
162
|
+
character index of a style block could shift which will generate a new hash.
|
|
163
|
+
|
|
164
|
+
### Restrictions
|
|
165
|
+
|
|
166
|
+
The static compiler uses the TypeScript type checker. The easiest way to think of these restrictions
|
|
167
|
+
is if TypeScript knows the exact value, the static compiler will also know. A simple example:
|
|
168
|
+
|
|
169
|
+
```ts
|
|
170
|
+
// won't work - `value` is a type of `string` because `let` allows a value to be mutated
|
|
171
|
+
let value = 'absolute'; // `string`
|
|
172
|
+
|
|
173
|
+
const myStyles = createStyles({
|
|
174
|
+
position: value, // error - `string` isn't specific enough.
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
// will work - `value` is a type of `'absolute'` because `const` restricts to a string literal
|
|
178
|
+
const value = 'absolute'; // `'absolute'`
|
|
179
|
+
|
|
180
|
+
const myStyles = createStyles({
|
|
181
|
+
position: value, // works. If you mouse over `value` in your editor, you'll see the type is `'absolute'`
|
|
182
|
+
});
|
|
81
183
|
```
|
|
82
184
|
|
|
83
|
-
|
|
84
|
-
[ts-patch](https://www.npmjs.com/package/ts-patch) projects uses the `plugins` when running
|
|
85
|
-
transforms.
|
|
185
|
+
More complex examples may be objects:
|
|
86
186
|
|
|
87
|
-
|
|
187
|
+
```ts
|
|
188
|
+
// won't work. TypeScript will not understand that the position will only be `'absolute'` and makes it a `string` instead
|
|
189
|
+
const reusableStyles = {
|
|
190
|
+
position: 'absolute',
|
|
191
|
+
}; // `{ position: string }`
|
|
88
192
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
to transform code during compilation.
|
|
193
|
+
const myStyles = createStyles({
|
|
194
|
+
...reusableStyles, // error - `position` is a `string` and not specific enough
|
|
195
|
+
});
|
|
93
196
|
|
|
94
|
-
|
|
197
|
+
// will work. Adding `as const` tells TypeScript the object is readonly and therefore no values can change
|
|
198
|
+
const reusableStyles = {
|
|
199
|
+
position: 'absolute',
|
|
200
|
+
} as const; // `{ readonly position: 'absolute' }`
|
|
201
|
+
|
|
202
|
+
const myStyles = createStyles({
|
|
203
|
+
...reusableStyles, // works. If you mouse over, the position is a string literal `'absolute'`
|
|
204
|
+
});
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
Functions are a little more tricky and may require generics.
|
|
208
|
+
|
|
209
|
+
```ts
|
|
210
|
+
// generic makes the type be statically knowable
|
|
211
|
+
function getPosition<V extends 'relative' | 'absolute'>(value: V): {position: V} {
|
|
212
|
+
return {position: value};
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// mouse over `position` in your editor an the type will be `{ position: 'absolute' }`
|
|
216
|
+
const position = getPosition('absolute'); // { position: 'absolute' }
|
|
217
|
+
|
|
218
|
+
const myStyles = createStyles({
|
|
219
|
+
...getPosition('absolute'), // works - `{ position: 'absolute' }`
|
|
220
|
+
});
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
### Webpack
|
|
224
|
+
|
|
225
|
+
The `@webpack/canvas-kit-styling-transform` package comes with a webpack loader that can be added to
|
|
226
|
+
development and/or production.
|
|
95
227
|
|
|
96
228
|
```js
|
|
229
|
+
// import the transform - CJS and ESM are supported
|
|
230
|
+
import {StylingWebpackPlugin} from '@workday/canvas-kit-styling-transform';
|
|
231
|
+
|
|
232
|
+
// somewhere only once. For static webpack config files, this can be near the top.
|
|
233
|
+
// If inside Storybook, Gatsby, Next.js, etc configs, put inside the function that is called that
|
|
234
|
+
// returns a webpack config
|
|
235
|
+
const tsPlugin = const tsPlugin = new StylingWebpackPlugin({
|
|
236
|
+
tsconfigPath: path.resolve(__dirname, '../tsconfig.json'), // allows your TS config to be used
|
|
237
|
+
// A different tsconfig could be used if you want to use TS to transpile to something like ES2019 and
|
|
238
|
+
// also have Babel process the file.
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
// However you need to define rules.
|
|
242
|
+
// This is different for using webpack directly or in Storybook/Gatsby/Next.js/etc
|
|
97
243
|
{
|
|
98
244
|
rules: [
|
|
99
245
|
//...
|
|
100
246
|
{
|
|
101
247
|
test: /.\.tsx?$/,
|
|
102
|
-
|
|
103
|
-
// ts-loader
|
|
248
|
+
use: [
|
|
104
249
|
{
|
|
105
|
-
loader: require.resolve('
|
|
106
|
-
options:
|
|
107
|
-
compiler: 'ts-patch/compiler',
|
|
108
|
-
},
|
|
109
|
-
},
|
|
110
|
-
// OR awesome-typescript-loader
|
|
111
|
-
{
|
|
112
|
-
loader: require.resolve('awesome-typescript-loader'),
|
|
250
|
+
loader: require.resolve('@workday/canvas-kit-styling-transform/webpack-loader'),
|
|
251
|
+
options: tsPlugin.getLoaderOptions(),
|
|
113
252
|
},
|
|
114
253
|
],
|
|
254
|
+
enforce: 'pre'
|
|
115
255
|
},
|
|
116
256
|
];
|
|
257
|
+
// We need to pass the plugin to Webpack's plugin list. Failure to do this will result in a
|
|
258
|
+
// production build hanging
|
|
259
|
+
plugins: [tsPlugin]
|
|
117
260
|
}
|
|
118
261
|
```
|
|
119
262
|
|
|
120
263
|
## Core Styling Approaches for Static Styling
|
|
264
|
+
|
|
121
265
|
For proper static styling there's two methods that you can use to apply styles.
|
|
266
|
+
|
|
122
267
|
1. Using `createStyles` for simple object base styles.
|
|
123
268
|
2. Using `createStencil` for dynamic styles and reusable components.
|
|
124
269
|
|
|
125
|
-
Both approaches are intended to be used in tandem with the `cs` prop when applying styles to our
|
|
270
|
+
Both approaches are intended to be used in tandem with the `cs` prop when applying styles to our
|
|
271
|
+
components.
|
|
126
272
|
|
|
127
273
|
### `cs` Prop
|
|
128
274
|
|
|
@@ -132,7 +278,8 @@ everything together and applies `className` and `style` attributes to a React el
|
|
|
132
278
|
components extend the `cs` prop so that you can statically apply styles to them.
|
|
133
279
|
|
|
134
280
|
> **Important**: While the `cs` prop accepts a style object, **this will not** be considered
|
|
135
|
-
> statically styling an element and you will lose the performance benefits. We plan on providing a
|
|
281
|
+
> statically styling an element and you will lose the performance benefits. We plan on providing a
|
|
282
|
+
> babel plugin to extract these styles statically in a future version.
|
|
136
283
|
|
|
137
284
|
```tsx
|
|
138
285
|
import {system} from '@workday/canvas-tokens-webs';
|
|
@@ -172,15 +319,15 @@ function MyComponent() {
|
|
|
172
319
|
}
|
|
173
320
|
```
|
|
174
321
|
|
|
175
|
-
Most of our components support using the `cs` prop to apply the static styles. It merges
|
|
176
|
-
|
|
322
|
+
Most of our components support using the `cs` prop to apply the static styles. It merges everything
|
|
323
|
+
together and applies `className` and `style` attributes to a React element.
|
|
177
324
|
|
|
178
|
-
<InformationHighlight className="sb-unstyled" cs={{marginBlock: system.space.x4
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
325
|
+
<InformationHighlight className="sb-unstyled" cs={{marginBlock: system.space.x4}}>
|
|
326
|
+
<InformationHighlight.Icon />
|
|
327
|
+
<InformationHighlight.Heading>Information</InformationHighlight.Heading>
|
|
328
|
+
<InformationHighlight.Body>
|
|
329
|
+
For a more in depth overview, please view our <Hyperlink src="https://workday.github.io/canvas-kit/?path=/docs/styling-getting-started-create-styles--docs"> Create Styles </Hyperlink> docs.
|
|
330
|
+
</InformationHighlight.Body>
|
|
184
331
|
</InformationHighlight>
|
|
185
332
|
|
|
186
333
|
### `createStencil`
|
|
@@ -245,10 +392,10 @@ const ThemedCard = ({isDarkTheme, headerColor, elemProps}) => {
|
|
|
245
392
|
};
|
|
246
393
|
```
|
|
247
394
|
|
|
248
|
-
<InformationHighlight className="sb-unstyled" cs={{marginBlock: system.space.x4
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
395
|
+
<InformationHighlight className="sb-unstyled" cs={{marginBlock: system.space.x4}}>
|
|
396
|
+
<InformationHighlight.Icon />
|
|
397
|
+
<InformationHighlight.Heading>Information</InformationHighlight.Heading>
|
|
398
|
+
<InformationHighlight.Body>
|
|
399
|
+
For a more in depth overview, please view our <Hyperlink src="https://workday.github.io/canvas-kit/?path=/docs/styling-getting-started-stencils--docs">Create Stencil</Hyperlink> docs.
|
|
400
|
+
</InformationHighlight.Body>
|
|
254
401
|
</InformationHighlight>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@workday/canvas-kit-docs",
|
|
3
|
-
"version": "14.0.0-alpha.
|
|
3
|
+
"version": "14.0.0-alpha.1167-next.0",
|
|
4
4
|
"description": "Documentation components of Canvas Kit components",
|
|
5
5
|
"author": "Workday, Inc. (https://www.workday.com)",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -45,10 +45,10 @@
|
|
|
45
45
|
"@emotion/styled": "^11.6.0",
|
|
46
46
|
"@stackblitz/sdk": "^1.11.0",
|
|
47
47
|
"@storybook/csf": "0.0.1",
|
|
48
|
-
"@workday/canvas-kit-labs-react": "^14.0.0-alpha.
|
|
49
|
-
"@workday/canvas-kit-preview-react": "^14.0.0-alpha.
|
|
50
|
-
"@workday/canvas-kit-react": "^14.0.0-alpha.
|
|
51
|
-
"@workday/canvas-kit-styling": "^14.0.0-alpha.
|
|
48
|
+
"@workday/canvas-kit-labs-react": "^14.0.0-alpha.1167-next.0",
|
|
49
|
+
"@workday/canvas-kit-preview-react": "^14.0.0-alpha.1167-next.0",
|
|
50
|
+
"@workday/canvas-kit-react": "^14.0.0-alpha.1167-next.0",
|
|
51
|
+
"@workday/canvas-kit-styling": "^14.0.0-alpha.1167-next.0",
|
|
52
52
|
"@workday/canvas-system-icons-web": "^3.0.35",
|
|
53
53
|
"@workday/canvas-tokens-web": "3.0.0-alpha.5",
|
|
54
54
|
"markdown-to-jsx": "^7.2.0",
|
|
@@ -61,5 +61,5 @@
|
|
|
61
61
|
"mkdirp": "^1.0.3",
|
|
62
62
|
"typescript": "5.0"
|
|
63
63
|
},
|
|
64
|
-
"gitHead": "
|
|
64
|
+
"gitHead": "25670463a46bad451356d0550adac0de8b5209b0"
|
|
65
65
|
}
|