@cyberskill/design 1.0.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/DESIGN.md +267 -0
- package/README.md +316 -0
- package/SKILL.md +64 -0
- package/VERSION +1 -0
- package/_ds_bundle.js +5377 -0
- package/_ds_manifest.json +1 -0
- package/_esm/cs.mjs +137 -0
- package/assets/aurora-gold.jpg +0 -0
- package/assets/aurora-hoa.png +0 -0
- package/assets/aurora-kim.png +0 -0
- package/assets/aurora-moc.png +0 -0
- package/assets/aurora-thuy.png +0 -0
- package/assets/favicon.svg +1 -0
- package/assets/logo-mark.png +0 -0
- package/assets/logo-mark.svg +10 -0
- package/assets/lumi-poster.webp +0 -0
- package/assets/og-dashboard.png +0 -0
- package/base/a11y.css +57 -0
- package/base/ai.css +67 -0
- package/base/collections.css +53 -0
- package/base/components.css +212 -0
- package/base/controls.css +329 -0
- package/base/data.css +48 -0
- package/base/feedback.css +60 -0
- package/base/forms.css +32 -0
- package/base/glass.css +119 -0
- package/base/interaction.css +50 -0
- package/base/navigation.css +39 -0
- package/base/reset.css +17 -0
- package/base/responsive.css +128 -0
- package/base/shell.css +55 -0
- package/base/typography.css +14 -0
- package/components/_i18n/i18n.js +56 -0
- package/components/_i18n/strings.js +187 -0
- package/components/_utils/cx.js +4 -0
- package/components/ai/AIDisclosureBadge.d.ts +16 -0
- package/components/ai/AIDisclosureBadge.figma.tsx +12 -0
- package/components/ai/AIDisclosureBadge.jsx +39 -0
- package/components/ai/AIDisclosureBadge.prompt.md +9 -0
- package/components/ai/ChatMessage.d.ts +17 -0
- package/components/ai/ChatMessage.figma.tsx +12 -0
- package/components/ai/ChatMessage.jsx +22 -0
- package/components/ai/ChatMessage.prompt.md +8 -0
- package/components/ai/CitationList.d.ts +13 -0
- package/components/ai/CitationList.figma.tsx +12 -0
- package/components/ai/CitationList.jsx +22 -0
- package/components/ai/CitationList.prompt.md +5 -0
- package/components/ai/ConfidenceMeter.d.ts +17 -0
- package/components/ai/ConfidenceMeter.figma.tsx +12 -0
- package/components/ai/ConfidenceMeter.jsx +43 -0
- package/components/ai/ConfidenceMeter.prompt.md +6 -0
- package/components/ai/HumanReviewGate.d.ts +20 -0
- package/components/ai/HumanReviewGate.figma.tsx +12 -0
- package/components/ai/HumanReviewGate.jsx +37 -0
- package/components/ai/HumanReviewGate.prompt.md +13 -0
- package/components/ai/PromptInput.d.ts +21 -0
- package/components/ai/PromptInput.figma.tsx +12 -0
- package/components/ai/PromptInput.jsx +48 -0
- package/components/ai/PromptInput.prompt.md +5 -0
- package/components/ai/PromptSuggestions.d.ts +12 -0
- package/components/ai/PromptSuggestions.figma.tsx +12 -0
- package/components/ai/PromptSuggestions.jsx +20 -0
- package/components/ai/PromptSuggestions.prompt.md +5 -0
- package/components/ai/TypingIndicator.d.ts +9 -0
- package/components/ai/TypingIndicator.figma.tsx +12 -0
- package/components/ai/TypingIndicator.jsx +14 -0
- package/components/ai/TypingIndicator.prompt.md +5 -0
- package/components/ai/ai-conversation.card.html +49 -0
- package/components/ai/ai-lumi.card.html +39 -0
- package/components/ai/ai.card.html +43 -0
- package/components/brand/LumiAvatar.d.ts +14 -0
- package/components/brand/LumiAvatar.figma.tsx +12 -0
- package/components/brand/LumiAvatar.jsx +11 -0
- package/components/brand/LumiAvatar.prompt.md +5 -0
- package/components/brand/brand.card.html +37 -0
- package/components/button/Button.d.ts +24 -0
- package/components/button/Button.figma.tsx +31 -0
- package/components/button/Button.jsx +42 -0
- package/components/button/Button.prompt.md +12 -0
- package/components/button/ButtonGroup.d.ts +11 -0
- package/components/button/ButtonGroup.figma.tsx +12 -0
- package/components/button/ButtonGroup.jsx +7 -0
- package/components/button/ButtonGroup.prompt.md +8 -0
- package/components/button/FloatingActionButton.d.ts +15 -0
- package/components/button/FloatingActionButton.figma.tsx +12 -0
- package/components/button/FloatingActionButton.jsx +20 -0
- package/components/button/FloatingActionButton.prompt.md +6 -0
- package/components/button/buttons.card.html +52 -0
- package/components/data/Accordion.d.ts +14 -0
- package/components/data/Accordion.figma.tsx +12 -0
- package/components/data/Accordion.jsx +25 -0
- package/components/data/Accordion.prompt.md +5 -0
- package/components/data/Avatar.d.ts +18 -0
- package/components/data/Avatar.figma.tsx +12 -0
- package/components/data/Avatar.jsx +17 -0
- package/components/data/Avatar.prompt.md +6 -0
- package/components/data/Card.d.ts +23 -0
- package/components/data/Card.figma.tsx +12 -0
- package/components/data/Card.jsx +27 -0
- package/components/data/Card.prompt.md +9 -0
- package/components/data/Carousel.d.ts +13 -0
- package/components/data/Carousel.figma.tsx +12 -0
- package/components/data/Carousel.jsx +26 -0
- package/components/data/Carousel.prompt.md +5 -0
- package/components/data/Chart.d.ts +17 -0
- package/components/data/Chart.figma.tsx +12 -0
- package/components/data/Chart.jsx +52 -0
- package/components/data/Chart.prompt.md +5 -0
- package/components/data/CodeBlock.d.ts +12 -0
- package/components/data/CodeBlock.figma.tsx +12 -0
- package/components/data/CodeBlock.jsx +21 -0
- package/components/data/CodeBlock.prompt.md +5 -0
- package/components/data/Comment.d.ts +18 -0
- package/components/data/Comment.figma.tsx +12 -0
- package/components/data/Comment.jsx +24 -0
- package/components/data/Comment.prompt.md +7 -0
- package/components/data/DescriptionList.d.ts +10 -0
- package/components/data/DescriptionList.figma.tsx +12 -0
- package/components/data/DescriptionList.jsx +16 -0
- package/components/data/DescriptionList.prompt.md +5 -0
- package/components/data/Divider.d.ts +13 -0
- package/components/data/Divider.figma.tsx +12 -0
- package/components/data/Divider.jsx +11 -0
- package/components/data/Divider.prompt.md +6 -0
- package/components/data/Image.d.ts +18 -0
- package/components/data/Image.figma.tsx +12 -0
- package/components/data/Image.jsx +37 -0
- package/components/data/Image.prompt.md +5 -0
- package/components/data/Kbd.d.ts +8 -0
- package/components/data/Kbd.figma.tsx +12 -0
- package/components/data/Kbd.jsx +7 -0
- package/components/data/Kbd.prompt.md +5 -0
- package/components/data/List.d.ts +16 -0
- package/components/data/List.figma.tsx +12 -0
- package/components/data/List.jsx +24 -0
- package/components/data/List.prompt.md +7 -0
- package/components/data/Masonry.d.ts +13 -0
- package/components/data/Masonry.figma.tsx +12 -0
- package/components/data/Masonry.jsx +11 -0
- package/components/data/Masonry.prompt.md +5 -0
- package/components/data/QRCode.d.ts +12 -0
- package/components/data/QRCode.figma.tsx +12 -0
- package/components/data/QRCode.jsx +17 -0
- package/components/data/QRCode.prompt.md +5 -0
- package/components/data/Sortable.d.ts +10 -0
- package/components/data/Sortable.figma.tsx +12 -0
- package/components/data/Sortable.jsx +30 -0
- package/components/data/Sortable.prompt.md +5 -0
- package/components/data/Splitter.d.ts +16 -0
- package/components/data/Splitter.figma.tsx +12 -0
- package/components/data/Splitter.jsx +31 -0
- package/components/data/Splitter.prompt.md +5 -0
- package/components/data/Stat.d.ts +15 -0
- package/components/data/Stat.figma.tsx +12 -0
- package/components/data/Stat.jsx +19 -0
- package/components/data/Stat.prompt.md +5 -0
- package/components/data/Terminal.d.ts +13 -0
- package/components/data/Terminal.figma.tsx +12 -0
- package/components/data/Terminal.jsx +32 -0
- package/components/data/Terminal.prompt.md +5 -0
- package/components/data/Timeline.d.ts +17 -0
- package/components/data/Timeline.figma.tsx +12 -0
- package/components/data/Timeline.jsx +20 -0
- package/components/data/Timeline.prompt.md +8 -0
- package/components/data/Tooltip.d.ts +14 -0
- package/components/data/Tooltip.figma.tsx +12 -0
- package/components/data/Tooltip.jsx +12 -0
- package/components/data/Tooltip.prompt.md +5 -0
- package/components/data/Tree.d.ts +13 -0
- package/components/data/Tree.figma.tsx +12 -0
- package/components/data/Tree.jsx +23 -0
- package/components/data/Tree.prompt.md +5 -0
- package/components/data/Watermark.d.ts +15 -0
- package/components/data/Watermark.figma.tsx +12 -0
- package/components/data/Watermark.jsx +15 -0
- package/components/data/Watermark.prompt.md +5 -0
- package/components/data/collections.card.html +52 -0
- package/components/data/data.card.html +50 -0
- package/components/data/qr-encode.js +80 -0
- package/components/datatable/DataGrid.d.ts +42 -0
- package/components/datatable/DataGrid.figma.tsx +12 -0
- package/components/datatable/DataGrid.jsx +149 -0
- package/components/datatable/DataGrid.prompt.md +12 -0
- package/components/datatable/DataTable.d.ts +25 -0
- package/components/datatable/DataTable.figma.tsx +12 -0
- package/components/datatable/DataTable.jsx +42 -0
- package/components/datatable/DataTable.prompt.md +15 -0
- package/components/datatable/TreeTable.d.ts +14 -0
- package/components/datatable/TreeTable.figma.tsx +12 -0
- package/components/datatable/TreeTable.jsx +47 -0
- package/components/datatable/TreeTable.prompt.md +6 -0
- package/components/datatable/datatable.card.html +51 -0
- package/components/dialog/Dialog.d.ts +22 -0
- package/components/dialog/Dialog.figma.tsx +12 -0
- package/components/dialog/Dialog.jsx +99 -0
- package/components/dialog/Dialog.prompt.md +17 -0
- package/components/dialog/dialog.card.html +46 -0
- package/components/feedback/Alert.d.ts +16 -0
- package/components/feedback/Alert.figma.tsx +17 -0
- package/components/feedback/Alert.jsx +29 -0
- package/components/feedback/Alert.prompt.md +6 -0
- package/components/feedback/Badge.d.ts +15 -0
- package/components/feedback/Badge.figma.tsx +12 -0
- package/components/feedback/Badge.jsx +12 -0
- package/components/feedback/Badge.prompt.md +6 -0
- package/components/feedback/EmptyState.d.ts +13 -0
- package/components/feedback/EmptyState.figma.tsx +12 -0
- package/components/feedback/EmptyState.jsx +16 -0
- package/components/feedback/EmptyState.prompt.md +7 -0
- package/components/feedback/ProgressBar.d.ts +15 -0
- package/components/feedback/ProgressBar.figma.tsx +12 -0
- package/components/feedback/ProgressBar.jsx +13 -0
- package/components/feedback/ProgressBar.prompt.md +5 -0
- package/components/feedback/Result.d.ts +15 -0
- package/components/feedback/Result.figma.tsx +12 -0
- package/components/feedback/Result.jsx +24 -0
- package/components/feedback/Result.prompt.md +7 -0
- package/components/feedback/Skeleton.d.ts +18 -0
- package/components/feedback/Skeleton.figma.tsx +12 -0
- package/components/feedback/Skeleton.jsx +22 -0
- package/components/feedback/Skeleton.prompt.md +6 -0
- package/components/feedback/Spinner.d.ts +11 -0
- package/components/feedback/Spinner.figma.tsx +12 -0
- package/components/feedback/Spinner.jsx +10 -0
- package/components/feedback/Spinner.prompt.md +5 -0
- package/components/feedback/StatusIndicator.d.ts +11 -0
- package/components/feedback/StatusIndicator.figma.tsx +12 -0
- package/components/feedback/StatusIndicator.jsx +12 -0
- package/components/feedback/StatusIndicator.prompt.md +5 -0
- package/components/feedback/Tag.d.ts +14 -0
- package/components/feedback/Tag.figma.tsx +12 -0
- package/components/feedback/Tag.jsx +19 -0
- package/components/feedback/Tag.prompt.md +6 -0
- package/components/feedback/Toast.d.ts +19 -0
- package/components/feedback/Toast.figma.tsx +12 -0
- package/components/feedback/Toast.jsx +30 -0
- package/components/feedback/Toast.prompt.md +7 -0
- package/components/feedback/feedback-2.card.html +43 -0
- package/components/feedback/feedback.card.html +50 -0
- package/components/forms/Calendar.d.ts +10 -0
- package/components/forms/Calendar.figma.tsx +12 -0
- package/components/forms/Calendar.jsx +43 -0
- package/components/forms/Calendar.prompt.md +5 -0
- package/components/forms/Cascader.d.ts +17 -0
- package/components/forms/Cascader.figma.tsx +12 -0
- package/components/forms/Cascader.jsx +58 -0
- package/components/forms/Cascader.prompt.md +5 -0
- package/components/forms/Checkbox.d.ts +13 -0
- package/components/forms/Checkbox.figma.tsx +12 -0
- package/components/forms/Checkbox.jsx +16 -0
- package/components/forms/Checkbox.prompt.md +6 -0
- package/components/forms/ColorPicker.d.ts +12 -0
- package/components/forms/ColorPicker.figma.tsx +12 -0
- package/components/forms/ColorPicker.jsx +44 -0
- package/components/forms/ColorPicker.prompt.md +5 -0
- package/components/forms/Combobox.d.ts +17 -0
- package/components/forms/Combobox.figma.tsx +12 -0
- package/components/forms/Combobox.jsx +49 -0
- package/components/forms/Combobox.prompt.md +6 -0
- package/components/forms/DatePicker.d.ts +15 -0
- package/components/forms/DatePicker.figma.tsx +12 -0
- package/components/forms/DatePicker.jsx +35 -0
- package/components/forms/DatePicker.prompt.md +5 -0
- package/components/forms/Editor.d.ts +12 -0
- package/components/forms/Editor.figma.tsx +12 -0
- package/components/forms/Editor.jsx +26 -0
- package/components/forms/Editor.prompt.md +5 -0
- package/components/forms/FileUpload.d.ts +14 -0
- package/components/forms/FileUpload.figma.tsx +12 -0
- package/components/forms/FileUpload.jsx +29 -0
- package/components/forms/FileUpload.prompt.md +5 -0
- package/components/forms/Form.d.ts +87 -0
- package/components/forms/Form.figma.tsx +12 -0
- package/components/forms/Form.jsx +316 -0
- package/components/forms/Form.prompt.md +46 -0
- package/components/forms/InlineEdit.d.ts +13 -0
- package/components/forms/InlineEdit.figma.tsx +12 -0
- package/components/forms/InlineEdit.jsx +27 -0
- package/components/forms/InlineEdit.prompt.md +5 -0
- package/components/forms/InputGroup.d.ts +20 -0
- package/components/forms/InputGroup.figma.tsx +12 -0
- package/components/forms/InputGroup.jsx +25 -0
- package/components/forms/InputGroup.prompt.md +6 -0
- package/components/forms/InputOTP.d.ts +16 -0
- package/components/forms/InputOTP.figma.tsx +12 -0
- package/components/forms/InputOTP.jsx +47 -0
- package/components/forms/InputOTP.prompt.md +5 -0
- package/components/forms/Mentions.d.ts +13 -0
- package/components/forms/Mentions.figma.tsx +12 -0
- package/components/forms/Mentions.jsx +31 -0
- package/components/forms/Mentions.prompt.md +5 -0
- package/components/forms/NumberField.d.ts +14 -0
- package/components/forms/NumberField.figma.tsx +12 -0
- package/components/forms/NumberField.jsx +21 -0
- package/components/forms/NumberField.prompt.md +5 -0
- package/components/forms/RadioGroup.d.ts +24 -0
- package/components/forms/RadioGroup.figma.tsx +12 -0
- package/components/forms/RadioGroup.jsx +32 -0
- package/components/forms/RadioGroup.prompt.md +6 -0
- package/components/forms/Rating.d.ts +16 -0
- package/components/forms/Rating.figma.tsx +12 -0
- package/components/forms/Rating.jsx +22 -0
- package/components/forms/Rating.prompt.md +6 -0
- package/components/forms/SearchField.d.ts +11 -0
- package/components/forms/SearchField.figma.tsx +12 -0
- package/components/forms/SearchField.jsx +25 -0
- package/components/forms/SearchField.prompt.md +5 -0
- package/components/forms/SegmentedControl.d.ts +13 -0
- package/components/forms/SegmentedControl.figma.tsx +12 -0
- package/components/forms/SegmentedControl.jsx +31 -0
- package/components/forms/SegmentedControl.prompt.md +6 -0
- package/components/forms/Select.d.ts +19 -0
- package/components/forms/Select.figma.tsx +12 -0
- package/components/forms/Select.jsx +27 -0
- package/components/forms/Select.prompt.md +6 -0
- package/components/forms/Slider.d.ts +6 -0
- package/components/forms/Slider.figma.tsx +12 -0
- package/components/forms/Slider.jsx +8 -0
- package/components/forms/Slider.prompt.md +5 -0
- package/components/forms/Switch.d.ts +12 -0
- package/components/forms/Switch.figma.tsx +12 -0
- package/components/forms/Switch.jsx +14 -0
- package/components/forms/Switch.prompt.md +5 -0
- package/components/forms/TagInput.d.ts +16 -0
- package/components/forms/TagInput.figma.tsx +12 -0
- package/components/forms/TagInput.jsx +39 -0
- package/components/forms/TagInput.prompt.md +5 -0
- package/components/forms/Textarea.d.ts +14 -0
- package/components/forms/Textarea.figma.tsx +12 -0
- package/components/forms/Textarea.jsx +19 -0
- package/components/forms/Textarea.prompt.md +5 -0
- package/components/forms/TimePicker.d.ts +16 -0
- package/components/forms/TimePicker.figma.tsx +12 -0
- package/components/forms/TimePicker.jsx +22 -0
- package/components/forms/TimePicker.prompt.md +5 -0
- package/components/forms/Toggle.d.ts +16 -0
- package/components/forms/Toggle.figma.tsx +12 -0
- package/components/forms/Toggle.jsx +15 -0
- package/components/forms/Toggle.prompt.md +6 -0
- package/components/forms/Transfer.d.ts +14 -0
- package/components/forms/Transfer.figma.tsx +12 -0
- package/components/forms/Transfer.jsx +41 -0
- package/components/forms/Transfer.prompt.md +5 -0
- package/components/forms/TreeSelect.d.ts +15 -0
- package/components/forms/TreeSelect.figma.tsx +12 -0
- package/components/forms/TreeSelect.jsx +35 -0
- package/components/forms/TreeSelect.prompt.md +5 -0
- package/components/forms/forms-2.card.html +40 -0
- package/components/forms/forms.card.html +40 -0
- package/components/icon/Icon.d.ts +26 -0
- package/components/icon/Icon.figma.tsx +12 -0
- package/components/icon/Icon.jsx +74 -0
- package/components/icon/Icon.prompt.md +8 -0
- package/components/icon/icon.card.html +38 -0
- package/components/logo/Logo.d.ts +18 -0
- package/components/logo/Logo.figma.tsx +12 -0
- package/components/logo/Logo.jsx +25 -0
- package/components/logo/Logo.prompt.md +10 -0
- package/components/logo/logo-data.js +214 -0
- package/components/logo/logo.card.html +44 -0
- package/components/navigation/Anchor.d.ts +11 -0
- package/components/navigation/Anchor.figma.tsx +12 -0
- package/components/navigation/Anchor.jsx +25 -0
- package/components/navigation/Anchor.prompt.md +5 -0
- package/components/navigation/BackTop.d.ts +9 -0
- package/components/navigation/BackTop.figma.tsx +12 -0
- package/components/navigation/BackTop.jsx +23 -0
- package/components/navigation/BackTop.prompt.md +5 -0
- package/components/navigation/Breadcrumb.d.ts +14 -0
- package/components/navigation/Breadcrumb.figma.tsx +12 -0
- package/components/navigation/Breadcrumb.jsx +24 -0
- package/components/navigation/Breadcrumb.prompt.md +5 -0
- package/components/navigation/CommandPalette.d.ts +19 -0
- package/components/navigation/CommandPalette.figma.tsx +12 -0
- package/components/navigation/CommandPalette.jsx +48 -0
- package/components/navigation/CommandPalette.prompt.md +7 -0
- package/components/navigation/Dock.d.ts +6 -0
- package/components/navigation/Dock.figma.tsx +12 -0
- package/components/navigation/Dock.jsx +22 -0
- package/components/navigation/Dock.prompt.md +5 -0
- package/components/navigation/HotKeys.d.ts +13 -0
- package/components/navigation/HotKeys.figma.tsx +12 -0
- package/components/navigation/HotKeys.jsx +44 -0
- package/components/navigation/HotKeys.prompt.md +5 -0
- package/components/navigation/Link.d.ts +12 -0
- package/components/navigation/Link.figma.tsx +12 -0
- package/components/navigation/Link.jsx +13 -0
- package/components/navigation/Link.prompt.md +5 -0
- package/components/navigation/Menu.d.ts +23 -0
- package/components/navigation/Menu.figma.tsx +12 -0
- package/components/navigation/Menu.jsx +36 -0
- package/components/navigation/Menu.prompt.md +9 -0
- package/components/navigation/Menubar.d.ts +7 -0
- package/components/navigation/Menubar.figma.tsx +12 -0
- package/components/navigation/Menubar.jsx +48 -0
- package/components/navigation/Menubar.prompt.md +5 -0
- package/components/navigation/NavigationMenu.d.ts +7 -0
- package/components/navigation/NavigationMenu.figma.tsx +12 -0
- package/components/navigation/NavigationMenu.jsx +38 -0
- package/components/navigation/NavigationMenu.prompt.md +5 -0
- package/components/navigation/Pagination.d.ts +13 -0
- package/components/navigation/Pagination.figma.tsx +12 -0
- package/components/navigation/Pagination.jsx +32 -0
- package/components/navigation/Pagination.prompt.md +5 -0
- package/components/navigation/Sidebar.d.ts +20 -0
- package/components/navigation/Sidebar.figma.tsx +12 -0
- package/components/navigation/Sidebar.jsx +24 -0
- package/components/navigation/Sidebar.prompt.md +8 -0
- package/components/navigation/Steps.d.ts +13 -0
- package/components/navigation/Steps.figma.tsx +12 -0
- package/components/navigation/Steps.jsx +20 -0
- package/components/navigation/Steps.prompt.md +5 -0
- package/components/navigation/Tabs.d.ts +21 -0
- package/components/navigation/Tabs.figma.tsx +12 -0
- package/components/navigation/Tabs.jsx +41 -0
- package/components/navigation/Tabs.prompt.md +6 -0
- package/components/navigation/Toolbar.d.ts +16 -0
- package/components/navigation/Toolbar.figma.tsx +12 -0
- package/components/navigation/Toolbar.jsx +32 -0
- package/components/navigation/Toolbar.prompt.md +5 -0
- package/components/navigation/navigation.card.html +51 -0
- package/components/navigation/shell.card.html +52 -0
- package/components/overlays/ContextMenu.d.ts +10 -0
- package/components/overlays/ContextMenu.figma.tsx +12 -0
- package/components/overlays/ContextMenu.jsx +28 -0
- package/components/overlays/ContextMenu.prompt.md +7 -0
- package/components/overlays/Drawer.d.ts +18 -0
- package/components/overlays/Drawer.figma.tsx +12 -0
- package/components/overlays/Drawer.jsx +44 -0
- package/components/overlays/Drawer.prompt.md +8 -0
- package/components/overlays/HoverCard.d.ts +13 -0
- package/components/overlays/HoverCard.figma.tsx +12 -0
- package/components/overlays/HoverCard.jsx +17 -0
- package/components/overlays/HoverCard.prompt.md +5 -0
- package/components/overlays/Popconfirm.d.ts +18 -0
- package/components/overlays/Popconfirm.figma.tsx +12 -0
- package/components/overlays/Popconfirm.jsx +33 -0
- package/components/overlays/Popconfirm.prompt.md +6 -0
- package/components/overlays/Popover.d.ts +17 -0
- package/components/overlays/Popover.figma.tsx +12 -0
- package/components/overlays/Popover.jsx +24 -0
- package/components/overlays/Popover.prompt.md +7 -0
- package/components/overlays/Tour.d.ts +13 -0
- package/components/overlays/Tour.figma.tsx +12 -0
- package/components/overlays/Tour.jsx +46 -0
- package/components/overlays/Tour.prompt.md +5 -0
- package/components/overlays/overlays.card.html +50 -0
- package/components/textfield/TextField.d.ts +18 -0
- package/components/textfield/TextField.figma.tsx +14 -0
- package/components/textfield/TextField.jsx +44 -0
- package/components/textfield/TextField.prompt.md +11 -0
- package/components/textfield/textfield.card.html +34 -0
- package/docs/ci-cd.md +84 -0
- package/docs/consuming.md +109 -0
- package/docs/contrast-report.md +125 -0
- package/docs/conventions.md +114 -0
- package/docs/decisions.md +94 -0
- package/docs/deploy.md +110 -0
- package/docs/design-styles.md +25 -0
- package/docs/figma.md +119 -0
- package/docs/live-hub.md +58 -0
- package/docs/products.md +26 -0
- package/docs/quality-gates.md +94 -0
- package/docs/release-notes.md +31 -0
- package/docs/storybook.md +56 -0
- package/docs/sync.md +48 -0
- package/docs/template-schema-v2.md +36 -0
- package/docs/vi/ci-cd.md +84 -0
- package/docs/vi/consuming.md +109 -0
- package/docs/vi/contrast-report.md +125 -0
- package/docs/vi/conventions.md +114 -0
- package/docs/vi/decisions.md +94 -0
- package/docs/vi/deploy.md +110 -0
- package/docs/vi/design-styles.md +25 -0
- package/docs/vi/figma.md +119 -0
- package/docs/vi/live-hub.md +58 -0
- package/docs/vi/products.md +26 -0
- package/docs/vi/quality-gates.md +94 -0
- package/docs/vi/release-notes.md +31 -0
- package/docs/vi/storybook.md +56 -0
- package/docs/vi/sync.md +48 -0
- package/docs/vi/template-schema-v2.md +36 -0
- package/docs/viewer.html +230 -0
- package/fonts/bevietnampro-300-latin-ext.woff2 +0 -0
- package/fonts/bevietnampro-300-latin.woff2 +0 -0
- package/fonts/bevietnampro-300-vietnamese.woff2 +0 -0
- package/fonts/bevietnampro-400-latin-ext.woff2 +0 -0
- package/fonts/bevietnampro-400-latin.woff2 +0 -0
- package/fonts/bevietnampro-400-vietnamese.woff2 +0 -0
- package/fonts/bevietnampro-400i-latin-ext.woff2 +0 -0
- package/fonts/bevietnampro-400i-latin.woff2 +0 -0
- package/fonts/bevietnampro-400i-vietnamese.woff2 +0 -0
- package/fonts/bevietnampro-500-latin-ext.woff2 +0 -0
- package/fonts/bevietnampro-500-latin.woff2 +0 -0
- package/fonts/bevietnampro-500-vietnamese.woff2 +0 -0
- package/fonts/bevietnampro-600-latin-ext.woff2 +0 -0
- package/fonts/bevietnampro-600-latin.woff2 +0 -0
- package/fonts/bevietnampro-600-vietnamese.woff2 +0 -0
- package/fonts/bevietnampro-600i-latin-ext.woff2 +0 -0
- package/fonts/bevietnampro-600i-latin.woff2 +0 -0
- package/fonts/bevietnampro-600i-vietnamese.woff2 +0 -0
- package/fonts/bevietnampro-700-latin-ext.woff2 +0 -0
- package/fonts/bevietnampro-700-latin.woff2 +0 -0
- package/fonts/bevietnampro-700-vietnamese.woff2 +0 -0
- package/fonts/bevietnampro-800-latin-ext.woff2 +0 -0
- package/fonts/bevietnampro-800-latin.woff2 +0 -0
- package/fonts/bevietnampro-800-vietnamese.woff2 +0 -0
- package/fonts/jetbrainsmono-400-cyrillic-ext.woff2 +0 -0
- package/fonts/jetbrainsmono-400-cyrillic.woff2 +0 -0
- package/fonts/jetbrainsmono-400-greek.woff2 +0 -0
- package/fonts/jetbrainsmono-400-latin-ext.woff2 +0 -0
- package/fonts/jetbrainsmono-400-latin.woff2 +0 -0
- package/fonts/jetbrainsmono-400-vietnamese.woff2 +0 -0
- package/fonts/jetbrainsmono-500-cyrillic-ext.woff2 +0 -0
- package/fonts/jetbrainsmono-500-cyrillic.woff2 +0 -0
- package/fonts/jetbrainsmono-500-greek.woff2 +0 -0
- package/fonts/jetbrainsmono-500-latin-ext.woff2 +0 -0
- package/fonts/jetbrainsmono-500-latin.woff2 +0 -0
- package/fonts/jetbrainsmono-500-vietnamese.woff2 +0 -0
- package/fonts/jetbrainsmono-700-cyrillic-ext.woff2 +0 -0
- package/fonts/jetbrainsmono-700-cyrillic.woff2 +0 -0
- package/fonts/jetbrainsmono-700-greek.woff2 +0 -0
- package/fonts/jetbrainsmono-700-latin-ext.woff2 +0 -0
- package/fonts/jetbrainsmono-700-latin.woff2 +0 -0
- package/fonts/jetbrainsmono-700-vietnamese.woff2 +0 -0
- package/guidelines/atomic-view.html +497 -0
- package/guidelines/brand-iconography.html +51 -0
- package/guidelines/brand-imagery.html +23 -0
- package/guidelines/brand-interaction.html +24 -0
- package/guidelines/brand-voice.html +24 -0
- package/guidelines/colors-anchors.html +20 -0
- package/guidelines/colors-semantic.html +19 -0
- package/guidelines/colors-surfaces.html +19 -0
- package/guidelines/colors-text.html +20 -0
- package/guidelines/documents.html +43 -0
- package/guidelines/elements-components.html +27 -0
- package/guidelines/elements-concept.html +48 -0
- package/guidelines/elements-variants.html +49 -0
- package/guidelines/motion-interaction.html +29 -0
- package/guidelines/motion.html +53 -0
- package/guidelines/nav-model.cjs +113 -0
- package/guidelines/responsive-bilingual.html +75 -0
- package/guidelines/rtl-preview.html +115 -0
- package/guidelines/spacing-breakpoints.html +20 -0
- package/guidelines/spacing-radius.html +19 -0
- package/guidelines/spacing-scale.html +21 -0
- package/guidelines/surfaces-aurora.html +20 -0
- package/guidelines/surfaces-depth.html +27 -0
- package/guidelines/surfaces-glass.html +21 -0
- package/guidelines/surfaces-shadow.html +20 -0
- package/guidelines/type-families.html +25 -0
- package/guidelines/type-lineheight.html +16 -0
- package/guidelines/type-scale.html +21 -0
- package/guidelines/type-weights.html +20 -0
- package/llms.txt +70 -0
- package/package.json +88 -0
- package/styles.css +39 -0
- package/templates/_vendor/deck-stage.js +2584 -0
- package/templates/ai-cluster-demo.html +46 -0
- package/templates/app-shell/.thumbnail +0 -0
- package/templates/app-shell/AppShell.dc.html +80 -0
- package/templates/app-shell/content-schema.json +114 -0
- package/templates/app-shell/ds-base.js +23 -0
- package/templates/app-shell/support.js +1841 -0
- package/templates/article/.thumbnail +0 -0
- package/templates/article/Article.dc.html +67 -0
- package/templates/article/content-schema.json +80 -0
- package/templates/article/ds-base.js +23 -0
- package/templates/article/support.js +1841 -0
- package/templates/auth/.thumbnail +0 -0
- package/templates/auth/Auth.dc.html +72 -0
- package/templates/auth/content-schema.json +74 -0
- package/templates/auth/ds-base.js +23 -0
- package/templates/auth/support.js +1841 -0
- package/templates/bod-deck/.thumbnail +0 -0
- package/templates/bod-deck/BodDeck.dc.html +106 -0
- package/templates/bod-deck/content-schema.json +171 -0
- package/templates/bod-deck/ds-base.js +23 -0
- package/templates/bod-deck/support.js +1841 -0
- package/templates/bod-investor-update/.thumbnail +0 -0
- package/templates/bod-investor-update/BodInvestorUpdate.dc.html +81 -0
- package/templates/bod-investor-update/content-schema.json +105 -0
- package/templates/bod-investor-update/ds-base.js +23 -0
- package/templates/bod-investor-update/support.js +1841 -0
- package/templates/bod-memo/.thumbnail +0 -0
- package/templates/bod-memo/BodMemo.dc.html +87 -0
- package/templates/bod-memo/ds-base.js +23 -0
- package/templates/bod-memo/support.js +1841 -0
- package/templates/bod-minutes/.thumbnail +0 -0
- package/templates/bod-minutes/BodMinutes.dc.html +84 -0
- package/templates/bod-minutes/ds-base.js +23 -0
- package/templates/bod-minutes/support.js +1841 -0
- package/templates/bod-report/.thumbnail +0 -0
- package/templates/bod-report/BodReport.dc.html +106 -0
- package/templates/bod-report/content-schema.json +29 -0
- package/templates/bod-report/ds-base.js +23 -0
- package/templates/bod-report/support.js +1841 -0
- package/templates/bod-resolution/.thumbnail +0 -0
- package/templates/bod-resolution/BodResolution.dc.html +87 -0
- package/templates/bod-resolution/content-schema.json +123 -0
- package/templates/bod-resolution/ds-base.js +23 -0
- package/templates/bod-resolution/support.js +1841 -0
- package/templates/culture-event-invite/.thumbnail +0 -0
- package/templates/culture-event-invite/CultureEventInvite.dc.html +73 -0
- package/templates/culture-event-invite/ds-base.js +23 -0
- package/templates/culture-event-invite/support.js +1841 -0
- package/templates/dashboard/.thumbnail +0 -0
- package/templates/dashboard/Dashboard.dc.html +120 -0
- package/templates/dashboard/content-schema.json +97 -0
- package/templates/dashboard/ds-base.js +23 -0
- package/templates/dashboard/support.js +1841 -0
- package/templates/delivery-change-note/.thumbnail +0 -0
- package/templates/delivery-change-note/DeliveryChangeNote.dc.html +85 -0
- package/templates/delivery-change-note/content-schema.json +158 -0
- package/templates/delivery-change-note/ds-base.js +23 -0
- package/templates/delivery-change-note/support.js +1841 -0
- package/templates/delivery-kickoff/.thumbnail +0 -0
- package/templates/delivery-kickoff/DeliveryKickoff.dc.html +112 -0
- package/templates/delivery-kickoff/content-schema.json +223 -0
- package/templates/delivery-kickoff/ds-base.js +23 -0
- package/templates/delivery-kickoff/support.js +1841 -0
- package/templates/delivery-qbr-deck/.thumbnail +0 -0
- package/templates/delivery-qbr-deck/DeliveryQbrDeck.dc.html +118 -0
- package/templates/delivery-qbr-deck/content-schema.json +177 -0
- package/templates/delivery-qbr-deck/ds-base.js +23 -0
- package/templates/delivery-qbr-deck/support.js +1841 -0
- package/templates/delivery-runbook/.thumbnail +0 -0
- package/templates/delivery-runbook/DeliveryRunbook.dc.html +91 -0
- package/templates/delivery-runbook/content-schema.json +211 -0
- package/templates/delivery-runbook/ds-base.js +23 -0
- package/templates/delivery-runbook/support.js +1841 -0
- package/templates/delivery-status-email/.thumbnail +0 -0
- package/templates/delivery-status-email/DeliveryStatusEmail.dc.html +78 -0
- package/templates/delivery-status-email/ds-base.js +23 -0
- package/templates/delivery-status-email/support.js +1841 -0
- package/templates/doc-style-guide/.thumbnail +0 -0
- package/templates/doc-style-guide/DocStyleGuide.dc.html +148 -0
- package/templates/doc-style-guide/ds-base.js +23 -0
- package/templates/doc-style-guide/support.js +1841 -0
- package/templates/doc-suite-index/.thumbnail +0 -0
- package/templates/doc-suite-index/DocSuiteIndex.dc.html +201 -0
- package/templates/doc-suite-index/content-schema.json +12 -0
- package/templates/doc-suite-index/ds-base.js +23 -0
- package/templates/doc-suite-index/support.js +1841 -0
- package/templates/doc-templates/.thumbnail +0 -0
- package/templates/doc-templates/DocTemplates.dc.html +118 -0
- package/templates/doc-templates/ds-base.js +23 -0
- package/templates/doc-templates/support.js +1841 -0
- package/templates/email/.thumbnail +0 -0
- package/templates/email/Email-VN-standalone.html +59 -0
- package/templates/email/Email.dc.html +67 -0
- package/templates/email/ds-base.js +23 -0
- package/templates/email/support.js +1841 -0
- package/templates/email-safe/README.md +28 -0
- package/templates/email-safe/email-announcement.html +88 -0
- package/templates/email-safe/email-dunning.html +59 -0
- package/templates/email-safe/email-investor.html +88 -0
- package/templates/email-safe/email-launch.html +88 -0
- package/templates/email-safe/email-newsletter.html +62 -0
- package/templates/email-safe/email-status.html +88 -0
- package/templates/email-safe/email-transactional.html +88 -0
- package/templates/finance-dunning-email/.thumbnail +0 -0
- package/templates/finance-dunning-email/FinanceDunningEmail.dc.html +58 -0
- package/templates/finance-dunning-email/ds-base.js +23 -0
- package/templates/finance-dunning-email/support.js +1841 -0
- package/templates/finance-expense-report/.thumbnail +0 -0
- package/templates/finance-expense-report/FinanceExpenseReport.dc.html +82 -0
- package/templates/finance-expense-report/ds-base.js +23 -0
- package/templates/finance-expense-report/support.js +1841 -0
- package/templates/finance-invoice/.thumbnail +0 -0
- package/templates/finance-invoice/FinanceInvoice.dc.html +92 -0
- package/templates/finance-invoice/ds-base.js +23 -0
- package/templates/finance-invoice/support.js +1841 -0
- package/templates/finance-quote/.thumbnail +0 -0
- package/templates/finance-quote/FinanceQuote.dc.html +86 -0
- package/templates/finance-quote/ds-base.js +23 -0
- package/templates/finance-quote/support.js +1841 -0
- package/templates/hr-announcement/.thumbnail +0 -0
- package/templates/hr-announcement/HrAnnouncement.dc.html +64 -0
- package/templates/hr-announcement/ds-base.js +23 -0
- package/templates/hr-announcement/support.js +1841 -0
- package/templates/hr-interview-kit/.thumbnail +0 -0
- package/templates/hr-interview-kit/HrInterviewKit.dc.html +102 -0
- package/templates/hr-interview-kit/ds-base.js +23 -0
- package/templates/hr-interview-kit/support.js +1841 -0
- package/templates/hr-offboarding/.thumbnail +0 -0
- package/templates/hr-offboarding/HrOffboarding.dc.html +86 -0
- package/templates/hr-offboarding/ds-base.js +23 -0
- package/templates/hr-offboarding/support.js +1841 -0
- package/templates/hr-performance-review/.thumbnail +0 -0
- package/templates/hr-performance-review/HrPerformanceReview.dc.html +95 -0
- package/templates/hr-performance-review/ds-base.js +23 -0
- package/templates/hr-performance-review/support.js +1841 -0
- package/templates/hr-pip/.thumbnail +0 -0
- package/templates/hr-pip/HrPip.dc.html +73 -0
- package/templates/hr-pip/ds-base.js +23 -0
- package/templates/hr-pip/support.js +1841 -0
- package/templates/image-slots-demo.html +57 -0
- package/templates/kitchen-sink.html +127 -0
- package/templates/legal-msa/.thumbnail +0 -0
- package/templates/legal-msa/LegalMsa.dc.html +85 -0
- package/templates/legal-msa/ds-base.js +23 -0
- package/templates/legal-msa/support.js +1841 -0
- package/templates/legal-sow/.thumbnail +0 -0
- package/templates/legal-sow/LegalSow.dc.html +125 -0
- package/templates/legal-sow/ds-base.js +23 -0
- package/templates/legal-sow/support.js +1841 -0
- package/templates/marketing-campaign-brief/.thumbnail +0 -0
- package/templates/marketing-campaign-brief/MarketingCampaignBrief.dc.html +86 -0
- package/templates/marketing-campaign-brief/content-schema.json +139 -0
- package/templates/marketing-campaign-brief/ds-base.js +23 -0
- package/templates/marketing-campaign-brief/support.js +1841 -0
- package/templates/marketing-case-study/.thumbnail +0 -0
- package/templates/marketing-case-study/MarketingCaseStudy.dc.html +82 -0
- package/templates/marketing-case-study/content-schema.json +103 -0
- package/templates/marketing-case-study/ds-base.js +23 -0
- package/templates/marketing-case-study/support.js +1841 -0
- package/templates/marketing-launch/.thumbnail +0 -0
- package/templates/marketing-launch/MarketingLaunch.dc.html +84 -0
- package/templates/marketing-launch/ds-base.js +23 -0
- package/templates/marketing-launch/support.js +1841 -0
- package/templates/marketing-newsletter/.thumbnail +0 -0
- package/templates/marketing-newsletter/MarketingNewsletter.dc.html +109 -0
- package/templates/marketing-newsletter/ds-base.js +23 -0
- package/templates/marketing-newsletter/support.js +1841 -0
- package/templates/marketing-page/.thumbnail +0 -0
- package/templates/marketing-page/MarketingPage.dc.html +132 -0
- package/templates/marketing-page/content-schema.json +33 -0
- package/templates/marketing-page/ds-base.js +23 -0
- package/templates/marketing-page/support.js +1841 -0
- package/templates/marketing-press-release/.thumbnail +0 -0
- package/templates/marketing-press-release/MarketingPressRelease.dc.html +84 -0
- package/templates/marketing-press-release/content-schema.json +116 -0
- package/templates/marketing-press-release/ds-base.js +23 -0
- package/templates/marketing-press-release/support.js +1841 -0
- package/templates/marketing-social-kit/.thumbnail +0 -0
- package/templates/marketing-social-kit/MarketingSocialKit.dc.html +77 -0
- package/templates/marketing-social-kit/content-schema.json +54 -0
- package/templates/marketing-social-kit/ds-base.js +23 -0
- package/templates/marketing-social-kit/support.js +1841 -0
- package/templates/playground.html +79 -0
- package/templates/sales-one-pager/.thumbnail +0 -0
- package/templates/sales-one-pager/SalesOnePager.dc.html +103 -0
- package/templates/sales-one-pager/content-schema.json +73 -0
- package/templates/sales-one-pager/ds-base.js +23 -0
- package/templates/sales-one-pager/support.js +1841 -0
- package/templates/sales-proposal-deck/.thumbnail +0 -0
- package/templates/sales-proposal-deck/SalesProposalDeck.dc.html +159 -0
- package/templates/sales-proposal-deck/content-schema.json +273 -0
- package/templates/sales-proposal-deck/ds-base.js +23 -0
- package/templates/sales-proposal-deck/support.js +1841 -0
- package/templates/schema/content-schema.schema.json +31 -0
- package/templates/settings/.thumbnail +0 -0
- package/templates/settings/Settings.dc.html +86 -0
- package/templates/settings/content-schema.json +131 -0
- package/templates/settings/ds-base.js +23 -0
- package/templates/settings/support.js +1841 -0
- package/templates/slide-deck/.thumbnail +0 -0
- package/templates/slide-deck/SlideDeck.dc.html +86 -0
- package/templates/slide-deck/content-schema.json +23 -0
- package/templates/slide-deck/ds-base.js +23 -0
- package/templates/slide-deck/support.js +1841 -0
- package/templates/team-meeting-agenda/.thumbnail +0 -0
- package/templates/team-meeting-agenda/TeamMeetingAgenda.dc.html +93 -0
- package/templates/team-meeting-agenda/ds-base.js +23 -0
- package/templates/team-meeting-agenda/support.js +1841 -0
- package/templates/tech-incident-report/.thumbnail +0 -0
- package/templates/tech-incident-report/TechIncidentReport.dc.html +111 -0
- package/templates/tech-incident-report/content-schema.json +25 -0
- package/templates/tech-incident-report/ds-base.js +23 -0
- package/templates/tech-incident-report/support.js +1841 -0
- package/templates/tech-release-notes/.thumbnail +0 -0
- package/templates/tech-release-notes/TechReleaseNotes.dc.html +79 -0
- package/templates/tech-release-notes/ds-base.js +23 -0
- package/templates/tech-release-notes/support.js +1841 -0
- package/templates/tech-retro/.thumbnail +0 -0
- package/templates/tech-retro/TechRetro.dc.html +84 -0
- package/templates/tech-retro/ds-base.js +23 -0
- package/templates/tech-retro/support.js +1841 -0
- package/templates/tech-rfc/.thumbnail +0 -0
- package/templates/tech-rfc/TechRfc.dc.html +87 -0
- package/templates/tech-rfc/content-schema.json +115 -0
- package/templates/tech-rfc/ds-base.js +23 -0
- package/templates/tech-rfc/support.js +1841 -0
- package/templates/vn-appointment-transfer/.thumbnail +0 -0
- package/templates/vn-appointment-transfer/VnAppointmentTransfer.dc.html +101 -0
- package/templates/vn-appointment-transfer/ds-base.js +23 -0
- package/templates/vn-appointment-transfer/support.js +1841 -0
- package/templates/vn-certificate-of-employment/.thumbnail +0 -0
- package/templates/vn-certificate-of-employment/VnCertificateOfEmployment.dc.html +84 -0
- package/templates/vn-certificate-of-employment/ds-base.js +23 -0
- package/templates/vn-certificate-of-employment/support.js +1841 -0
- package/templates/vn-code-of-conduct/.thumbnail +0 -0
- package/templates/vn-code-of-conduct/VnCodeOfConduct.dc.html +105 -0
- package/templates/vn-code-of-conduct/ds-base.js +23 -0
- package/templates/vn-code-of-conduct/support.js +1841 -0
- package/templates/vn-compensation-regulation/.thumbnail +0 -0
- package/templates/vn-compensation-regulation/VnCompensationRegulation.dc.html +122 -0
- package/templates/vn-compensation-regulation/ds-base.js +23 -0
- package/templates/vn-compensation-regulation/support.js +1841 -0
- package/templates/vn-contract-amendment/.thumbnail +0 -0
- package/templates/vn-contract-amendment/VnContractAmendment.dc.html +107 -0
- package/templates/vn-contract-amendment/ds-base.js +23 -0
- package/templates/vn-contract-amendment/support.js +1841 -0
- package/templates/vn-contractor-agreement/.thumbnail +0 -0
- package/templates/vn-contractor-agreement/VnContractorAgreement.dc.html +120 -0
- package/templates/vn-contractor-agreement/ds-base.js +23 -0
- package/templates/vn-contractor-agreement/support.js +1841 -0
- package/templates/vn-data-protection-policy/.thumbnail +0 -0
- package/templates/vn-data-protection-policy/VnDataProtectionPolicy.dc.html +116 -0
- package/templates/vn-data-protection-policy/ds-base.js +23 -0
- package/templates/vn-data-protection-policy/support.js +1841 -0
- package/templates/vn-disciplinary-case-file/.thumbnail +0 -0
- package/templates/vn-disciplinary-case-file/VnDisciplinaryCaseFile.dc.html +172 -0
- package/templates/vn-disciplinary-case-file/ds-base.js +23 -0
- package/templates/vn-disciplinary-case-file/support.js +1841 -0
- package/templates/vn-disciplinary-schedule/.thumbnail +0 -0
- package/templates/vn-disciplinary-schedule/VnDisciplinarySchedule.dc.html +91 -0
- package/templates/vn-disciplinary-schedule/ds-base.js +23 -0
- package/templates/vn-disciplinary-schedule/support.js +1841 -0
- package/templates/vn-employee-request/.thumbnail +0 -0
- package/templates/vn-employee-request/VnEmployeeRequest.dc.html +137 -0
- package/templates/vn-employee-request/ds-base.js +23 -0
- package/templates/vn-employee-request/support.js +1841 -0
- package/templates/vn-exit-handover/.thumbnail +0 -0
- package/templates/vn-exit-handover/VnExitHandover.dc.html +228 -0
- package/templates/vn-exit-handover/ds-base.js +23 -0
- package/templates/vn-exit-handover/support.js +1841 -0
- package/templates/vn-foreign-employee-pack/.thumbnail +0 -0
- package/templates/vn-foreign-employee-pack/VnForeignEmployeePack.dc.html +129 -0
- package/templates/vn-foreign-employee-pack/content-schema.json +22 -0
- package/templates/vn-foreign-employee-pack/ds-base.js +23 -0
- package/templates/vn-foreign-employee-pack/support.js +1841 -0
- package/templates/vn-grassroots-democracy/.thumbnail +0 -0
- package/templates/vn-grassroots-democracy/VnGrassrootsDemocracy.dc.html +117 -0
- package/templates/vn-grassroots-democracy/ds-base.js +23 -0
- package/templates/vn-grassroots-democracy/support.js +1841 -0
- package/templates/vn-infosec-policy/.thumbnail +0 -0
- package/templates/vn-infosec-policy/VnInfosecPolicy.dc.html +116 -0
- package/templates/vn-infosec-policy/ds-base.js +23 -0
- package/templates/vn-infosec-policy/support.js +1841 -0
- package/templates/vn-internal-labor-regulations/.thumbnail +0 -0
- package/templates/vn-internal-labor-regulations/VnInternalLaborRegulations.dc.html +155 -0
- package/templates/vn-internal-labor-regulations/ds-base.js +23 -0
- package/templates/vn-internal-labor-regulations/support.js +1841 -0
- package/templates/vn-internship-agreement/.thumbnail +0 -0
- package/templates/vn-internship-agreement/VnInternshipAgreement.dc.html +112 -0
- package/templates/vn-internship-agreement/ds-base.js +23 -0
- package/templates/vn-internship-agreement/support.js +1841 -0
- package/templates/vn-job-description/.thumbnail +0 -0
- package/templates/vn-job-description/VnJobDescription.dc.html +85 -0
- package/templates/vn-job-description/ds-base.js +23 -0
- package/templates/vn-job-description/support.js +1841 -0
- package/templates/vn-labor-contract/.thumbnail +0 -0
- package/templates/vn-labor-contract/VnLaborContract.dc.html +180 -0
- package/templates/vn-labor-contract/ds-base.js +23 -0
- package/templates/vn-labor-contract/support.js +1841 -0
- package/templates/vn-labour-management-book/.thumbnail +0 -0
- package/templates/vn-labour-management-book/VnLabourManagementBook.dc.html +115 -0
- package/templates/vn-labour-management-book/ds-base.js +23 -0
- package/templates/vn-labour-management-book/support.js +1841 -0
- package/templates/vn-mutual-nda/.thumbnail +0 -0
- package/templates/vn-mutual-nda/VnMutualNda.dc.html +114 -0
- package/templates/vn-mutual-nda/ds-base.js +23 -0
- package/templates/vn-mutual-nda/support.js +1841 -0
- package/templates/vn-ndnca-ip/.thumbnail +0 -0
- package/templates/vn-ndnca-ip/VnNdncaIp.dc.html +157 -0
- package/templates/vn-ndnca-ip/ds-base.js +23 -0
- package/templates/vn-ndnca-ip/support.js +1841 -0
- package/templates/vn-offer-letter/.thumbnail +0 -0
- package/templates/vn-offer-letter/VnOfferLetter.dc.html +84 -0
- package/templates/vn-offer-letter/ds-base.js +23 -0
- package/templates/vn-offer-letter/support.js +1841 -0
- package/templates/vn-onboarding-checklist/.thumbnail +0 -0
- package/templates/vn-onboarding-checklist/VnOnboardingChecklist.dc.html +98 -0
- package/templates/vn-onboarding-checklist/content-schema.json +12 -0
- package/templates/vn-onboarding-checklist/ds-base.js +23 -0
- package/templates/vn-onboarding-checklist/support.js +1841 -0
- package/templates/vn-pdpl-consent/.thumbnail +0 -0
- package/templates/vn-pdpl-consent/VnPdplConsent.dc.html +111 -0
- package/templates/vn-pdpl-consent/ds-base.js +23 -0
- package/templates/vn-pdpl-consent/support.js +1841 -0
- package/templates/vn-performance-evaluation-regulation/.thumbnail +0 -0
- package/templates/vn-performance-evaluation-regulation/VnPerformanceEvaluationRegulation.dc.html +135 -0
- package/templates/vn-performance-evaluation-regulation/ds-base.js +23 -0
- package/templates/vn-performance-evaluation-regulation/support.js +1841 -0
- package/templates/vn-performance-review-form/.thumbnail +0 -0
- package/templates/vn-performance-review-form/VnPerformanceReviewForm.dc.html +129 -0
- package/templates/vn-performance-review-form/ds-base.js +23 -0
- package/templates/vn-performance-review-form/support.js +1841 -0
- package/templates/vn-phantom-stock/.thumbnail +0 -0
- package/templates/vn-phantom-stock/VnPhantomStock.dc.html +184 -0
- package/templates/vn-phantom-stock/content-schema.json +17 -0
- package/templates/vn-phantom-stock/ds-base.js +23 -0
- package/templates/vn-phantom-stock/support.js +1841 -0
- package/templates/vn-probation-contract/.thumbnail +0 -0
- package/templates/vn-probation-contract/VnProbationContract.dc.html +126 -0
- package/templates/vn-probation-contract/ds-base.js +23 -0
- package/templates/vn-probation-contract/support.js +1841 -0
- package/templates/vn-receipt-acknowledgement/.thumbnail +0 -0
- package/templates/vn-receipt-acknowledgement/VnReceiptAcknowledgement.dc.html +106 -0
- package/templates/vn-receipt-acknowledgement/ds-base.js +23 -0
- package/templates/vn-receipt-acknowledgement/support.js +1841 -0
- package/templates/vn-remote-work-policy/.thumbnail +0 -0
- package/templates/vn-remote-work-policy/VnRemoteWorkPolicy.dc.html +103 -0
- package/templates/vn-remote-work-policy/ds-base.js +23 -0
- package/templates/vn-remote-work-policy/support.js +1841 -0
- package/templates/vn-resignation-letter/.thumbnail +0 -0
- package/templates/vn-resignation-letter/VnResignationLetter.dc.html +71 -0
- package/templates/vn-resignation-letter/ds-base.js +23 -0
- package/templates/vn-resignation-letter/support.js +1841 -0
- package/templates/vn-salary-scale/.thumbnail +0 -0
- package/templates/vn-salary-scale/VnSalaryScale.dc.html +110 -0
- package/templates/vn-salary-scale/ds-base.js +23 -0
- package/templates/vn-salary-scale/support.js +1841 -0
- package/templates/vn-sow-appendix/.thumbnail +0 -0
- package/templates/vn-sow-appendix/VnSowAppendix.dc.html +70 -0
- package/templates/vn-sow-appendix/ds-base.js +23 -0
- package/templates/vn-sow-appendix/support.js +1841 -0
- package/templates/vn-termination-decision/.thumbnail +0 -0
- package/templates/vn-termination-decision/VnTerminationDecision.dc.html +80 -0
- package/templates/vn-termination-decision/ds-base.js +23 -0
- package/templates/vn-termination-decision/support.js +1841 -0
- package/templates/vn-total-rewards-appendix/.thumbnail +0 -0
- package/templates/vn-total-rewards-appendix/VnTotalRewardsAppendix.dc.html +138 -0
- package/templates/vn-total-rewards-appendix/ds-base.js +23 -0
- package/templates/vn-total-rewards-appendix/support.js +1841 -0
- package/templates/vn-training-commitment/.thumbnail +0 -0
- package/templates/vn-training-commitment/VnTrainingCommitment.dc.html +105 -0
- package/templates/vn-training-commitment/ds-base.js +23 -0
- package/templates/vn-training-commitment/support.js +1841 -0
- package/templates/vn-travel-expense-policy/.thumbnail +0 -0
- package/templates/vn-travel-expense-policy/VnTravelExpensePolicy.dc.html +113 -0
- package/templates/vn-travel-expense-policy/ds-base.js +23 -0
- package/templates/vn-travel-expense-policy/support.js +1841 -0
- package/tokens/colors.css +77 -0
- package/tokens/component-tokens.css +46 -0
- package/tokens/elements.css +300 -0
- package/tokens/elevation.css +46 -0
- package/tokens/fonts.css +51 -0
- package/tokens/motion.css +25 -0
- package/tokens/native/CSTokens.kt +255 -0
- package/tokens/native/CSTokens.swift +257 -0
- package/tokens/native/cs_tokens.dart +253 -0
- package/tokens/provenance.json +52 -0
- package/tokens/spacing.css +34 -0
- package/tokens/tokens.dtcg.json +1222 -0
- package/tokens/tokens.js +436 -0
- package/tokens/tokens.json +434 -0
- package/tokens/typography.css +67 -0
- package/tokens/viewer.html +261 -0
- package/ui_kits/deck/README.md +21 -0
- package/ui_kits/deck/index.html +120 -0
- package/ui_kits/status-hub/README.md +40 -0
- package/ui_kits/status-hub/StatusHub.jsx +270 -0
- package/ui_kits/status-hub/data.js +57 -0
- package/ui_kits/status-hub/identity-lab.html +134 -0
- package/ui_kits/status-hub/index.html +24 -0
- package/ui_kits/status-hub/login.html +65 -0
- package/ui_kits/status-hub/project.html +137 -0
- package/ui_kits/status-hub/settings.html +88 -0
- package/ui_kits/status-hub/status.css +199 -0
- package/ui_kits/website/README.md +36 -0
- package/ui_kits/website/Website.jsx +167 -0
- package/ui_kits/website/careers.html +109 -0
- package/ui_kits/website/chat.html +133 -0
- package/ui_kits/website/copy.js +76 -0
- package/ui_kits/website/index.html +24 -0
- package/ui_kits/website/site.css +121 -0
- package/ui_kits/website/work.html +119 -0
|
@@ -0,0 +1,1841 @@
|
|
|
1
|
+
// GENERATED from dc-runtime/src/*.ts — do not edit. Rebuild with `cd dc-runtime && bun run build`.
|
|
2
|
+
"use strict";
|
|
3
|
+
(() => {
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
6
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
7
|
+
|
|
8
|
+
// src/react.ts
|
|
9
|
+
function getReact() {
|
|
10
|
+
const R = window.React;
|
|
11
|
+
if (!R) throw new Error("dc-runtime: window.React is not available yet");
|
|
12
|
+
return R;
|
|
13
|
+
}
|
|
14
|
+
function getReactDOM() {
|
|
15
|
+
const RD = window.ReactDOM;
|
|
16
|
+
if (!RD) throw new Error("dc-runtime: window.ReactDOM is not available yet");
|
|
17
|
+
return RD;
|
|
18
|
+
}
|
|
19
|
+
var h = ((...args) => getReact().createElement(
|
|
20
|
+
...args
|
|
21
|
+
));
|
|
22
|
+
|
|
23
|
+
// src/parse.ts
|
|
24
|
+
function parseDcDocument(doc) {
|
|
25
|
+
const dc = doc.querySelector("x-dc");
|
|
26
|
+
if (!dc) return null;
|
|
27
|
+
const scriptEl = doc.querySelector("script[data-dc-script]");
|
|
28
|
+
const { props, preview } = parseDataProps(
|
|
29
|
+
scriptEl?.getAttribute("data-props") ?? null
|
|
30
|
+
);
|
|
31
|
+
return {
|
|
32
|
+
template: dc.innerHTML,
|
|
33
|
+
js: scriptEl ? scriptEl.textContent || "" : "",
|
|
34
|
+
props,
|
|
35
|
+
preview
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function parseDcText(src) {
|
|
39
|
+
const openMatch = /<x-dc(?:\s[^>]*)?>/.exec(src);
|
|
40
|
+
if (!openMatch) return null;
|
|
41
|
+
const close = src.lastIndexOf("</x-dc>");
|
|
42
|
+
if (close === -1 || close < openMatch.index) return null;
|
|
43
|
+
const template = src.slice(openMatch.index + openMatch[0].length, close);
|
|
44
|
+
const doc = new DOMParser().parseFromString(src, "text/html");
|
|
45
|
+
const scriptEl = doc.querySelector("script[data-dc-script]");
|
|
46
|
+
const { props, preview } = parseDataProps(
|
|
47
|
+
scriptEl?.getAttribute("data-props") ?? null
|
|
48
|
+
);
|
|
49
|
+
return {
|
|
50
|
+
template,
|
|
51
|
+
js: scriptEl ? scriptEl.textContent || "" : "",
|
|
52
|
+
props,
|
|
53
|
+
preview
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function parseDataProps(raw) {
|
|
57
|
+
if (!raw) return { props: null, preview: null };
|
|
58
|
+
let parsed;
|
|
59
|
+
try {
|
|
60
|
+
parsed = JSON.parse(raw);
|
|
61
|
+
} catch {
|
|
62
|
+
return { props: null, preview: null };
|
|
63
|
+
}
|
|
64
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
65
|
+
return { props: null, preview: null };
|
|
66
|
+
}
|
|
67
|
+
const obj = parsed;
|
|
68
|
+
const preview = obj.$preview && typeof obj.$preview === "object" ? obj.$preview : null;
|
|
69
|
+
const rest = {};
|
|
70
|
+
for (const k of Object.keys(obj)) {
|
|
71
|
+
if (k[0] !== "$") rest[k] = obj[k];
|
|
72
|
+
}
|
|
73
|
+
return { props: Object.keys(rest).length ? rest : null, preview };
|
|
74
|
+
}
|
|
75
|
+
function dcNameFromPath(pathname) {
|
|
76
|
+
let p = pathname || "";
|
|
77
|
+
try {
|
|
78
|
+
p = decodeURIComponent(p);
|
|
79
|
+
} catch {
|
|
80
|
+
}
|
|
81
|
+
const base = p.split("/").pop() || "Root";
|
|
82
|
+
return base.replace(/\.dc\.html$/, "").replace(/\.html?$/, "") || "Root";
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
// src/boot.ts
|
|
86
|
+
var BASE_CSS = `
|
|
87
|
+
.sc-placeholder{background:color-mix(in srgb,currentColor 8%,transparent);
|
|
88
|
+
border:1px solid color-mix(in srgb,currentColor 50%,transparent);
|
|
89
|
+
border-radius:2px;box-sizing:border-box;overflow:hidden}
|
|
90
|
+
@keyframes sc-shine{0%{background-position:100% 50%}100%{background-position:0% 50%}}
|
|
91
|
+
html.sc-dc-streaming .sc-placeholder,
|
|
92
|
+
html.sc-dc-streaming .sc-interp.sc-missing{position:relative;
|
|
93
|
+
background:color-mix(in srgb,currentColor 5%,transparent);
|
|
94
|
+
border-color:transparent}
|
|
95
|
+
html.sc-dc-streaming .sc-placeholder::before,
|
|
96
|
+
html.sc-dc-streaming .sc-interp.sc-missing::before{content:'';
|
|
97
|
+
position:absolute;inset:0;pointer-events:none;
|
|
98
|
+
background:linear-gradient(90deg,rgba(217,119,87,0) 25%,rgba(247,225,211,.95) 37%,rgba(217,119,87,0) 63%);
|
|
99
|
+
background-size:400% 100%;animation:sc-shine 1.4s ease infinite}
|
|
100
|
+
html.sc-dc-streaming .sc-placeholder:nth-child(n+9 of .sc-placeholder)::before,
|
|
101
|
+
html.sc-dc-streaming .sc-interp.sc-missing:nth-child(n+9 of .sc-interp.sc-missing)::before{animation:none;
|
|
102
|
+
background:color-mix(in srgb,currentColor 8%,transparent)}
|
|
103
|
+
.sc-placeholder-error{padding:4px 8px;font:11px/1.4 ui-monospace,monospace;
|
|
104
|
+
color:color-mix(in srgb,currentColor 70%,transparent);word-break:break-word}
|
|
105
|
+
.sc-interp.sc-missing{display:inline-block;width:2em;height:1em;overflow:hidden;
|
|
106
|
+
vertical-align:text-bottom;background:rgba(255,255,255,.3);border:1px solid rgba(0,0,0,.5);
|
|
107
|
+
border-radius:2px;box-sizing:border-box;color:transparent;
|
|
108
|
+
user-select:none}
|
|
109
|
+
.sc-interp.sc-unresolved{font-family:ui-monospace,monospace;font-size:.85em;
|
|
110
|
+
color:color-mix(in srgb,currentColor 50%,transparent);
|
|
111
|
+
background:color-mix(in srgb,currentColor 10%,transparent);border-radius:3px;
|
|
112
|
+
padding:0 3px}
|
|
113
|
+
.sc-host.sc-has-error{position:relative}
|
|
114
|
+
.sc-logic-error{position:absolute;top:8px;left:8px;z-index:2147483647;max-width:60ch;
|
|
115
|
+
padding:6px 10px;background:#b00020;color:#fff;font:12px/1.4 ui-monospace,monospace;
|
|
116
|
+
border-radius:4px;white-space:pre-wrap;pointer-events:none}
|
|
117
|
+
/* Mirrors PRINT_BASELINE_CSS in apps/web deck-stage-export.ts \u2014 keep both
|
|
118
|
+
in sync until dc-runtime regains a build step. */
|
|
119
|
+
@media print {
|
|
120
|
+
@page { margin: 0.5cm; }
|
|
121
|
+
figure, table { break-inside: avoid; }
|
|
122
|
+
#dc-root, #dc-root > .sc-host { height: auto; }
|
|
123
|
+
*, *::before, *::after {
|
|
124
|
+
print-color-adjust: exact; -webkit-print-color-adjust: exact;
|
|
125
|
+
backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
|
|
126
|
+
animation-delay: -99s !important; animation-duration: .001s !important;
|
|
127
|
+
animation-iteration-count: 1 !important; animation-fill-mode: both !important;
|
|
128
|
+
animation-play-state: running !important; transition-duration: 0s !important;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
`;
|
|
132
|
+
var FULL_PAGE_CSS = "html,body{height:100%;margin:0}#dc-root,#dc-root>.sc-host{height:100%}";
|
|
133
|
+
function rootNameForDocument(doc, loc) {
|
|
134
|
+
let bootPath = loc.pathname || "";
|
|
135
|
+
if (!/\.dc\.html?$/i.test(safeDecode(bootPath))) {
|
|
136
|
+
try {
|
|
137
|
+
bootPath = new URL(doc.baseURI || "/").pathname;
|
|
138
|
+
} catch {
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return dcNameFromPath(bootPath);
|
|
142
|
+
}
|
|
143
|
+
function safeDecode(s) {
|
|
144
|
+
try {
|
|
145
|
+
return decodeURIComponent(s);
|
|
146
|
+
} catch {
|
|
147
|
+
return s;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
function boot(runtime, doc = document) {
|
|
151
|
+
const parsed = parseDcDocument(doc);
|
|
152
|
+
if (!parsed) return null;
|
|
153
|
+
const React = getReact();
|
|
154
|
+
const rootName = rootNameForDocument(doc, location);
|
|
155
|
+
runtime.markFetched(rootName);
|
|
156
|
+
runtime.setRootName(rootName);
|
|
157
|
+
runtime.adoptParsed(rootName, parsed);
|
|
158
|
+
if (!window.__resources) {
|
|
159
|
+
fetch(location.href).then((res) => res.ok ? res.text() : "").then((t) => {
|
|
160
|
+
const raw = t ? parseDcText(t) : null;
|
|
161
|
+
if (raw?.template) runtime.updateHtml(rootName, raw.template);
|
|
162
|
+
}).catch(() => {
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
const dc = doc.querySelector("x-dc");
|
|
166
|
+
const hostEl = doc.createElement("div");
|
|
167
|
+
hostEl.id = "dc-root";
|
|
168
|
+
dc.replaceWith(hostEl);
|
|
169
|
+
if (!parsed.preview) {
|
|
170
|
+
const s = doc.createElement("style");
|
|
171
|
+
s.textContent = FULL_PAGE_CSS;
|
|
172
|
+
doc.head.appendChild(s);
|
|
173
|
+
}
|
|
174
|
+
const Root = runtime.getDC(rootName);
|
|
175
|
+
const entry = runtime.registry.get(rootName);
|
|
176
|
+
function StandaloneRoot() {
|
|
177
|
+
const [, setTick] = React.useState(0);
|
|
178
|
+
React.useEffect(() => {
|
|
179
|
+
const sub = () => setTick((n) => n + 1);
|
|
180
|
+
entry.subs.add(sub);
|
|
181
|
+
return () => {
|
|
182
|
+
entry.subs.delete(sub);
|
|
183
|
+
};
|
|
184
|
+
}, []);
|
|
185
|
+
const defaults = React.useMemo(() => {
|
|
186
|
+
const d = {};
|
|
187
|
+
for (const k in entry.propsMeta || {}) {
|
|
188
|
+
const v = entry.propsMeta?.[k]?.default;
|
|
189
|
+
if (v !== void 0) d[k] = v;
|
|
190
|
+
}
|
|
191
|
+
return d;
|
|
192
|
+
}, [entry.propsMeta]);
|
|
193
|
+
return h(Root, { ...defaults, ...entry.propOverrides || {} });
|
|
194
|
+
}
|
|
195
|
+
const ReactDOM = getReactDOM();
|
|
196
|
+
if (ReactDOM.createRoot)
|
|
197
|
+
ReactDOM.createRoot(hostEl).render(h(StandaloneRoot));
|
|
198
|
+
else ReactDOM.render(h(StandaloneRoot), hostEl);
|
|
199
|
+
return rootName;
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// src/expr.ts
|
|
203
|
+
var IDENT_RE = /^[A-Za-z_$][A-Za-z0-9_$]*/;
|
|
204
|
+
var NUMBER_RE = /^-?\d+(\.\d+)?$/;
|
|
205
|
+
function resolve(vals, src) {
|
|
206
|
+
const expr = String(src).trim();
|
|
207
|
+
if (!expr) return void 0;
|
|
208
|
+
if (expr[0] === "(" && expr[expr.length - 1] === ")" && parensWrapWhole(expr)) {
|
|
209
|
+
return resolve(vals, expr.slice(1, -1));
|
|
210
|
+
}
|
|
211
|
+
const eq = findTopLevelEquality(expr);
|
|
212
|
+
if (eq) {
|
|
213
|
+
const lv = resolve(vals, expr.slice(0, eq.index));
|
|
214
|
+
const rv = resolve(vals, expr.slice(eq.index + eq.op.length));
|
|
215
|
+
switch (eq.op) {
|
|
216
|
+
case "===":
|
|
217
|
+
return lv === rv;
|
|
218
|
+
case "!==":
|
|
219
|
+
return lv !== rv;
|
|
220
|
+
case "==":
|
|
221
|
+
return lv == rv;
|
|
222
|
+
default:
|
|
223
|
+
return lv != rv;
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
if (expr[0] === "!") return !resolve(vals, expr.slice(1));
|
|
227
|
+
if (expr === "true") return true;
|
|
228
|
+
if (expr === "false") return false;
|
|
229
|
+
if (expr === "null") return null;
|
|
230
|
+
if (expr === "undefined") return void 0;
|
|
231
|
+
if (NUMBER_RE.test(expr)) return Number(expr);
|
|
232
|
+
if (expr.length >= 2 && (expr[0] === '"' || expr[0] === "'") && expr[expr.length - 1] === expr[0]) {
|
|
233
|
+
return expr.slice(1, -1);
|
|
234
|
+
}
|
|
235
|
+
return resolvePath(vals, expr);
|
|
236
|
+
}
|
|
237
|
+
function parensWrapWhole(expr) {
|
|
238
|
+
let depth = 0;
|
|
239
|
+
for (let i = 0; i < expr.length - 1; i++) {
|
|
240
|
+
if (expr[i] === "(") depth++;
|
|
241
|
+
else if (expr[i] === ")") {
|
|
242
|
+
depth--;
|
|
243
|
+
if (depth === 0) return false;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
return true;
|
|
247
|
+
}
|
|
248
|
+
function findTopLevelEquality(expr) {
|
|
249
|
+
let depth = 0;
|
|
250
|
+
for (let i = 0; i < expr.length; i++) {
|
|
251
|
+
const c = expr[i];
|
|
252
|
+
if (c === "[" || c === "(") depth++;
|
|
253
|
+
else if (c === "]" || c === ")") depth--;
|
|
254
|
+
else if (depth === 0 && (c === "=" || c === "!") && expr[i + 1] === "=") {
|
|
255
|
+
if (i > 0 && (expr[i - 1] === "=" || expr[i - 1] === "!")) continue;
|
|
256
|
+
if (!expr.slice(0, i).trim()) continue;
|
|
257
|
+
const op = expr[i + 2] === "=" ? c + "==" : c + "=";
|
|
258
|
+
return { index: i, op };
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
return null;
|
|
262
|
+
}
|
|
263
|
+
function resolvePath(vals, expr) {
|
|
264
|
+
const head = expr.match(IDENT_RE);
|
|
265
|
+
if (!head) return void 0;
|
|
266
|
+
let cur = vals == null ? void 0 : vals[head[0]];
|
|
267
|
+
let i = head[0].length;
|
|
268
|
+
while (i < expr.length) {
|
|
269
|
+
if (expr[i] === ".") {
|
|
270
|
+
const m = expr.slice(i + 1).match(IDENT_RE) || expr.slice(i + 1).match(/^\d+/);
|
|
271
|
+
if (!m) return void 0;
|
|
272
|
+
cur = cur == null ? void 0 : cur[m[0]];
|
|
273
|
+
i += 1 + m[0].length;
|
|
274
|
+
} else if (expr[i] === "[") {
|
|
275
|
+
let depth = 1;
|
|
276
|
+
let j = i + 1;
|
|
277
|
+
while (j < expr.length && depth > 0) {
|
|
278
|
+
if (expr[j] === "[") depth++;
|
|
279
|
+
else if (expr[j] === "]") {
|
|
280
|
+
depth--;
|
|
281
|
+
if (depth === 0) break;
|
|
282
|
+
}
|
|
283
|
+
j++;
|
|
284
|
+
}
|
|
285
|
+
if (depth !== 0) return void 0;
|
|
286
|
+
const key = resolve(vals, expr.slice(i + 1, j));
|
|
287
|
+
cur = cur == null ? void 0 : cur[key];
|
|
288
|
+
i = j + 1;
|
|
289
|
+
} else {
|
|
290
|
+
return void 0;
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
return cur;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
// src/encode.ts
|
|
297
|
+
var CAMEL_ATTR = "sc-camel-";
|
|
298
|
+
var INLINE_TEXT_TAGS = new Set(
|
|
299
|
+
"a abbr b bdi bdo br cite code del dfn em i ins kbd mark q s samp small span strike strong sub sup u var wbr".split(
|
|
300
|
+
" "
|
|
301
|
+
)
|
|
302
|
+
);
|
|
303
|
+
var RAW_WRAP = {
|
|
304
|
+
select: "sc-raw-select",
|
|
305
|
+
table: "sc-raw-table",
|
|
306
|
+
tbody: "sc-raw-tbody",
|
|
307
|
+
thead: "sc-raw-thead",
|
|
308
|
+
tfoot: "sc-raw-tfoot",
|
|
309
|
+
tr: "sc-raw-tr",
|
|
310
|
+
td: "sc-raw-td",
|
|
311
|
+
th: "sc-raw-th",
|
|
312
|
+
caption: "sc-raw-caption"
|
|
313
|
+
};
|
|
314
|
+
var RAW_UNWRAP = Object.fromEntries(
|
|
315
|
+
Object.entries(RAW_WRAP).map(([k, v]) => [v, k])
|
|
316
|
+
);
|
|
317
|
+
var EVENT_MAP = {
|
|
318
|
+
onclick: "onClick",
|
|
319
|
+
onchange: "onChange",
|
|
320
|
+
oninput: "onInput",
|
|
321
|
+
onsubmit: "onSubmit",
|
|
322
|
+
onkeydown: "onKeyDown",
|
|
323
|
+
onkeyup: "onKeyUp",
|
|
324
|
+
onkeypress: "onKeyPress",
|
|
325
|
+
onmousedown: "onMouseDown",
|
|
326
|
+
onmouseup: "onMouseUp",
|
|
327
|
+
onmouseenter: "onMouseEnter",
|
|
328
|
+
onmouseleave: "onMouseLeave",
|
|
329
|
+
onfocus: "onFocus",
|
|
330
|
+
onblur: "onBlur",
|
|
331
|
+
ondoubleclick: "onDoubleClick",
|
|
332
|
+
oncontextmenu: "onContextMenu",
|
|
333
|
+
onmousemove: "onMouseMove",
|
|
334
|
+
onmouseover: "onMouseOver",
|
|
335
|
+
onmouseout: "onMouseOut",
|
|
336
|
+
onpointerdown: "onPointerDown",
|
|
337
|
+
onpointerup: "onPointerUp",
|
|
338
|
+
onpointermove: "onPointerMove",
|
|
339
|
+
onpointerenter: "onPointerEnter",
|
|
340
|
+
onpointerleave: "onPointerLeave",
|
|
341
|
+
onpointercancel: "onPointerCancel",
|
|
342
|
+
onpointerover: "onPointerOver",
|
|
343
|
+
onpointerout: "onPointerOut",
|
|
344
|
+
ongotpointercapture: "onGotPointerCapture",
|
|
345
|
+
onlostpointercapture: "onLostPointerCapture",
|
|
346
|
+
ontouchstart: "onTouchStart",
|
|
347
|
+
ontouchend: "onTouchEnd",
|
|
348
|
+
ontouchmove: "onTouchMove",
|
|
349
|
+
ontouchcancel: "onTouchCancel",
|
|
350
|
+
ondragstart: "onDragStart",
|
|
351
|
+
ondragend: "onDragEnd",
|
|
352
|
+
ondragenter: "onDragEnter",
|
|
353
|
+
ondragleave: "onDragLeave",
|
|
354
|
+
ondragover: "onDragOver",
|
|
355
|
+
onanimationstart: "onAnimationStart",
|
|
356
|
+
onanimationend: "onAnimationEnd",
|
|
357
|
+
onanimationiteration: "onAnimationIteration",
|
|
358
|
+
ontransitionend: "onTransitionEnd"
|
|
359
|
+
};
|
|
360
|
+
var ATTRS = `(?:[^>"']|"[^"]*"|'[^']*')*`;
|
|
361
|
+
var IMPORT_SELF_CLOSE_RE = new RegExp(
|
|
362
|
+
"<(x-import|dc-import)(" + ATTRS + ")/>",
|
|
363
|
+
"gi"
|
|
364
|
+
);
|
|
365
|
+
var CAMEL_ATTR_RE = /(\s)([a-z]+[A-Z][A-Za-z0-9]*)(\s*=)/g;
|
|
366
|
+
function encodeCamelAttrs(html) {
|
|
367
|
+
return html.replace(
|
|
368
|
+
CAMEL_ATTR_RE,
|
|
369
|
+
(_, sp, name, eq) => sp + CAMEL_ATTR + name.replace(/[A-Z]/g, (c) => "-" + c.toLowerCase()) + eq
|
|
370
|
+
);
|
|
371
|
+
}
|
|
372
|
+
function encodeCase(html) {
|
|
373
|
+
html = html.replace(
|
|
374
|
+
IMPORT_SELF_CLOSE_RE,
|
|
375
|
+
(_, t, a) => "<" + t + a + "></" + t + ">"
|
|
376
|
+
);
|
|
377
|
+
html = html.replace(/<helmet(\s|>)/gi, "<sc-helmet$1");
|
|
378
|
+
html = html.replace(/<\/helmet\s*>/gi, "</sc-helmet>");
|
|
379
|
+
html = encodeCamelAttrs(html);
|
|
380
|
+
for (const [real, alias] of Object.entries(RAW_WRAP)) {
|
|
381
|
+
html = html.replace(
|
|
382
|
+
new RegExp("(</?)" + real + "(?=[\\s>])", "gi"),
|
|
383
|
+
"$1" + alias
|
|
384
|
+
);
|
|
385
|
+
}
|
|
386
|
+
return html;
|
|
387
|
+
}
|
|
388
|
+
function kebabToCamel(s) {
|
|
389
|
+
return s.replace(/-([a-z])/g, (_, c) => c.toUpperCase());
|
|
390
|
+
}
|
|
391
|
+
function cssToObj(css) {
|
|
392
|
+
const o = {};
|
|
393
|
+
for (const decl of css.split(";")) {
|
|
394
|
+
const i = decl.indexOf(":");
|
|
395
|
+
if (i < 0) continue;
|
|
396
|
+
const prop = decl.slice(0, i).trim();
|
|
397
|
+
o[prop.startsWith("--") ? prop : kebabToCamel(prop)] = decl.slice(i + 1).trim();
|
|
398
|
+
}
|
|
399
|
+
return o;
|
|
400
|
+
}
|
|
401
|
+
function compileAttr(raw) {
|
|
402
|
+
const whole = raw.match(/^\s*\{\{([\s\S]+?)\}\}\s*$/);
|
|
403
|
+
if (whole) {
|
|
404
|
+
const path = whole[1];
|
|
405
|
+
return (vals) => resolve(vals, path);
|
|
406
|
+
}
|
|
407
|
+
if (raw.includes("{{")) {
|
|
408
|
+
const parts = raw.split(/\{\{([\s\S]+?)\}\}/g);
|
|
409
|
+
return (vals) => parts.map((s, i) => i & 1 ? resolve(vals, s) ?? "" : s).join("");
|
|
410
|
+
}
|
|
411
|
+
return () => raw;
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
// src/compile.ts
|
|
415
|
+
function collectProps(node, kind, host) {
|
|
416
|
+
const propGetters = [];
|
|
417
|
+
const pseudoClasses = [];
|
|
418
|
+
let hintSize = null;
|
|
419
|
+
for (const { name, value } of [...node.attributes]) {
|
|
420
|
+
if (name === "sc-name" || name === "data-dc-tpl") continue;
|
|
421
|
+
let key = name;
|
|
422
|
+
if (key.startsWith(CAMEL_ATTR))
|
|
423
|
+
key = kebabToCamel(key.slice(CAMEL_ATTR.length));
|
|
424
|
+
if (key === "hint-size") {
|
|
425
|
+
hintSize = value;
|
|
426
|
+
continue;
|
|
427
|
+
}
|
|
428
|
+
if (key.startsWith("style-")) {
|
|
429
|
+
pseudoClasses.push(host.pseudoClass(key.slice(6), value));
|
|
430
|
+
continue;
|
|
431
|
+
}
|
|
432
|
+
if (kind !== "dom") {
|
|
433
|
+
if (key.includes("-") && !(kind === "x-import" && (key.startsWith("aria-") || key.startsWith("data-"))))
|
|
434
|
+
key = kebabToCamel(key);
|
|
435
|
+
} else {
|
|
436
|
+
if (key === "class") key = "className";
|
|
437
|
+
else if (key === "for") key = "htmlFor";
|
|
438
|
+
else if (key.startsWith("on"))
|
|
439
|
+
key = EVENT_MAP[key] || "on" + key[2].toUpperCase() + key.slice(3);
|
|
440
|
+
}
|
|
441
|
+
propGetters.push([key, compileAttr(value)]);
|
|
442
|
+
}
|
|
443
|
+
return { propGetters, pseudoClasses, hintSize };
|
|
444
|
+
}
|
|
445
|
+
var HOST_STYLE_PROPS = /* @__PURE__ */ new Set([
|
|
446
|
+
"position",
|
|
447
|
+
"left",
|
|
448
|
+
"right",
|
|
449
|
+
"top",
|
|
450
|
+
"bottom",
|
|
451
|
+
"inset",
|
|
452
|
+
"width",
|
|
453
|
+
"height",
|
|
454
|
+
"z-index",
|
|
455
|
+
"transform"
|
|
456
|
+
]);
|
|
457
|
+
function hostPositionStyle(style) {
|
|
458
|
+
const all = typeof style === "string" ? cssToObj(style) : style != null && typeof style === "object" ? style : null;
|
|
459
|
+
if (!all) return void 0;
|
|
460
|
+
const out = {};
|
|
461
|
+
for (const [k, v] of Object.entries(all)) {
|
|
462
|
+
const kebab = k.replace(/[A-Z]/g, (c) => "-" + c.toLowerCase());
|
|
463
|
+
if (HOST_STYLE_PROPS.has(kebab)) out[k] = v;
|
|
464
|
+
}
|
|
465
|
+
return Object.keys(out).length ? out : void 0;
|
|
466
|
+
}
|
|
467
|
+
function compileTemplate(html, host) {
|
|
468
|
+
const tpl = document.createElement("template");
|
|
469
|
+
//! nosemgrep: direct-inner-html-assignment
|
|
470
|
+
tpl.innerHTML = encodeCase(html);
|
|
471
|
+
let tplN = 0;
|
|
472
|
+
(function stamp(node) {
|
|
473
|
+
if (node.nodeType === Node.ELEMENT_NODE) {
|
|
474
|
+
node.setAttribute("data-dc-tpl", String(tplN++));
|
|
475
|
+
}
|
|
476
|
+
for (const c of node.childNodes) stamp(c);
|
|
477
|
+
})(tpl.content);
|
|
478
|
+
const builders = walkChildren(tpl.content, host);
|
|
479
|
+
const render = ((vals, ctx) => builders.map((b, i) => b(vals || {}, ctx, i)));
|
|
480
|
+
render.__annotated = tpl.innerHTML;
|
|
481
|
+
return render;
|
|
482
|
+
}
|
|
483
|
+
function walkChildren(node, host) {
|
|
484
|
+
return [...node.childNodes].map((c) => walk(c, host)).filter((b) => b != null);
|
|
485
|
+
}
|
|
486
|
+
function walk(node, host) {
|
|
487
|
+
if (node.nodeType === Node.TEXT_NODE) return walkText(node);
|
|
488
|
+
if (node.nodeType !== Node.ELEMENT_NODE) return null;
|
|
489
|
+
const el = node;
|
|
490
|
+
const tag = el.tagName.toLowerCase();
|
|
491
|
+
if (tag === "sc-for") return walkFor(el, host);
|
|
492
|
+
if (tag === "sc-if") return walkIf(el, host);
|
|
493
|
+
if (tag === "x-import") return walkXImport(el, host);
|
|
494
|
+
if (tag === "sc-helmet") return host.helmet(el);
|
|
495
|
+
if (tag === "dc-import") return walkComponent(el, host);
|
|
496
|
+
return walkElement(el, host);
|
|
497
|
+
}
|
|
498
|
+
var warnedHoles = /* @__PURE__ */ new Set();
|
|
499
|
+
function warnUnresolved(ctx, what) {
|
|
500
|
+
const key = (ctx?.__name || "?") + "\0" + what;
|
|
501
|
+
if (warnedHoles.has(key)) return;
|
|
502
|
+
warnedHoles.add(key);
|
|
503
|
+
console.warn("[dc-runtime] " + (ctx?.__name || "template") + ": " + what);
|
|
504
|
+
}
|
|
505
|
+
function walkText(node) {
|
|
506
|
+
const txt = node.nodeValue ?? "";
|
|
507
|
+
if (!txt.includes("{{")) {
|
|
508
|
+
if (!txt.trim() && !txt.includes(" ")) return null;
|
|
509
|
+
return () => txt;
|
|
510
|
+
}
|
|
511
|
+
const parts = txt.split(/\{\{([\s\S]+?)\}\}/g);
|
|
512
|
+
return (vals, ctx, key) => h(
|
|
513
|
+
getReact().Fragment,
|
|
514
|
+
{ key },
|
|
515
|
+
...parts.map((p, i) => {
|
|
516
|
+
if (!(i & 1)) return p;
|
|
517
|
+
const v = resolve(vals, p);
|
|
518
|
+
if (v === void 0) {
|
|
519
|
+
if (!ctx?.__streamingNow) {
|
|
520
|
+
if (document.body?.hasAttribute("data-dc-editor-on")) {
|
|
521
|
+
return h(
|
|
522
|
+
"span",
|
|
523
|
+
{ key: i, className: "sc-interp sc-unresolved" },
|
|
524
|
+
"{{ " + p.trim() + " }}"
|
|
525
|
+
);
|
|
526
|
+
}
|
|
527
|
+
warnUnresolved(
|
|
528
|
+
ctx,
|
|
529
|
+
"{{ " + p.trim() + " }} never resolved \u2014 rendered as empty"
|
|
530
|
+
);
|
|
531
|
+
return null;
|
|
532
|
+
}
|
|
533
|
+
return h(
|
|
534
|
+
"span",
|
|
535
|
+
{ key: i, className: "sc-interp sc-missing" },
|
|
536
|
+
p.trim()
|
|
537
|
+
);
|
|
538
|
+
}
|
|
539
|
+
if (getReact().isValidElement(v) || Array.isArray(v)) {
|
|
540
|
+
return h(getReact().Fragment, { key: i }, v);
|
|
541
|
+
}
|
|
542
|
+
if (v === null || typeof v === "boolean") return null;
|
|
543
|
+
return h("span", { key: i, className: "sc-interp" }, String(v));
|
|
544
|
+
})
|
|
545
|
+
);
|
|
546
|
+
}
|
|
547
|
+
function walkFor(el, host) {
|
|
548
|
+
const listGet = compileAttr(el.getAttribute("list") || "");
|
|
549
|
+
const asName = el.getAttribute("as") || "item";
|
|
550
|
+
const hintN = parseInt(el.getAttribute("hint-placeholder-count") || "0", 10);
|
|
551
|
+
const kids = walkChildren(el, host);
|
|
552
|
+
const listSrc = el.getAttribute("list") || "";
|
|
553
|
+
return (vals, ctx, key) => {
|
|
554
|
+
let list = listGet(vals);
|
|
555
|
+
if (!Array.isArray(list)) {
|
|
556
|
+
if (!ctx?.__streamingNow) {
|
|
557
|
+
if (list !== void 0 && list !== null) {
|
|
558
|
+
warnUnresolved(
|
|
559
|
+
ctx,
|
|
560
|
+
'sc-for list="' + listSrc + '" is not an array (' + typeof list + ")"
|
|
561
|
+
);
|
|
562
|
+
}
|
|
563
|
+
list = [];
|
|
564
|
+
} else {
|
|
565
|
+
list = hintN > 0 ? Array(hintN).fill(void 0) : [];
|
|
566
|
+
}
|
|
567
|
+
}
|
|
568
|
+
return h(
|
|
569
|
+
getReact().Fragment,
|
|
570
|
+
{ key },
|
|
571
|
+
list.map((item, i) => {
|
|
572
|
+
const sub = { ...vals, [asName]: item, $index: i };
|
|
573
|
+
return h(
|
|
574
|
+
getReact().Fragment,
|
|
575
|
+
{ key: i },
|
|
576
|
+
kids.map((b, j) => b(sub, ctx, j))
|
|
577
|
+
);
|
|
578
|
+
})
|
|
579
|
+
);
|
|
580
|
+
};
|
|
581
|
+
}
|
|
582
|
+
function walkIf(el, host) {
|
|
583
|
+
const valGet = compileAttr(el.getAttribute("value") || "");
|
|
584
|
+
const hintRaw = el.getAttribute("hint-placeholder-val");
|
|
585
|
+
const hintGet = hintRaw != null ? compileAttr(hintRaw) : null;
|
|
586
|
+
const kids = walkChildren(el, host);
|
|
587
|
+
return (vals, ctx, key) => {
|
|
588
|
+
let v = valGet(vals);
|
|
589
|
+
if (v === void 0 && hintGet && ctx?.__streamingNow) v = hintGet(vals);
|
|
590
|
+
return v ? h(
|
|
591
|
+
getReact().Fragment,
|
|
592
|
+
{ key },
|
|
593
|
+
kids.map((b, j) => b(vals, ctx, j))
|
|
594
|
+
) : null;
|
|
595
|
+
};
|
|
596
|
+
}
|
|
597
|
+
function walkComponent(el, host) {
|
|
598
|
+
const name = el.getAttribute("name") || el.getAttribute("component") || "";
|
|
599
|
+
el.removeAttribute("name");
|
|
600
|
+
el.removeAttribute("component");
|
|
601
|
+
const tplId = el.getAttribute("data-dc-tpl");
|
|
602
|
+
const styleRaw = el.getAttribute("style");
|
|
603
|
+
el.removeAttribute("style");
|
|
604
|
+
const styleGet = styleRaw != null ? compileAttr(styleRaw) : null;
|
|
605
|
+
const { propGetters, hintSize } = collectProps(el, "dc-import", host);
|
|
606
|
+
const kids = walkChildren(el, host);
|
|
607
|
+
return (vals, ctx, key) => {
|
|
608
|
+
const props = {
|
|
609
|
+
key,
|
|
610
|
+
__hintSize: hintSize,
|
|
611
|
+
__tplId: tplId,
|
|
612
|
+
__hostStyle: styleGet ? hostPositionStyle(styleGet(vals)) : void 0
|
|
613
|
+
};
|
|
614
|
+
for (const [k, g] of propGetters) {
|
|
615
|
+
const v = g(vals);
|
|
616
|
+
if (k === "dcProps") {
|
|
617
|
+
if (v && typeof v === "object") Object.assign(props, v);
|
|
618
|
+
continue;
|
|
619
|
+
}
|
|
620
|
+
props[k] = v;
|
|
621
|
+
}
|
|
622
|
+
if (kids.length) props.children = kids.map((b, j) => b(vals, ctx, j));
|
|
623
|
+
return h(host.component(name), props);
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
function walkXImport(el, host) {
|
|
627
|
+
const globalNameGet = compileAttr(
|
|
628
|
+
el.getAttribute("component-from-global-scope") || ""
|
|
629
|
+
);
|
|
630
|
+
const exportNameGet = compileAttr(
|
|
631
|
+
el.getAttribute("component") || el.getAttribute("name") || ""
|
|
632
|
+
);
|
|
633
|
+
const fromRaw = el.getAttribute("from") || (el.getAttribute("component-from-global-scope") ? "" : el.getAttribute("src") || el.getAttribute("import") || "");
|
|
634
|
+
const urls = fromRaw.trim() ? fromRaw.trim().split(/\s+/) : [];
|
|
635
|
+
const url = urls.length ? urls[urls.length - 1] : "";
|
|
636
|
+
const kindOf = (u) => /\.(jsx|tsx)(\?|#|$)/i.test(u) ? "jsx" : "js";
|
|
637
|
+
const tplId = el.getAttribute("data-dc-tpl");
|
|
638
|
+
const styleRaw = el.getAttribute("style");
|
|
639
|
+
el.removeAttribute("style");
|
|
640
|
+
const styleGet = styleRaw != null ? compileAttr(styleRaw) : null;
|
|
641
|
+
const wrap = tplId != null || styleGet != null;
|
|
642
|
+
const { propGetters, hintSize } = collectProps(el, "x-import", host);
|
|
643
|
+
const hasContent = el.children.length > 0 || !!(el.textContent || "").trim();
|
|
644
|
+
const kids = hasContent ? walkChildren(el, host) : [];
|
|
645
|
+
const urlBindable = fromRaw.includes("{{");
|
|
646
|
+
if (urls.length && !urlBindable) {
|
|
647
|
+
let prev;
|
|
648
|
+
for (const u of urls) prev = host.loadExternal(kindOf(u), u, prev);
|
|
649
|
+
}
|
|
650
|
+
const evalName = (g, vals) => {
|
|
651
|
+
const v = g(vals);
|
|
652
|
+
const s = v == null ? "" : String(v);
|
|
653
|
+
return s.includes("{{") ? "" : s;
|
|
654
|
+
};
|
|
655
|
+
return (vals, ctx, key) => {
|
|
656
|
+
const globalName = evalName(globalNameGet, vals);
|
|
657
|
+
const name = globalName || evalName(exportNameGet, vals);
|
|
658
|
+
const C = !name || urlBindable ? null : globalName ? host.resolveExternalGlobal(url, globalName) : host.resolveExternal(url, name);
|
|
659
|
+
const hostStyle = styleGet ? hostPositionStyle(styleGet(vals)) : void 0;
|
|
660
|
+
const wrapper = wrap ? {
|
|
661
|
+
key,
|
|
662
|
+
className: "sc-host-x",
|
|
663
|
+
"data-dc-tpl": tplId,
|
|
664
|
+
style: hostStyle || { display: "contents" }
|
|
665
|
+
} : null;
|
|
666
|
+
if (!C) {
|
|
667
|
+
const error = urlBindable ? "x-import `from` cannot contain {{ \u2026 }} \u2014 module URLs are resolved at parse time; use a literal URL" : host.resolveExternalError(url, name);
|
|
668
|
+
const ph = host.placeholder({
|
|
669
|
+
key: wrapper ? void 0 : key,
|
|
670
|
+
name,
|
|
671
|
+
hintSize,
|
|
672
|
+
error
|
|
673
|
+
});
|
|
674
|
+
return wrapper ? h("div", wrapper, ph) : ph;
|
|
675
|
+
}
|
|
676
|
+
const props = wrapper ? {} : { key };
|
|
677
|
+
let unresolvedHole = false;
|
|
678
|
+
for (const [k, g] of propGetters) {
|
|
679
|
+
if (k === "component" || k === "componentFromGlobalScope" || k === "from") {
|
|
680
|
+
continue;
|
|
681
|
+
}
|
|
682
|
+
const v = g(vals);
|
|
683
|
+
if (v === void 0) unresolvedHole = true;
|
|
684
|
+
if (k === "dcProps") {
|
|
685
|
+
if (v && typeof v === "object") Object.assign(props, v);
|
|
686
|
+
continue;
|
|
687
|
+
}
|
|
688
|
+
props[k] = v;
|
|
689
|
+
}
|
|
690
|
+
if (unresolvedHole && ctx?.__htmlStreamingNow) {
|
|
691
|
+
const ph = host.placeholder({
|
|
692
|
+
key: wrapper ? void 0 : key,
|
|
693
|
+
name,
|
|
694
|
+
hintSize,
|
|
695
|
+
error: null
|
|
696
|
+
});
|
|
697
|
+
return wrapper ? h("div", wrapper, ph) : ph;
|
|
698
|
+
}
|
|
699
|
+
if (kids.length) props.children = kids.map((b, j) => b(vals, ctx, j));
|
|
700
|
+
return wrapper ? h("div", wrapper, h(C, props)) : h(C, props);
|
|
701
|
+
};
|
|
702
|
+
}
|
|
703
|
+
function contentKey(el) {
|
|
704
|
+
const clone = el.cloneNode(true);
|
|
705
|
+
for (const d of clone.querySelectorAll("*")) {
|
|
706
|
+
while (d.attributes.length) d.removeAttribute(d.attributes[0].name);
|
|
707
|
+
}
|
|
708
|
+
const s = clone.innerHTML;
|
|
709
|
+
let h2 = 5381;
|
|
710
|
+
for (let i = 0; i < s.length; i++) h2 = (h2 << 5) + h2 + s.charCodeAt(i) | 0;
|
|
711
|
+
return s.length + "." + (h2 >>> 0).toString(36);
|
|
712
|
+
}
|
|
713
|
+
var NEVER_CONTENT_KEYED = new Set(
|
|
714
|
+
"script style textarea option title select canvas iframe video audio".split(
|
|
715
|
+
" "
|
|
716
|
+
)
|
|
717
|
+
);
|
|
718
|
+
var NOT_INLINE_SELECTOR = ":not(" + [...INLINE_TEXT_TAGS].join(",") + ")";
|
|
719
|
+
function walkElement(el, host) {
|
|
720
|
+
const realTag = RAW_UNWRAP[el.localName] || el.localName;
|
|
721
|
+
const tplId = el.getAttribute("data-dc-tpl");
|
|
722
|
+
const inlineOnly = el.childNodes.length > 0 && !NEVER_CONTENT_KEYED.has(realTag) && el.querySelector(NOT_INLINE_SELECTOR) === null;
|
|
723
|
+
const keySuffix = inlineOnly ? "|" + contentKey(el) : "";
|
|
724
|
+
const { propGetters, pseudoClasses } = collectProps(el, "dom", host);
|
|
725
|
+
const kids = walkChildren(el, host);
|
|
726
|
+
return (vals, ctx, key) => {
|
|
727
|
+
const props = {
|
|
728
|
+
key: key + keySuffix,
|
|
729
|
+
"data-dc-tpl": tplId
|
|
730
|
+
};
|
|
731
|
+
for (const [k, g] of propGetters) {
|
|
732
|
+
let v = g(vals);
|
|
733
|
+
if (k === "style" && typeof v === "string") v = cssToObj(v);
|
|
734
|
+
if ((k === "value" || k === "checked") && v === void 0) {
|
|
735
|
+
v = k === "checked" ? false : "";
|
|
736
|
+
}
|
|
737
|
+
props[k] = v;
|
|
738
|
+
}
|
|
739
|
+
if (pseudoClasses.length) {
|
|
740
|
+
props.className = [props.className, ...pseudoClasses].filter(Boolean).join(" ");
|
|
741
|
+
}
|
|
742
|
+
return h(realTag, props, ...kids.map((b, j) => b(vals, ctx, j)));
|
|
743
|
+
};
|
|
744
|
+
}
|
|
745
|
+
|
|
746
|
+
// src/logic.ts
|
|
747
|
+
var StreamableLogic = class {
|
|
748
|
+
constructor(props) {
|
|
749
|
+
__publicField(this, "props");
|
|
750
|
+
__publicField(this, "state", {});
|
|
751
|
+
/** Back-pointer to the wrapper component, installed after construction. */
|
|
752
|
+
__publicField(this, "__host");
|
|
753
|
+
this.props = props || {};
|
|
754
|
+
}
|
|
755
|
+
setState(update, cb) {
|
|
756
|
+
this.__host && this.__host.__setLogicState(update, cb);
|
|
757
|
+
}
|
|
758
|
+
forceUpdate() {
|
|
759
|
+
this.__host && this.__host.forceUpdate();
|
|
760
|
+
}
|
|
761
|
+
componentDidMount() {
|
|
762
|
+
}
|
|
763
|
+
componentDidUpdate(_prevProps) {
|
|
764
|
+
}
|
|
765
|
+
componentWillUnmount() {
|
|
766
|
+
}
|
|
767
|
+
/** The flat object the template renders against (merged over props). */
|
|
768
|
+
renderVals() {
|
|
769
|
+
return {};
|
|
770
|
+
}
|
|
771
|
+
};
|
|
772
|
+
function evalDcLogic(src) {
|
|
773
|
+
//! nosemgrep: eval-and-function-constructor
|
|
774
|
+
const fn = new Function(
|
|
775
|
+
"DCLogic",
|
|
776
|
+
"StreamableLogic",
|
|
777
|
+
"React",
|
|
778
|
+
src + '\n;return (typeof Component!=="undefined"&&Component)||undefined;'
|
|
779
|
+
);
|
|
780
|
+
return fn(StreamableLogic, StreamableLogic, getReact());
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
// src/component.ts
|
|
784
|
+
function shallowEqual(a, b) {
|
|
785
|
+
if (!b) return false;
|
|
786
|
+
const ak = Object.keys(a).filter((k) => k !== "children");
|
|
787
|
+
const bk = Object.keys(b).filter((k) => k !== "children");
|
|
788
|
+
if (ak.length !== bk.length) return false;
|
|
789
|
+
for (const k of ak) if (a[k] !== b[k]) return false;
|
|
790
|
+
return true;
|
|
791
|
+
}
|
|
792
|
+
function Placeholder({
|
|
793
|
+
name,
|
|
794
|
+
hintSize,
|
|
795
|
+
streaming,
|
|
796
|
+
error
|
|
797
|
+
}) {
|
|
798
|
+
const [w, hgt] = (hintSize || "100%,60px").split(",");
|
|
799
|
+
return h(
|
|
800
|
+
"div",
|
|
801
|
+
{
|
|
802
|
+
className: "sc-placeholder" + (streaming ? " sc-streaming" : ""),
|
|
803
|
+
style: { width: w.trim(), height: hgt && hgt.trim() },
|
|
804
|
+
title: name
|
|
805
|
+
},
|
|
806
|
+
error ? h(
|
|
807
|
+
"div",
|
|
808
|
+
{ className: "sc-placeholder-error" },
|
|
809
|
+
(name ? name + ": " : "") + error
|
|
810
|
+
) : null
|
|
811
|
+
);
|
|
812
|
+
}
|
|
813
|
+
function hintToMin(hint) {
|
|
814
|
+
if (!hint) return void 0;
|
|
815
|
+
const [w, hgt] = hint.split(",");
|
|
816
|
+
return { minWidth: w.trim(), minHeight: hgt && hgt.trim() };
|
|
817
|
+
}
|
|
818
|
+
function createComponentFactory(registry, ensureFetched) {
|
|
819
|
+
const React = getReact();
|
|
820
|
+
const AncestorContext = React.createContext([]);
|
|
821
|
+
class StreamableComponent extends React.Component {
|
|
822
|
+
constructor(props) {
|
|
823
|
+
super(props);
|
|
824
|
+
__publicField(this, "__name");
|
|
825
|
+
__publicField(this, "__sub");
|
|
826
|
+
__publicField(this, "__needsDidMount", false);
|
|
827
|
+
/** Snapshot of the registry's streaming flags taken at render time —
|
|
828
|
+
* builders read it off the RenderCtx (this) to pick placeholder vs
|
|
829
|
+
* render-nothing for unresolved values. */
|
|
830
|
+
__publicField(this, "__streamingNow", false);
|
|
831
|
+
__publicField(this, "__htmlStreamingNow", false);
|
|
832
|
+
/** When a construct throws, remember the (class, registry.ver, props)
|
|
833
|
+
* triple so render-time reconcile doesn't re-attempt it on every parent
|
|
834
|
+
* re-render. A registry bump (new class, template, external module
|
|
835
|
+
* resolving via bumpAll) changes `ver` and breaks the memo so an
|
|
836
|
+
* env-dependent constructor can self-heal. */
|
|
837
|
+
__publicField(this, "__failedLogic", null);
|
|
838
|
+
__publicField(this, "__failedUserProps", null);
|
|
839
|
+
__publicField(this, "__failedVer", -1);
|
|
840
|
+
/** Per-instance constructor error — kept here (not on the registry entry)
|
|
841
|
+
* so one instance's successful construct can't hide a sibling's failure,
|
|
842
|
+
* and a construct can never wipe an eval error `updateJs` recorded on
|
|
843
|
+
* `r.logicError`. */
|
|
844
|
+
__publicField(this, "__ctorError", null);
|
|
845
|
+
__publicField(this, "logic");
|
|
846
|
+
this.__name = props.__name;
|
|
847
|
+
this.state = { __v: 0, __err: null };
|
|
848
|
+
this.__sub = () => {
|
|
849
|
+
if (this.state.__err) this.setState({ __err: null });
|
|
850
|
+
this.forceUpdate();
|
|
851
|
+
};
|
|
852
|
+
this.__makeLogic(registry.get(this.__name).Logic, null);
|
|
853
|
+
ensureFetched(this.__name);
|
|
854
|
+
}
|
|
855
|
+
/** Error-boundary hook: a render crash anywhere in this DC's subtree
|
|
856
|
+
* (its own template, an x-import'd component, a child DC without its
|
|
857
|
+
* own deeper boundary) lands here instead of unmounting the page. */
|
|
858
|
+
static getDerivedStateFromError(e) {
|
|
859
|
+
return { __err: e instanceof Error && e.message ? e.message : String(e) };
|
|
860
|
+
}
|
|
861
|
+
componentDidCatch(e, info) {
|
|
862
|
+
console.error(
|
|
863
|
+
"[dc-runtime] render error in <" + this.__name + ">:",
|
|
864
|
+
e,
|
|
865
|
+
info?.componentStack || ""
|
|
866
|
+
);
|
|
867
|
+
}
|
|
868
|
+
/** Instantiate the logic class (or the no-op base) and adopt `prevState`
|
|
869
|
+
* over its initial state — used both at mount and on hot-swap. */
|
|
870
|
+
__makeLogic(Logic, prevState) {
|
|
871
|
+
const L = Logic || StreamableLogic;
|
|
872
|
+
try {
|
|
873
|
+
this.logic = new L(this.__userProps());
|
|
874
|
+
this.__failedLogic = null;
|
|
875
|
+
this.__failedUserProps = null;
|
|
876
|
+
this.__ctorError = null;
|
|
877
|
+
} catch (e) {
|
|
878
|
+
console.error(e);
|
|
879
|
+
this.__failedLogic = Logic;
|
|
880
|
+
this.__failedUserProps = this.__userProps();
|
|
881
|
+
this.__failedVer = registry.get(this.__name).ver;
|
|
882
|
+
this.__ctorError = this.__name + ": " + (e instanceof Error && e.message ? e.message : String(e));
|
|
883
|
+
this.logic = new StreamableLogic(
|
|
884
|
+
this.__userProps()
|
|
885
|
+
);
|
|
886
|
+
}
|
|
887
|
+
this.logic.__host = this;
|
|
888
|
+
if (prevState)
|
|
889
|
+
this.logic.state = { ...this.logic.state || {}, ...prevState };
|
|
890
|
+
}
|
|
891
|
+
/** The props the author's logic + template see — internal __-prefixed
|
|
892
|
+
* wiring stripped. */
|
|
893
|
+
__userProps() {
|
|
894
|
+
const { __name, __hintSize, __tplId, __hostStyle, ...rest } = this.props;
|
|
895
|
+
return rest;
|
|
896
|
+
}
|
|
897
|
+
__setLogicState(update, cb) {
|
|
898
|
+
const prev = this.logic.state;
|
|
899
|
+
const patch = typeof update === "function" ? update(prev) : update;
|
|
900
|
+
this.logic.state = { ...prev, ...patch };
|
|
901
|
+
this.setState((s) => ({ __v: s.__v + 1 }), cb);
|
|
902
|
+
}
|
|
903
|
+
/** Swap the logic instance when the registry's Logic class changed
|
|
904
|
+
* (streaming completion, hot reload). State carries over; didMount
|
|
905
|
+
* re-fires after the swap commits so refs exist. */
|
|
906
|
+
__reconcileLogic() {
|
|
907
|
+
const r = registry.get(this.__name);
|
|
908
|
+
const Next = r.Logic;
|
|
909
|
+
const Cur = this.logic.constructor;
|
|
910
|
+
if (Next === Cur || !Next && Cur === StreamableLogic || Next === this.__failedLogic && r.ver === this.__failedVer && shallowEqual(this.__userProps(), this.__failedUserProps)) {
|
|
911
|
+
return;
|
|
912
|
+
}
|
|
913
|
+
if (!this.__needsDidMount) {
|
|
914
|
+
try {
|
|
915
|
+
this.logic.componentWillUnmount();
|
|
916
|
+
} catch (e) {
|
|
917
|
+
console.error(e);
|
|
918
|
+
}
|
|
919
|
+
}
|
|
920
|
+
this.__makeLogic(Next, this.logic.state);
|
|
921
|
+
this.__needsDidMount = true;
|
|
922
|
+
}
|
|
923
|
+
componentDidMount() {
|
|
924
|
+
registry.get(this.__name).subs.add(this.__sub);
|
|
925
|
+
try {
|
|
926
|
+
this.logic.componentDidMount();
|
|
927
|
+
} catch (e) {
|
|
928
|
+
console.error(e);
|
|
929
|
+
}
|
|
930
|
+
}
|
|
931
|
+
componentDidUpdate(prevProps) {
|
|
932
|
+
this.logic.props = this.__userProps();
|
|
933
|
+
if (this.__needsDidMount) {
|
|
934
|
+
if (this.state.__err || !registry.get(this.__name).tpl) return;
|
|
935
|
+
this.__needsDidMount = false;
|
|
936
|
+
try {
|
|
937
|
+
this.logic.componentDidMount();
|
|
938
|
+
} catch (e) {
|
|
939
|
+
console.error(e);
|
|
940
|
+
}
|
|
941
|
+
} else {
|
|
942
|
+
try {
|
|
943
|
+
this.logic.componentDidUpdate(prevProps);
|
|
944
|
+
} catch (e) {
|
|
945
|
+
console.error(e);
|
|
946
|
+
}
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
componentWillUnmount() {
|
|
950
|
+
registry.get(this.__name).subs.delete(this.__sub);
|
|
951
|
+
if (!this.__needsDidMount) {
|
|
952
|
+
try {
|
|
953
|
+
this.logic.componentWillUnmount();
|
|
954
|
+
} catch (e) {
|
|
955
|
+
console.error(e);
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
render() {
|
|
960
|
+
const r = registry.get(this.__name);
|
|
961
|
+
const cls = "sc-host" + (r.htmlStreaming ? " sc-streaming-html" : "") + (r.jsStreaming ? " sc-streaming-js" : "");
|
|
962
|
+
const hintStyle = r.htmlStreaming ? hintToMin(this.props.__hintSize) : void 0;
|
|
963
|
+
const hostStyle = this.props.__hostStyle || hintStyle ? { ...hintStyle || {}, ...this.props.__hostStyle || {} } : void 0;
|
|
964
|
+
const hostBase = {
|
|
965
|
+
className: cls,
|
|
966
|
+
style: hostStyle,
|
|
967
|
+
"data-sc-name": this.__name,
|
|
968
|
+
"data-dc-tpl": this.props.__tplId
|
|
969
|
+
};
|
|
970
|
+
const chain = Array.isArray(this.context) ? this.context : [];
|
|
971
|
+
if (chain.includes(this.__name)) {
|
|
972
|
+
const cycle = [
|
|
973
|
+
...chain.slice(chain.indexOf(this.__name)),
|
|
974
|
+
this.__name
|
|
975
|
+
].join(" \u2192 ");
|
|
976
|
+
return h(
|
|
977
|
+
"div",
|
|
978
|
+
{ ...hostBase, className: cls + " sc-has-error" },
|
|
979
|
+
h(Placeholder, {
|
|
980
|
+
name: this.__name,
|
|
981
|
+
hintSize: this.props.__hintSize,
|
|
982
|
+
error: "circular import: " + cycle
|
|
983
|
+
})
|
|
984
|
+
);
|
|
985
|
+
}
|
|
986
|
+
if (this.state.__err) {
|
|
987
|
+
return h(
|
|
988
|
+
"div",
|
|
989
|
+
{ ...hostBase, className: cls + " sc-has-error" },
|
|
990
|
+
h(
|
|
991
|
+
"div",
|
|
992
|
+
{ className: "sc-logic-error", "data-omelette-chrome": "" },
|
|
993
|
+
this.__name + ": " + this.state.__err
|
|
994
|
+
),
|
|
995
|
+
h(Placeholder, {
|
|
996
|
+
name: this.__name,
|
|
997
|
+
hintSize: this.props.__hintSize,
|
|
998
|
+
error: this.state.__err
|
|
999
|
+
})
|
|
1000
|
+
);
|
|
1001
|
+
}
|
|
1002
|
+
this.__reconcileLogic();
|
|
1003
|
+
if (!r.tpl) {
|
|
1004
|
+
return h(
|
|
1005
|
+
"div",
|
|
1006
|
+
hostBase,
|
|
1007
|
+
h(Placeholder, { name: this.__name, hintSize: this.props.__hintSize })
|
|
1008
|
+
);
|
|
1009
|
+
}
|
|
1010
|
+
const userProps = this.__userProps();
|
|
1011
|
+
this.logic.props = userProps;
|
|
1012
|
+
let vals = userProps;
|
|
1013
|
+
let renderErr = r.logicError || this.__ctorError;
|
|
1014
|
+
try {
|
|
1015
|
+
vals = { ...userProps, ...this.logic.renderVals() || {} };
|
|
1016
|
+
} catch (e) {
|
|
1017
|
+
console.error(e);
|
|
1018
|
+
renderErr = this.__name + ".renderVals(): " + (e instanceof Error && e.message ? e.message : String(e));
|
|
1019
|
+
}
|
|
1020
|
+
this.__streamingNow = !!(r.htmlStreaming || r.jsStreaming);
|
|
1021
|
+
this.__htmlStreamingNow = !!r.htmlStreaming;
|
|
1022
|
+
return h(
|
|
1023
|
+
"div",
|
|
1024
|
+
{ ...hostBase, className: cls + (renderErr ? " sc-has-error" : "") },
|
|
1025
|
+
renderErr && h(
|
|
1026
|
+
"div",
|
|
1027
|
+
{ className: "sc-logic-error", "data-omelette-chrome": "" },
|
|
1028
|
+
renderErr
|
|
1029
|
+
),
|
|
1030
|
+
h(
|
|
1031
|
+
AncestorContext.Provider,
|
|
1032
|
+
{ value: [...chain, this.__name] },
|
|
1033
|
+
r.tpl(vals, this)
|
|
1034
|
+
)
|
|
1035
|
+
);
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
__publicField(StreamableComponent, "contextType", AncestorContext);
|
|
1039
|
+
const named = /* @__PURE__ */ new Map();
|
|
1040
|
+
function getDC(name) {
|
|
1041
|
+
const hit = named.get(name);
|
|
1042
|
+
if (hit) return hit;
|
|
1043
|
+
function Dispatcher(p) {
|
|
1044
|
+
const [, setTick] = React.useState(0);
|
|
1045
|
+
React.useEffect(() => {
|
|
1046
|
+
const sub = () => setTick((n) => n + 1);
|
|
1047
|
+
registry.get(name).subs.add(sub);
|
|
1048
|
+
return () => {
|
|
1049
|
+
registry.get(name).subs.delete(sub);
|
|
1050
|
+
};
|
|
1051
|
+
}, []);
|
|
1052
|
+
ensureFetched(name);
|
|
1053
|
+
return h(StreamableComponent, { ...p, __name: name });
|
|
1054
|
+
}
|
|
1055
|
+
Dispatcher.displayName = name;
|
|
1056
|
+
named.set(name, Dispatcher);
|
|
1057
|
+
return Dispatcher;
|
|
1058
|
+
}
|
|
1059
|
+
return {
|
|
1060
|
+
getDC,
|
|
1061
|
+
StreamableComponent
|
|
1062
|
+
};
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
// src/bundled.ts
|
|
1066
|
+
function bundledBlob(url) {
|
|
1067
|
+
const blobs = window.__resourceBlobs;
|
|
1068
|
+
const b = blobs ? blobs[url.split("#")[0]] : void 0;
|
|
1069
|
+
return b instanceof Blob ? b : null;
|
|
1070
|
+
}
|
|
1071
|
+
|
|
1072
|
+
// src/cdn.ts
|
|
1073
|
+
var REACT_URL = "https://unpkg.com/react@18.3.1/umd/react.production.min.js";
|
|
1074
|
+
var REACT_SRI = "sha384-DGyLxAyjq0f9SPpVevD6IgztCFlnMF6oW/XQGmfe+IsZ8TqEiDrcHkMLKI6fiB/Z";
|
|
1075
|
+
var REACT_DOM_URL = "https://unpkg.com/react-dom@18.3.1/umd/react-dom.production.min.js";
|
|
1076
|
+
var REACT_DOM_SRI = "sha384-gTGxhz21lVGYNMcdJOyq01Edg0jhn/c22nsx0kyqP0TxaV5WVdsSH1fSDUf5YJj1";
|
|
1077
|
+
var BABEL_URL = "https://unpkg.com/@babel/standalone@7.29.0/babel.min.js";
|
|
1078
|
+
var BABEL_SRI = "sha384-m08KidiNqLdpJqLq95G/LEi8Qvjl/xUYll3QILypMoQ65QorJ9Lvtp2RXYGBFj1y";
|
|
1079
|
+
function cdnScriptFor(url, sri) {
|
|
1080
|
+
const res = window.__resources;
|
|
1081
|
+
const v = res ? res[url] : void 0;
|
|
1082
|
+
return typeof v === "string" && v ? { src: v } : { src: url, integrity: sri };
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
// src/external.ts
|
|
1086
|
+
var isCustomElementName = (n) => !n.includes(".") && n.includes("-");
|
|
1087
|
+
function isRenderableType(g) {
|
|
1088
|
+
if (typeof g === "function") return !isElementClass(g);
|
|
1089
|
+
return typeof g === "object" && g !== null && typeof g.$$typeof === "symbol";
|
|
1090
|
+
}
|
|
1091
|
+
function resolveDottedPath(root, name) {
|
|
1092
|
+
let cur = root;
|
|
1093
|
+
for (const seg of name.split(".")) {
|
|
1094
|
+
if (cur == null) return void 0;
|
|
1095
|
+
cur = cur[seg];
|
|
1096
|
+
}
|
|
1097
|
+
return cur;
|
|
1098
|
+
}
|
|
1099
|
+
var GLOBAL_POLL_INTERVAL_MS = 50;
|
|
1100
|
+
var GLOBAL_POLL_TIMEOUT_MS = 3e4;
|
|
1101
|
+
function createExternalModules(onResolved) {
|
|
1102
|
+
const cache = /* @__PURE__ */ new Map();
|
|
1103
|
+
let babelLoading = null;
|
|
1104
|
+
const reportedMissing = /* @__PURE__ */ new Map();
|
|
1105
|
+
const polling = /* @__PURE__ */ new Set();
|
|
1106
|
+
function ensureBabel() {
|
|
1107
|
+
if (window.Babel) return Promise.resolve();
|
|
1108
|
+
if (babelLoading) return babelLoading;
|
|
1109
|
+
const babel = cdnScriptFor(BABEL_URL, BABEL_SRI);
|
|
1110
|
+
babelLoading = new Promise((res, rej) => {
|
|
1111
|
+
const s = document.createElement("script");
|
|
1112
|
+
s.src = babel.src;
|
|
1113
|
+
if (babel.integrity) {
|
|
1114
|
+
s.integrity = babel.integrity;
|
|
1115
|
+
s.crossOrigin = "anonymous";
|
|
1116
|
+
}
|
|
1117
|
+
s.onload = () => res();
|
|
1118
|
+
s.onerror = rej;
|
|
1119
|
+
document.head.appendChild(s);
|
|
1120
|
+
});
|
|
1121
|
+
return babelLoading;
|
|
1122
|
+
}
|
|
1123
|
+
const pending = /* @__PURE__ */ new Map();
|
|
1124
|
+
function load(kind, url, after) {
|
|
1125
|
+
const existing = pending.get(url);
|
|
1126
|
+
if (existing) return existing;
|
|
1127
|
+
cache.set(url, null);
|
|
1128
|
+
console.info("[dc-runtime] x-import: loading", url, "(" + kind + ")");
|
|
1129
|
+
const ready = Promise.all([
|
|
1130
|
+
kind === "jsx" ? ensureBabel() : Promise.resolve(),
|
|
1131
|
+
after ?? Promise.resolve()
|
|
1132
|
+
]);
|
|
1133
|
+
const p = ready.then(() => {
|
|
1134
|
+
const pre = bundledBlob(url);
|
|
1135
|
+
if (pre) return pre.text();
|
|
1136
|
+
return fetch(url).then((r) => {
|
|
1137
|
+
if (!r.ok) throw new Error("HTTP " + r.status);
|
|
1138
|
+
return r.text();
|
|
1139
|
+
});
|
|
1140
|
+
}).then((src) => {
|
|
1141
|
+
const code = kind === "jsx" ? window.Babel.transform(src, {
|
|
1142
|
+
filename: url,
|
|
1143
|
+
presets: ["react", "typescript"]
|
|
1144
|
+
}).code : src;
|
|
1145
|
+
const module = { exports: {} };
|
|
1146
|
+
const before = new Set(Object.keys(window));
|
|
1147
|
+
//! nosemgrep: eval-and-function-constructor
|
|
1148
|
+
new Function("React", "module", "exports", "require", code)(
|
|
1149
|
+
getReact(),
|
|
1150
|
+
module,
|
|
1151
|
+
module.exports,
|
|
1152
|
+
() => ({})
|
|
1153
|
+
);
|
|
1154
|
+
const globals = {};
|
|
1155
|
+
for (const k of Object.keys(window)) {
|
|
1156
|
+
if (!before.has(k) && typeof window[k] === "function") {
|
|
1157
|
+
globals[k] = window[k];
|
|
1158
|
+
}
|
|
1159
|
+
}
|
|
1160
|
+
cache.set(url, { mod: module.exports, globals });
|
|
1161
|
+
console.info(
|
|
1162
|
+
"[dc-runtime] x-import: loaded",
|
|
1163
|
+
url,
|
|
1164
|
+
"\u2014 exports:",
|
|
1165
|
+
Object.keys(module.exports),
|
|
1166
|
+
"window globals:",
|
|
1167
|
+
Object.keys(globals)
|
|
1168
|
+
);
|
|
1169
|
+
onResolved();
|
|
1170
|
+
}).catch((e) => {
|
|
1171
|
+
cache.set(url, {
|
|
1172
|
+
mod: {},
|
|
1173
|
+
globals: {},
|
|
1174
|
+
error: "failed to load: " + (e instanceof Error && e.message ? e.message : String(e))
|
|
1175
|
+
});
|
|
1176
|
+
console.error(
|
|
1177
|
+
"[dc-runtime] x-import: FAILED to load",
|
|
1178
|
+
url,
|
|
1179
|
+
"(" + kind + ")",
|
|
1180
|
+
e
|
|
1181
|
+
);
|
|
1182
|
+
onResolved();
|
|
1183
|
+
});
|
|
1184
|
+
pending.set(url, p);
|
|
1185
|
+
return p;
|
|
1186
|
+
}
|
|
1187
|
+
function resolve2(url, name) {
|
|
1188
|
+
const entry = cache.get(url);
|
|
1189
|
+
if (!entry) return null;
|
|
1190
|
+
const { mod, globals } = entry;
|
|
1191
|
+
const C = mod && mod[name] || globals && globals[name] || typeof window !== "undefined" && window[name] || mod && mod.default;
|
|
1192
|
+
if (typeof C === "function") return C;
|
|
1193
|
+
const key = url + "\0" + name;
|
|
1194
|
+
if (!reportedMissing.has(key)) {
|
|
1195
|
+
reportedMissing.set(
|
|
1196
|
+
key,
|
|
1197
|
+
entry.error || 'no export named "' + name + '" (has: ' + Object.keys(mod).join(", ") + ")"
|
|
1198
|
+
);
|
|
1199
|
+
console.error(
|
|
1200
|
+
"[dc-runtime] x-import: module",
|
|
1201
|
+
url,
|
|
1202
|
+
"loaded but has no component named",
|
|
1203
|
+
JSON.stringify(name),
|
|
1204
|
+
"\u2014 available exports:",
|
|
1205
|
+
Object.keys(mod),
|
|
1206
|
+
"window globals:",
|
|
1207
|
+
Object.keys(globals),
|
|
1208
|
+
". The module must `module.exports = {" + name + "}` or set `window." + name + "`."
|
|
1209
|
+
);
|
|
1210
|
+
}
|
|
1211
|
+
return null;
|
|
1212
|
+
}
|
|
1213
|
+
function waitForGlobal(name) {
|
|
1214
|
+
if (polling.has(name)) return;
|
|
1215
|
+
polling.add(name);
|
|
1216
|
+
const started = Date.now();
|
|
1217
|
+
const isCE = isCustomElementName(name);
|
|
1218
|
+
const tick = () => {
|
|
1219
|
+
const found = isCE ? customElements.get(name) : isRenderableType(resolveDottedPath(window, name));
|
|
1220
|
+
if (found) {
|
|
1221
|
+
polling.delete(name);
|
|
1222
|
+
onResolved();
|
|
1223
|
+
return;
|
|
1224
|
+
}
|
|
1225
|
+
if (Date.now() - started >= GLOBAL_POLL_TIMEOUT_MS) {
|
|
1226
|
+
console.warn(
|
|
1227
|
+
"[dc-runtime] x-import: global",
|
|
1228
|
+
JSON.stringify(name),
|
|
1229
|
+
"never appeared on window after " + GLOBAL_POLL_TIMEOUT_MS + "ms"
|
|
1230
|
+
);
|
|
1231
|
+
return;
|
|
1232
|
+
}
|
|
1233
|
+
setTimeout(tick, GLOBAL_POLL_INTERVAL_MS);
|
|
1234
|
+
};
|
|
1235
|
+
setTimeout(tick, GLOBAL_POLL_INTERVAL_MS);
|
|
1236
|
+
}
|
|
1237
|
+
function resolveGlobal(url, name) {
|
|
1238
|
+
const isCE = isCustomElementName(name);
|
|
1239
|
+
if (!url) {
|
|
1240
|
+
if (isCE) {
|
|
1241
|
+
if (customElements.get(name)) return name;
|
|
1242
|
+
waitForGlobal(name);
|
|
1243
|
+
return null;
|
|
1244
|
+
}
|
|
1245
|
+
const g2 = resolveDottedPath(window, name);
|
|
1246
|
+
if (isRenderableType(g2)) return g2;
|
|
1247
|
+
waitForGlobal(name);
|
|
1248
|
+
return null;
|
|
1249
|
+
}
|
|
1250
|
+
const entry = cache.get(url);
|
|
1251
|
+
if (!entry) return null;
|
|
1252
|
+
if (isCE && customElements.get(name)) return name;
|
|
1253
|
+
const g = entry.globals[name] ?? resolveDottedPath(window, name);
|
|
1254
|
+
if (isRenderableType(g)) return g;
|
|
1255
|
+
if (name.includes(".")) return null;
|
|
1256
|
+
const key = url + "\0global\0" + name;
|
|
1257
|
+
if (!reportedMissing.has(key)) {
|
|
1258
|
+
reportedMissing.set(key, null);
|
|
1259
|
+
if (isCE && !customElements.get(name)) {
|
|
1260
|
+
console.warn(
|
|
1261
|
+
"[dc-runtime] x-import:",
|
|
1262
|
+
url,
|
|
1263
|
+
"loaded but no custom element",
|
|
1264
|
+
JSON.stringify(name),
|
|
1265
|
+
"is registered and window." + name + " is not a function \u2014 rendering <" + name + "> as an unknown element."
|
|
1266
|
+
);
|
|
1267
|
+
}
|
|
1268
|
+
}
|
|
1269
|
+
return name;
|
|
1270
|
+
}
|
|
1271
|
+
function getError(url, name) {
|
|
1272
|
+
const entry = cache.get(url);
|
|
1273
|
+
if (entry?.error) return entry.error;
|
|
1274
|
+
return reportedMissing.get(url + "\0" + name) || null;
|
|
1275
|
+
}
|
|
1276
|
+
return { load, resolve: resolve2, resolveGlobal, getError };
|
|
1277
|
+
}
|
|
1278
|
+
function isElementClass(g) {
|
|
1279
|
+
try {
|
|
1280
|
+
return typeof g === "function" && typeof HTMLElement !== "undefined" && g.prototype instanceof HTMLElement;
|
|
1281
|
+
} catch {
|
|
1282
|
+
return false;
|
|
1283
|
+
}
|
|
1284
|
+
}
|
|
1285
|
+
|
|
1286
|
+
// src/atomics.ts
|
|
1287
|
+
var ATOMIC_CSS = (
|
|
1288
|
+
// layout
|
|
1289
|
+
".fx{display:flex}.col{display:flex;flex-direction:column}.grid{display:grid}.ac{align-items:center}.jc{justify-content:center}.jb{justify-content:space-between}.f1{flex:1}.noshrink{flex-shrink:0}.wrap{flex-wrap:wrap}.fw5{font-weight:500}.fw6{font-weight:600}.fw7{font-weight:700}.fw8{font-weight:800}.fs11{font-size:11px}.fs12{font-size:12px}.fs13{font-size:13px}.fs14{font-size:14px}.fs15{font-size:15px}.fs16{font-size:16px}.fs20{font-size:20px}.fs22{font-size:22px}.upper{text-transform:uppercase}.tc{text-align:center}.nowrap{white-space:nowrap}.gap8{gap:8px}.gap10{gap:10px}.gap12{gap:12px}.gap16{gap:16px}.gap24{gap:24px}.m0{margin:0}.mt8{margin-top:8px}.mt12{margin-top:12px}.mt16{margin-top:16px}.mb8{margin-bottom:8px}.mb12{margin-bottom:12px}.mb16{margin-bottom:16px}.posrel{position:relative}.posabs{position:absolute}.round{border-radius:50%}.ohide{overflow:hidden}.bbox{box-sizing:border-box}.pointer{cursor:pointer}.w100{width:100%}.b0{border:none}"
|
|
1290
|
+
);
|
|
1291
|
+
|
|
1292
|
+
// src/helmet.ts
|
|
1293
|
+
var DESIGN_DOC_MODE_RE = /<meta\b[^>]*\bname\s*=\s*["']design_doc_mode["'][^>]*\b(?:content|value)\s*=\s*["'](\w+)["']/i;
|
|
1294
|
+
var CANVAS_BG_LIGHT = "#f0eee6";
|
|
1295
|
+
var CANVAS_BG_DARK = "#2e2c26";
|
|
1296
|
+
function createHelmetManager(doc, isStreaming) {
|
|
1297
|
+
const mounted = /* @__PURE__ */ new Set();
|
|
1298
|
+
const live = /* @__PURE__ */ new Map();
|
|
1299
|
+
let designDocMode = null;
|
|
1300
|
+
let canvasStyleEl = null;
|
|
1301
|
+
let appTheme = "light";
|
|
1302
|
+
try {
|
|
1303
|
+
const ds = doc.documentElement.dataset.theme;
|
|
1304
|
+
appTheme = ds === "dark" || ds === "light" ? ds : new URLSearchParams(doc.defaultView?.location.search ?? "").get(
|
|
1305
|
+
"theme"
|
|
1306
|
+
) === "dark" ? "dark" : "light";
|
|
1307
|
+
} catch {
|
|
1308
|
+
}
|
|
1309
|
+
function applyCanvasBg() {
|
|
1310
|
+
if (!canvasStyleEl) return;
|
|
1311
|
+
const bg = appTheme === "dark" ? CANVAS_BG_DARK : CANVAS_BG_LIGHT;
|
|
1312
|
+
canvasStyleEl.textContent = `html,body{background:${bg}}#dc-root>.sc-host{position:relative}`;
|
|
1313
|
+
}
|
|
1314
|
+
function postDesignMode(mode) {
|
|
1315
|
+
if (window.parent === window) return;
|
|
1316
|
+
try {
|
|
1317
|
+
window.parent.postMessage({ type: "__dc_design_mode", mode }, "*");
|
|
1318
|
+
} catch {
|
|
1319
|
+
}
|
|
1320
|
+
}
|
|
1321
|
+
function setDesignDocMode(mode) {
|
|
1322
|
+
if (mode === designDocMode) return;
|
|
1323
|
+
designDocMode = mode;
|
|
1324
|
+
postDesignMode(mode);
|
|
1325
|
+
if (mode === "canvas") {
|
|
1326
|
+
doc.documentElement.setAttribute("data-dc-canvas", "");
|
|
1327
|
+
canvasStyleEl = doc.createElement("style");
|
|
1328
|
+
canvasStyleEl.setAttribute("data-dc-canvas", "");
|
|
1329
|
+
applyCanvasBg();
|
|
1330
|
+
doc.head.appendChild(canvasStyleEl);
|
|
1331
|
+
} else {
|
|
1332
|
+
doc.documentElement.removeAttribute("data-dc-canvas");
|
|
1333
|
+
canvasStyleEl?.remove();
|
|
1334
|
+
canvasStyleEl = null;
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
window.addEventListener("message", (e) => {
|
|
1338
|
+
const type = e.data && e.data.type;
|
|
1339
|
+
if (type === "__dc_theme") {
|
|
1340
|
+
const t = e.data.theme;
|
|
1341
|
+
if (t === "light" || t === "dark") {
|
|
1342
|
+
appTheme = t;
|
|
1343
|
+
applyCanvasBg();
|
|
1344
|
+
}
|
|
1345
|
+
return;
|
|
1346
|
+
}
|
|
1347
|
+
if (!designDocMode || type !== "__dc_probe") return;
|
|
1348
|
+
postDesignMode(designDocMode);
|
|
1349
|
+
});
|
|
1350
|
+
function compile(node) {
|
|
1351
|
+
const raw = [...node.children];
|
|
1352
|
+
const helmetClosed = node.nextSibling != null || node.parentNode?.nextSibling != null;
|
|
1353
|
+
if (node.hasAttribute("data-dc-atomics") && !mounted.has("__dc-atomics")) {
|
|
1354
|
+
mounted.add("__dc-atomics");
|
|
1355
|
+
const el = doc.createElement("style");
|
|
1356
|
+
el.id = "__dc-atomics";
|
|
1357
|
+
el.textContent = ATOMIC_CSS;
|
|
1358
|
+
doc.head.appendChild(el);
|
|
1359
|
+
}
|
|
1360
|
+
return (_vals, ctx) => {
|
|
1361
|
+
const name = ctx && ctx.__name || "";
|
|
1362
|
+
const streaming = !!(name && isStreaming(name));
|
|
1363
|
+
for (let i = 0; i < raw.length; i++) {
|
|
1364
|
+
const child = raw[i];
|
|
1365
|
+
const tag = child.tagName;
|
|
1366
|
+
const mayBePartial = streaming && !helmetClosed && i === raw.length - 1;
|
|
1367
|
+
if (tag === "SCRIPT") {
|
|
1368
|
+
if (mayBePartial) continue;
|
|
1369
|
+
const key = "SCRIPT|" + (child.getAttribute("src") || child.textContent || "");
|
|
1370
|
+
if (mounted.has(key)) continue;
|
|
1371
|
+
mounted.add(key);
|
|
1372
|
+
const el = doc.createElement("script");
|
|
1373
|
+
for (const { name: an, value } of [...child.attributes])
|
|
1374
|
+
el.setAttribute(an, value);
|
|
1375
|
+
if (child.textContent) el.textContent = child.textContent;
|
|
1376
|
+
doc.head.appendChild(el);
|
|
1377
|
+
} else if (tag === "LINK" || tag === "META") {
|
|
1378
|
+
if (mayBePartial) continue;
|
|
1379
|
+
const key = tag + "|" + (child.getAttribute("href") || child.getAttribute("src") || child.outerHTML);
|
|
1380
|
+
if (mounted.has(key)) continue;
|
|
1381
|
+
mounted.add(key);
|
|
1382
|
+
if (tag === "LINK") {
|
|
1383
|
+
const rel = (child.getAttribute("rel") || "").toLowerCase().split(/\s+/);
|
|
1384
|
+
const href = (child.getAttribute("href") || "").trim();
|
|
1385
|
+
const res = window.__resources;
|
|
1386
|
+
const pre = res && rel.includes("stylesheet") && !rel.includes("alternate") ? res[href] : void 0;
|
|
1387
|
+
const blob = typeof pre === "string" && pre ? bundledBlob(pre) : null;
|
|
1388
|
+
if (blob) {
|
|
1389
|
+
const el = doc.createElement("style");
|
|
1390
|
+
if (child.hasAttribute("disabled")) {
|
|
1391
|
+
el.setAttribute("media", "not all");
|
|
1392
|
+
} else if (child.getAttribute("media")) {
|
|
1393
|
+
el.setAttribute("media", child.getAttribute("media"));
|
|
1394
|
+
}
|
|
1395
|
+
if (child.getAttribute("title"))
|
|
1396
|
+
el.setAttribute("title", child.getAttribute("title"));
|
|
1397
|
+
void blob.text().then((css) => {
|
|
1398
|
+
el.textContent = css;
|
|
1399
|
+
});
|
|
1400
|
+
doc.head.appendChild(el);
|
|
1401
|
+
continue;
|
|
1402
|
+
}
|
|
1403
|
+
}
|
|
1404
|
+
doc.head.appendChild(child.cloneNode(true));
|
|
1405
|
+
} else {
|
|
1406
|
+
const key = name + "|" + i;
|
|
1407
|
+
let el = live.get(key);
|
|
1408
|
+
if (!el || el.tagName !== tag) {
|
|
1409
|
+
if (el) el.remove();
|
|
1410
|
+
el = doc.createElement(tag.toLowerCase());
|
|
1411
|
+
live.set(key, el);
|
|
1412
|
+
doc.head.appendChild(el);
|
|
1413
|
+
}
|
|
1414
|
+
for (const { name: an, value } of [...child.attributes]) {
|
|
1415
|
+
if (el.getAttribute(an) !== value) el.setAttribute(an, value);
|
|
1416
|
+
}
|
|
1417
|
+
if (el.textContent !== child.textContent)
|
|
1418
|
+
el.textContent = child.textContent;
|
|
1419
|
+
}
|
|
1420
|
+
}
|
|
1421
|
+
return null;
|
|
1422
|
+
};
|
|
1423
|
+
}
|
|
1424
|
+
return { compile, setDesignDocMode };
|
|
1425
|
+
}
|
|
1426
|
+
|
|
1427
|
+
// src/pseudo.ts
|
|
1428
|
+
function scanUnquotedUrl(css, i) {
|
|
1429
|
+
if (css[i] !== "u" && css[i] !== "U" || css.slice(i, i + 4).toLowerCase() !== "url(" || /[a-z0-9_-]/i.test(css[i - 1] ?? "")) {
|
|
1430
|
+
return -1;
|
|
1431
|
+
}
|
|
1432
|
+
let j = i + 4;
|
|
1433
|
+
while (j < css.length && /\s/.test(css[j])) j++;
|
|
1434
|
+
if (css[j] === '"' || css[j] === "'") return -1;
|
|
1435
|
+
while (j < css.length && css[j] !== ")") {
|
|
1436
|
+
if (css[j] === "\\") j++;
|
|
1437
|
+
j++;
|
|
1438
|
+
}
|
|
1439
|
+
return j < css.length ? j + 1 : css.length;
|
|
1440
|
+
}
|
|
1441
|
+
function stripComments(css) {
|
|
1442
|
+
let out = "";
|
|
1443
|
+
let quote = "";
|
|
1444
|
+
for (let i = 0; i < css.length; i++) {
|
|
1445
|
+
const c = css[i];
|
|
1446
|
+
if (quote) {
|
|
1447
|
+
if (c === "\\") {
|
|
1448
|
+
out += c + (css[i + 1] ?? "");
|
|
1449
|
+
i++;
|
|
1450
|
+
continue;
|
|
1451
|
+
}
|
|
1452
|
+
if (c === quote) quote = "";
|
|
1453
|
+
out += c;
|
|
1454
|
+
} else if (c === "'" || c === '"') {
|
|
1455
|
+
quote = c;
|
|
1456
|
+
out += c;
|
|
1457
|
+
} else if (c === "/" && css[i + 1] === "*") {
|
|
1458
|
+
const end = css.indexOf("*/", i + 2);
|
|
1459
|
+
i = end === -1 ? css.length : end + 1;
|
|
1460
|
+
out += " ";
|
|
1461
|
+
} else {
|
|
1462
|
+
const end = scanUnquotedUrl(css, i);
|
|
1463
|
+
if (end === -1) out += c;
|
|
1464
|
+
else {
|
|
1465
|
+
out += css.slice(i, end);
|
|
1466
|
+
i = end - 1;
|
|
1467
|
+
}
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
return out;
|
|
1471
|
+
}
|
|
1472
|
+
function importantify(css) {
|
|
1473
|
+
css = stripComments(css);
|
|
1474
|
+
const decls = [];
|
|
1475
|
+
let start = 0;
|
|
1476
|
+
let depth = 0;
|
|
1477
|
+
let quote = "";
|
|
1478
|
+
for (let i = 0; i < css.length; i++) {
|
|
1479
|
+
const c = css[i];
|
|
1480
|
+
if (quote) {
|
|
1481
|
+
if (c === "\\") i++;
|
|
1482
|
+
else if (c === quote) quote = "";
|
|
1483
|
+
} else if (c === "'" || c === '"') quote = c;
|
|
1484
|
+
else if (c === "(") depth++;
|
|
1485
|
+
else if (c === ")") depth = Math.max(0, depth - 1);
|
|
1486
|
+
else if (c === ";" && depth === 0) {
|
|
1487
|
+
decls.push(css.slice(start, i));
|
|
1488
|
+
start = i + 1;
|
|
1489
|
+
} else {
|
|
1490
|
+
const end = scanUnquotedUrl(css, i);
|
|
1491
|
+
if (end !== -1) i = end - 1;
|
|
1492
|
+
}
|
|
1493
|
+
}
|
|
1494
|
+
decls.push(css.slice(start));
|
|
1495
|
+
return decls.map((d) => d.trim()).filter(Boolean).map((d) => /!\s*important$/i.test(d) ? d : d + " !important").join(";");
|
|
1496
|
+
}
|
|
1497
|
+
function createPseudoSheet(doc) {
|
|
1498
|
+
let el = null;
|
|
1499
|
+
const cache = /* @__PURE__ */ new Map();
|
|
1500
|
+
let n = 0;
|
|
1501
|
+
return (pseudo, css) => {
|
|
1502
|
+
const k = pseudo + "|" + css;
|
|
1503
|
+
const hit = cache.get(k);
|
|
1504
|
+
if (hit) return hit;
|
|
1505
|
+
if (!el) {
|
|
1506
|
+
el = doc.createElement("style");
|
|
1507
|
+
doc.head.appendChild(el);
|
|
1508
|
+
}
|
|
1509
|
+
const cls = "scp" + (n++).toString(36);
|
|
1510
|
+
const isPseudoElement = pseudo === "before" || pseudo === "after";
|
|
1511
|
+
const sel = isPseudoElement ? "." + cls + "::" + pseudo : "." + cls + ":" + pseudo;
|
|
1512
|
+
el.sheet.insertRule(
|
|
1513
|
+
sel + "{" + (isPseudoElement ? css : importantify(css)) + "}",
|
|
1514
|
+
el.sheet.cssRules.length
|
|
1515
|
+
);
|
|
1516
|
+
cache.set(k, cls);
|
|
1517
|
+
return cls;
|
|
1518
|
+
};
|
|
1519
|
+
}
|
|
1520
|
+
|
|
1521
|
+
// src/registry.ts
|
|
1522
|
+
function createRegistry() {
|
|
1523
|
+
const entries = /* @__PURE__ */ Object.create(null);
|
|
1524
|
+
function get(name) {
|
|
1525
|
+
return entries[name] || (entries[name] = {
|
|
1526
|
+
html: "",
|
|
1527
|
+
tpl: null,
|
|
1528
|
+
Logic: null,
|
|
1529
|
+
jsStreaming: false,
|
|
1530
|
+
htmlStreaming: false,
|
|
1531
|
+
ver: 0,
|
|
1532
|
+
subs: /* @__PURE__ */ new Set(),
|
|
1533
|
+
fetched: false
|
|
1534
|
+
});
|
|
1535
|
+
}
|
|
1536
|
+
function bump(name) {
|
|
1537
|
+
const r = get(name);
|
|
1538
|
+
r.ver++;
|
|
1539
|
+
for (const fn of r.subs) fn();
|
|
1540
|
+
}
|
|
1541
|
+
return {
|
|
1542
|
+
entries,
|
|
1543
|
+
get,
|
|
1544
|
+
bump,
|
|
1545
|
+
bumpAll() {
|
|
1546
|
+
for (const n in entries) bump(n);
|
|
1547
|
+
}
|
|
1548
|
+
};
|
|
1549
|
+
}
|
|
1550
|
+
|
|
1551
|
+
// src/runtime.ts
|
|
1552
|
+
var COMPONENT_DIR = ".";
|
|
1553
|
+
function createRuntime(doc = document) {
|
|
1554
|
+
const registry = createRegistry();
|
|
1555
|
+
const pseudoClass = createPseudoSheet(doc);
|
|
1556
|
+
const helmet = createHelmetManager(
|
|
1557
|
+
doc,
|
|
1558
|
+
(name) => registry.get(name).htmlStreaming
|
|
1559
|
+
);
|
|
1560
|
+
const external = createExternalModules(() => registry.bumpAll());
|
|
1561
|
+
const factory = createComponentFactory(registry, ensureFetched);
|
|
1562
|
+
const host = {
|
|
1563
|
+
component: (name) => factory.getDC(name),
|
|
1564
|
+
placeholder: (props) => h(Placeholder, props),
|
|
1565
|
+
helmet: (node) => helmet.compile(node),
|
|
1566
|
+
loadExternal: (kind, url, after) => external.load(kind, url, after),
|
|
1567
|
+
resolveExternal: (url, name) => external.resolve(url, name),
|
|
1568
|
+
resolveExternalGlobal: (url, name) => external.resolveGlobal(url, name),
|
|
1569
|
+
resolveExternalError: (url, name) => external.getError(url, name),
|
|
1570
|
+
pseudoClass
|
|
1571
|
+
};
|
|
1572
|
+
function ensureFetched(name) {
|
|
1573
|
+
const r = registry.get(name);
|
|
1574
|
+
if (r.fetched) return;
|
|
1575
|
+
r.fetched = true;
|
|
1576
|
+
const url = COMPONENT_DIR + "/" + encodeURIComponent(name) + ".dc.html";
|
|
1577
|
+
const res = window.__resources;
|
|
1578
|
+
const pre = res ? res[url] : void 0;
|
|
1579
|
+
const target = typeof pre === "string" && pre ? pre : url;
|
|
1580
|
+
const blob = bundledBlob(target);
|
|
1581
|
+
(blob ? blob.text() : fetch(target).then((res2) => {
|
|
1582
|
+
if (!res2.ok) {
|
|
1583
|
+
console.error(
|
|
1584
|
+
'[dc-runtime] sibling fetch for "' + name + '" failed:',
|
|
1585
|
+
url,
|
|
1586
|
+
"returned",
|
|
1587
|
+
res2.status,
|
|
1588
|
+
"\u2014 the reference renders as an empty placeholder."
|
|
1589
|
+
);
|
|
1590
|
+
return "";
|
|
1591
|
+
}
|
|
1592
|
+
return res2.text();
|
|
1593
|
+
})).then((t) => {
|
|
1594
|
+
if (!t) return;
|
|
1595
|
+
const parsed = parseDcText(t);
|
|
1596
|
+
if (!parsed) {
|
|
1597
|
+
console.error(
|
|
1598
|
+
'[dc-runtime] sibling fetch for "' + name + '":',
|
|
1599
|
+
url,
|
|
1600
|
+
"has no <x-dc> block \u2014 not a Design Component."
|
|
1601
|
+
);
|
|
1602
|
+
return;
|
|
1603
|
+
}
|
|
1604
|
+
if (parsed.props) r.propsMeta = parsed.props;
|
|
1605
|
+
if (parsed.preview) r.preview = parsed.preview;
|
|
1606
|
+
if (parsed.template && !r.html) updateHtml(name, parsed.template);
|
|
1607
|
+
if (parsed.js && !r.Logic) updateJs(name, parsed.js);
|
|
1608
|
+
}).catch(
|
|
1609
|
+
(e) => console.error(
|
|
1610
|
+
'[dc-runtime] sibling fetch for "' + name + '" threw:',
|
|
1611
|
+
url,
|
|
1612
|
+
e
|
|
1613
|
+
)
|
|
1614
|
+
);
|
|
1615
|
+
}
|
|
1616
|
+
let rootName = null;
|
|
1617
|
+
function updateHtml(name, html) {
|
|
1618
|
+
const r = registry.get(name);
|
|
1619
|
+
r.html = html;
|
|
1620
|
+
if (name === rootName) {
|
|
1621
|
+
const mode = DESIGN_DOC_MODE_RE.exec(html)?.[1] ?? null;
|
|
1622
|
+
if (mode || !r.htmlStreaming) helmet.setDesignDocMode(mode);
|
|
1623
|
+
}
|
|
1624
|
+
try {
|
|
1625
|
+
r.tpl = compileTemplate(html, host);
|
|
1626
|
+
} catch (e) {
|
|
1627
|
+
console.error("[dc-runtime] template compile FAILED for", name, e);
|
|
1628
|
+
}
|
|
1629
|
+
registry.bump(name);
|
|
1630
|
+
}
|
|
1631
|
+
function updateJs(name, src) {
|
|
1632
|
+
const r = registry.get(name);
|
|
1633
|
+
const seq = r.jsSeq = (r.jsSeq || 0) + 1;
|
|
1634
|
+
try {
|
|
1635
|
+
const Cls = evalDcLogic(src);
|
|
1636
|
+
if (r.jsSeq !== seq) return;
|
|
1637
|
+
if (typeof Cls !== "function") {
|
|
1638
|
+
r.logicError = name + ".dc.html: <script data-dc-script> must define `class Component extends DCLogic`";
|
|
1639
|
+
} else {
|
|
1640
|
+
r.logicError = null;
|
|
1641
|
+
r.Logic = Cls;
|
|
1642
|
+
}
|
|
1643
|
+
} catch (e) {
|
|
1644
|
+
if (r.jsSeq !== seq) return;
|
|
1645
|
+
console.error(
|
|
1646
|
+
"[dc-runtime] logic class eval FAILED for",
|
|
1647
|
+
name,
|
|
1648
|
+
"\u2014 the template renders with props only.",
|
|
1649
|
+
e
|
|
1650
|
+
);
|
|
1651
|
+
r.logicError = name + ": " + (e instanceof Error && e.message ? e.message : String(e));
|
|
1652
|
+
}
|
|
1653
|
+
registry.bump(name);
|
|
1654
|
+
}
|
|
1655
|
+
function setStreaming(name, kind, on) {
|
|
1656
|
+
const r = registry.get(name);
|
|
1657
|
+
if (kind === "html") r.htmlStreaming = !!on;
|
|
1658
|
+
else r.jsStreaming = !!on;
|
|
1659
|
+
let any = false;
|
|
1660
|
+
for (const n in registry.entries) {
|
|
1661
|
+
const e = registry.entries[n];
|
|
1662
|
+
if (e && (e.htmlStreaming || e.jsStreaming)) {
|
|
1663
|
+
any = true;
|
|
1664
|
+
break;
|
|
1665
|
+
}
|
|
1666
|
+
}
|
|
1667
|
+
doc.documentElement.classList.toggle("sc-dc-streaming", any);
|
|
1668
|
+
registry.bump(name);
|
|
1669
|
+
}
|
|
1670
|
+
function dcUpdate(name, kind, content, streaming) {
|
|
1671
|
+
if (streaming) registry.get(name).fetched = true;
|
|
1672
|
+
if (kind === "html") {
|
|
1673
|
+
setStreaming(name, "html", !!streaming);
|
|
1674
|
+
updateHtml(name, content);
|
|
1675
|
+
} else if (kind === "js") {
|
|
1676
|
+
setStreaming(name, "js", !!streaming);
|
|
1677
|
+
if (!streaming) updateJs(name, content);
|
|
1678
|
+
} else if (kind === "props") {
|
|
1679
|
+
const { props, preview } = parseDataProps(content);
|
|
1680
|
+
const r = registry.get(name);
|
|
1681
|
+
r.propsMeta = props ?? void 0;
|
|
1682
|
+
r.preview = preview;
|
|
1683
|
+
registry.bump(name);
|
|
1684
|
+
}
|
|
1685
|
+
}
|
|
1686
|
+
function setProps(name, overrides) {
|
|
1687
|
+
registry.get(name).propOverrides = overrides && typeof overrides === "object" ? { ...overrides } : null;
|
|
1688
|
+
registry.bump(name);
|
|
1689
|
+
}
|
|
1690
|
+
function adoptParsed(name, parsed) {
|
|
1691
|
+
if (!parsed) return;
|
|
1692
|
+
const r = registry.get(name);
|
|
1693
|
+
if (parsed.props) r.propsMeta = parsed.props;
|
|
1694
|
+
if (parsed.preview) r.preview = parsed.preview;
|
|
1695
|
+
if (parsed.template) updateHtml(name, parsed.template);
|
|
1696
|
+
if (parsed.js) updateJs(name, parsed.js);
|
|
1697
|
+
}
|
|
1698
|
+
return {
|
|
1699
|
+
registry,
|
|
1700
|
+
getDC: factory.getDC,
|
|
1701
|
+
updateHtml,
|
|
1702
|
+
updateJs,
|
|
1703
|
+
dcUpdate,
|
|
1704
|
+
setProps,
|
|
1705
|
+
adoptParsed,
|
|
1706
|
+
setRootName: (name) => {
|
|
1707
|
+
rootName = name;
|
|
1708
|
+
},
|
|
1709
|
+
markFetched: (name) => {
|
|
1710
|
+
registry.get(name).fetched = true;
|
|
1711
|
+
},
|
|
1712
|
+
annotatedTemplate: (name) => {
|
|
1713
|
+
const r = registry.get(name);
|
|
1714
|
+
return r.tpl && r.tpl.__annotated || null;
|
|
1715
|
+
},
|
|
1716
|
+
templateSource: (name) => registry.get(name).html || null,
|
|
1717
|
+
StreamableLogic
|
|
1718
|
+
};
|
|
1719
|
+
}
|
|
1720
|
+
|
|
1721
|
+
// src/stream-state.ts
|
|
1722
|
+
function createStreamTracker(staleMs = 6e4, now = Date.now) {
|
|
1723
|
+
const since = /* @__PURE__ */ new Map();
|
|
1724
|
+
const liveOne = (n) => {
|
|
1725
|
+
const t = since.get(n);
|
|
1726
|
+
if (t === void 0) return false;
|
|
1727
|
+
if (now() - t > staleMs) {
|
|
1728
|
+
since.delete(n);
|
|
1729
|
+
return false;
|
|
1730
|
+
}
|
|
1731
|
+
return true;
|
|
1732
|
+
};
|
|
1733
|
+
return {
|
|
1734
|
+
push(name, streaming, viewportKey) {
|
|
1735
|
+
if (viewportKey === "dc-model") return;
|
|
1736
|
+
if (streaming) since.set(name, now());
|
|
1737
|
+
else since.delete(name);
|
|
1738
|
+
},
|
|
1739
|
+
live(name) {
|
|
1740
|
+
if (name !== void 0) return liveOne(name);
|
|
1741
|
+
for (const n of [...since.keys()]) if (liveOne(n)) return true;
|
|
1742
|
+
return false;
|
|
1743
|
+
}
|
|
1744
|
+
};
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
// src/index.ts
|
|
1748
|
+
function hideRawTemplate() {
|
|
1749
|
+
const s = document.createElement("style");
|
|
1750
|
+
s.textContent = "x-dc{display:none!important}";
|
|
1751
|
+
document.head.appendChild(s);
|
|
1752
|
+
}
|
|
1753
|
+
function loadScript(src, integrity) {
|
|
1754
|
+
return new Promise((resolve2, reject) => {
|
|
1755
|
+
//! nosemgrep: create-script-element
|
|
1756
|
+
const s = document.createElement("script");
|
|
1757
|
+
s.src = src;
|
|
1758
|
+
if (integrity) {
|
|
1759
|
+
s.integrity = integrity;
|
|
1760
|
+
s.crossOrigin = "anonymous";
|
|
1761
|
+
}
|
|
1762
|
+
s.async = false;
|
|
1763
|
+
s.onload = () => resolve2();
|
|
1764
|
+
s.onerror = () => reject(new Error(`failed to load ${src}`));
|
|
1765
|
+
document.head.appendChild(s);
|
|
1766
|
+
});
|
|
1767
|
+
}
|
|
1768
|
+
function loadReactUmd() {
|
|
1769
|
+
const w = window;
|
|
1770
|
+
if (w.React && w.ReactDOM) return Promise.resolve();
|
|
1771
|
+
const react = cdnScriptFor(REACT_URL, REACT_SRI);
|
|
1772
|
+
const reactDom = cdnScriptFor(REACT_DOM_URL, REACT_DOM_SRI);
|
|
1773
|
+
return Promise.all([
|
|
1774
|
+
loadScript(react.src, react.integrity),
|
|
1775
|
+
loadScript(reactDom.src, reactDom.integrity)
|
|
1776
|
+
]).then(() => void 0);
|
|
1777
|
+
}
|
|
1778
|
+
function init() {
|
|
1779
|
+
const runtime = createRuntime(document);
|
|
1780
|
+
let rootName = "Root";
|
|
1781
|
+
const baseCss = document.createElement("style");
|
|
1782
|
+
baseCss.textContent = BASE_CSS;
|
|
1783
|
+
document.head.prepend(baseCss);
|
|
1784
|
+
const notifyHost = () => {
|
|
1785
|
+
if (window.parent === window) return;
|
|
1786
|
+
const r = runtime.registry.entries[rootName];
|
|
1787
|
+
try {
|
|
1788
|
+
window.parent.postMessage(
|
|
1789
|
+
{
|
|
1790
|
+
type: "__dc_booted",
|
|
1791
|
+
rootName,
|
|
1792
|
+
propsMeta: r && r.propsMeta || null,
|
|
1793
|
+
preview: r && r.preview || null
|
|
1794
|
+
},
|
|
1795
|
+
"*"
|
|
1796
|
+
);
|
|
1797
|
+
} catch {
|
|
1798
|
+
}
|
|
1799
|
+
};
|
|
1800
|
+
const streams = createStreamTracker();
|
|
1801
|
+
const api = {
|
|
1802
|
+
__dcUpdate: (name, kind, content, streaming, viewportKey) => {
|
|
1803
|
+
streams.push(name, streaming, viewportKey);
|
|
1804
|
+
runtime.dcUpdate(name, kind, content, streaming);
|
|
1805
|
+
if (name === rootName && !streaming && kind === "props") notifyHost();
|
|
1806
|
+
},
|
|
1807
|
+
__dcStreaming: (name) => streams.live(name),
|
|
1808
|
+
__dcSetProps: (name, overrides) => runtime.setProps(name, overrides),
|
|
1809
|
+
/** Name of the component currently mounted as the page root — DC tools
|
|
1810
|
+
* push their template-stream here when targeting "the open page". */
|
|
1811
|
+
__dcRootName: () => rootName,
|
|
1812
|
+
/** Editor bridge — the encoded, `data-dc-tpl`-annotated template source.
|
|
1813
|
+
* The host editor parses this into its own template DOM so it can map a
|
|
1814
|
+
* rendered node (carrying the same `data-dc-tpl`) back to the source
|
|
1815
|
+
* node that emitted it. Returns the encoded form (`sc-camel-*` attrs,
|
|
1816
|
+
* `<sc-raw-*>`/`<sc-helmet>` tags); the editor decodes on serialize. */
|
|
1817
|
+
__dcAnnotatedTemplate: (name) => runtime.annotatedTemplate(name),
|
|
1818
|
+
/** Editor bridge — the *original* (decoded) template source. */
|
|
1819
|
+
__dcTemplateSource: (name) => runtime.templateSource(name),
|
|
1820
|
+
__dcBoot: () => {
|
|
1821
|
+
rootName = boot(runtime, document) ?? rootName;
|
|
1822
|
+
notifyHost();
|
|
1823
|
+
},
|
|
1824
|
+
__dcRegistry: runtime.registry.entries,
|
|
1825
|
+
getDC: (name) => runtime.getDC(name),
|
|
1826
|
+
// `DCLogic` is the documented base class name; `StreamableLogic` is the
|
|
1827
|
+
// implementation alias kept for any project that already references it.
|
|
1828
|
+
DCLogic: runtime.StreamableLogic,
|
|
1829
|
+
StreamableLogic: runtime.StreamableLogic
|
|
1830
|
+
};
|
|
1831
|
+
Object.assign(window, api);
|
|
1832
|
+
window.__dcContentKeyed = true;
|
|
1833
|
+
if (document.readyState !== "loading") api.__dcBoot();
|
|
1834
|
+
else document.addEventListener("DOMContentLoaded", () => api.__dcBoot());
|
|
1835
|
+
}
|
|
1836
|
+
hideRawTemplate();
|
|
1837
|
+
loadReactUmd().then(init).catch((err) => {
|
|
1838
|
+
console.error("[dc] failed to load React or boot:", err);
|
|
1839
|
+
throw err;
|
|
1840
|
+
});
|
|
1841
|
+
})();
|