@oxide/design-system 6.1.4 → 6.2.0-canary.d8e9792

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/button.css CHANGED
@@ -14,7 +14,7 @@ label {
14
14
  }
15
15
  &.ox-button:after {
16
16
  content: '';
17
- @apply absolute bottom-0 left-0 right-0 top-0 rounded-md border border-current/5;
17
+ @apply absolute top-0 right-0 bottom-0 left-0 rounded-md border border-current/5;
18
18
  }
19
19
  &.btn-primary {
20
20
  @apply text-accent bg-accent hover:bg-accent-hover disabled:text-accent/35 disabled:bg-accent;
@@ -485,6 +485,159 @@ var oxql_tmLanguage_default = {
485
485
  ]
486
486
  };
487
487
 
488
+ // components/src/asciidoc/langs/p4.tmLanguage.json
489
+ var p4_tmLanguage_default = {
490
+ $schema: "https://raw.githubusercontent.com/martinring/tmlanguage/master/tmlanguage.json",
491
+ name: "p4",
492
+ scopeName: "source.p4",
493
+ repository: {
494
+ comment: {
495
+ patterns: [
496
+ {
497
+ name: "comment.line.double-slash.p4",
498
+ match: "//.*$"
499
+ },
500
+ {
501
+ name: "comment.block.p4",
502
+ begin: "/\\*",
503
+ end: "\\*/"
504
+ }
505
+ ]
506
+ },
507
+ keywords: {
508
+ patterns: [
509
+ {
510
+ name: "constant.language.p4",
511
+ match: "\\b(?:false|true)\\b"
512
+ },
513
+ {
514
+ name: "keyword.control.p4",
515
+ match: "\\b(?:default_action|transition|counters|NoAction|optional|actions|control|default|package|ternary|typedef|action|extern|header|meters|parser|return|select|struct|apply|const|exact|inout|range|state|table|else|size|key|lpm|out|if|in|_)\\b"
516
+ },
517
+ {
518
+ name: "storage.type.p4",
519
+ match: "\\b(?:packet_out|packet_in|varbit|error|tuple|bool|bit|int)\\b"
520
+ }
521
+ ]
522
+ }
523
+ },
524
+ patterns: [
525
+ {
526
+ name: "keyword.control.directive.p4",
527
+ match: "^\\s*#\\s*\\w+"
528
+ },
529
+ {
530
+ include: "#comment"
531
+ },
532
+ {
533
+ name: "string.quoted.double.p4",
534
+ begin: '"',
535
+ end: '"',
536
+ patterns: [
537
+ {
538
+ name: "constant.character.escape.p4",
539
+ match: "\\\\."
540
+ }
541
+ ]
542
+ },
543
+ {
544
+ match: "(@)([A-Za-z_]\\w*)",
545
+ captures: {
546
+ "1": {
547
+ name: "punctuation.definition.annotation.p4"
548
+ },
549
+ "2": {
550
+ name: "storage.type.annotation.p4"
551
+ }
552
+ }
553
+ },
554
+ {
555
+ name: "storage.type.p4",
556
+ match: "\\b(?:bit|varbit)\\s*<\\s*\\d+\\s*>|\\btuple\\s*<(?:[^<>]|<[^>]*>)*>"
557
+ },
558
+ {
559
+ name: "constant.numeric.p4",
560
+ match: "\\b(?:\\d+w0x[0-9a-fA-F]+|\\d+w\\d+|0x[0-9a-fA-F]+|\\d+)\\b"
561
+ },
562
+ {
563
+ match: "\\b(typedef|struct|header|extern)\\s+([A-Za-z_]\\w*)",
564
+ captures: {
565
+ "1": {
566
+ name: "keyword.control.p4"
567
+ },
568
+ "2": {
569
+ name: "storage.type.p4"
570
+ }
571
+ }
572
+ },
573
+ {
574
+ match: "\\b(table|parser|control|state|package)\\s+([A-Za-z_]\\w*)",
575
+ captures: {
576
+ "1": {
577
+ name: "keyword.control.p4"
578
+ },
579
+ "2": {
580
+ name: "entity.name.type.p4"
581
+ }
582
+ }
583
+ },
584
+ {
585
+ match: "\\b(action)\\s+([A-Za-z_]\\w*)",
586
+ captures: {
587
+ "1": {
588
+ name: "keyword.control.p4"
589
+ },
590
+ "2": {
591
+ name: "entity.name.function.p4"
592
+ }
593
+ }
594
+ },
595
+ {
596
+ name: "storage.type.p4",
597
+ match: "\\b[A-Za-z_]\\w*_[th]\\b"
598
+ },
599
+ {
600
+ begin: "\\b(actions)\\s*=\\s*\\{",
601
+ end: "\\}",
602
+ beginCaptures: {
603
+ "1": {
604
+ name: "keyword.control.p4"
605
+ }
606
+ },
607
+ patterns: [
608
+ {
609
+ include: "#comment"
610
+ },
611
+ {
612
+ include: "#keywords"
613
+ },
614
+ {
615
+ name: "entity.name.function.p4",
616
+ match: "\\b[A-Za-z_]\\w*\\b"
617
+ }
618
+ ]
619
+ },
620
+ {
621
+ include: "#keywords"
622
+ },
623
+ {
624
+ match: "(\\.)([A-Za-z_]\\w*)(?=\\s*\\()",
625
+ captures: {
626
+ "1": {
627
+ name: "punctuation.accessor.p4"
628
+ },
629
+ "2": {
630
+ name: "entity.name.function.p4"
631
+ }
632
+ }
633
+ },
634
+ {
635
+ name: "entity.name.function.p4",
636
+ match: "(?<!\\.)\\b[A-Za-z_]\\w*(?=\\s*\\()"
637
+ }
638
+ ]
639
+ };
640
+
488
641
  // components/src/asciidoc/oxide-syntax.json
489
642
  var oxide_syntax_default = {
490
643
  name: "Oxide Dark",
@@ -1853,14 +2006,11 @@ var oxide_syntax_default = {
1853
2006
 
1854
2007
  // components/src/asciidoc/util.ts
1855
2008
  var highlighter = null;
1856
- var customLanguages = ["oxql"];
2009
+ var customLanguages = ["oxql", "p4"];
1857
2010
  var supportedLanguages = [...Object.keys(bundledLanguages), ...customLanguages];
1858
- async function getOrCreateHighlighter() {
2011
+ async function getHighlighter() {
1859
2012
  if (!highlighter) {
1860
- const langs = [];
1861
- langs.push({
1862
- ...oxql_tmLanguage_default
1863
- });
2013
+ const langs = [{ ...oxql_tmLanguage_default }, { ...p4_tmLanguage_default }];
1864
2014
  highlighter = await createHighlighter({
1865
2015
  themes: [oxide_syntax_default],
1866
2016
  langs
@@ -1868,6 +2018,18 @@ async function getOrCreateHighlighter() {
1868
2018
  }
1869
2019
  return highlighter;
1870
2020
  }
2021
+ async function highlightCode(code, lang, { inline = false } = {}) {
2022
+ const h = await getHighlighter();
2023
+ const resolved = supportedLanguages.includes(lang) ? lang : "text";
2024
+ if (!h.getLoadedLanguages().includes(resolved)) {
2025
+ await h.loadLanguage(resolved);
2026
+ }
2027
+ return h.codeToHtml(code, {
2028
+ lang: resolved,
2029
+ theme: oxide_syntax_default,
2030
+ ...inline ? { structure: "inline" } : {}
2031
+ });
2032
+ }
1871
2033
  var highlight = async (block) => {
1872
2034
  if (block.type === "listing") {
1873
2035
  const literalBlock = block;
@@ -1889,20 +2051,11 @@ var highlight = async (block) => {
1889
2051
  )
1890
2052
  };
1891
2053
  }
1892
- let lang = literalBlock.language;
1893
- const h = await getOrCreateHighlighter();
1894
- const loadedLanguages = h.getLoadedLanguages();
1895
- if (!supportedLanguages.includes(lang)) {
1896
- lang = "text";
1897
- }
1898
- if (!loadedLanguages.includes(lang)) {
1899
- await h.loadLanguage(lang);
1900
- }
1901
- const highlightedContent = h.codeToHtml(placeholderContent, {
1902
- lang,
1903
- theme: oxide_syntax_default,
1904
- structure: "inline"
1905
- });
2054
+ const highlightedContent = await highlightCode(
2055
+ placeholderContent,
2056
+ literalBlock.language,
2057
+ { inline: true }
2058
+ );
1906
2059
  const restoredContent = highlightedContent.replace(
1907
2060
  /__CALLOUT_PLACEHOLDER_(\d+)__/g,
1908
2061
  (_, index) => callouts[parseInt(index)]