<commit_before>import QtQuick 2.0

Item {
    implicitWidth: 40.0
    implicitHeight: 40.0

	property Palette palette: Palette
	property ColorSet colorSet: alarm ? (blinkTimer.blink ? alarmBlink : palette.alarm) :
								warning ? (blinkTimer.blink ? warningBlink : palette.warning) :
								active ? palette.active : palette.inactive
	property color baseColor: colorSet.base
	property color fillColor: colorSet.fill
	property color tintColor: colorSet.tint
	property color shadeColor: colorSet.shade
	property color foregroundColor: colorSet.foreground
	property color backgroundColor: colorSet.background
	property color strokeColor: colorSet.stroke
	property color blankColor: palette.neutral.fill
	property real lineWidth: 2.0
	property bool active: false
	property bool warning: false
	property bool alarm: false

	Behavior on baseColor { ColorAnimation {} }
	Behavior on fillColor { ColorAnimation {} }
	Behavior on tintColor { ColorAnimation {} }
	Behavior on shadeColor { ColorAnimation {} }
	Behavior on foregroundColor { ColorAnimation {} }
	Behavior on backgroundColor { ColorAnimation {} }
	Behavior on strokeColor { ColorAnimation {} }

	ColorSet {
		id: warningBlink

		base: Qt.lighter(palette.warning.base)
		fill: Qt.lighter(palette.warning.fill)
		tint: Qt.lighter(palette.warning.tint)
		shade: Qt.lighter(palette.warning.shade)
		foreground: Qt.lighter(palette.warning.foreground)
		background: Qt.lighter(palette.warning.background)
		stroke: palette.warning.stroke
	}

	ColorSet {
		id: alarmBlink

		base: Qt.lighter(palette.alarm.base)
		fill: palette.alarm.stroke
		tint: palette.alarm.shade
		shade: palette.alarm.tint
		foreground: palette.alarm.background
		background: palette.alarm.foreground
		stroke: palette.alarm.fill
	}

	Timer {
		id: blinkTimer

		interval: blink ? 250 : alarm ? 250 : 1500
		running: warning || alarm
		repeat: true

		property bool blink: false

		onTriggered: blink = !blink
	}

}<commit_msg>Use a function for 'colorSet' binding. Add 'QML_Base-4' workaround.<commit_after>import QtQuick 2.0

//<workaround id="QML_Base-4" target="Qt" cause="QTBUG-34418">
// Palette is a singleton.
// Singletons require explicit import to load qmldir file.
import "."
//</workaround>

Item {
    implicitWidth: 40.0
    implicitHeight: 40.0

	property Palette palette: Palette
	property ColorSet colorSet: currentStateColorSet()
	property color baseColor: colorSet.base
	property color fillColor: colorSet.fill
	property color tintColor: colorSet.tint
	property color shadeColor: colorSet.shade
	property color foregroundColor: colorSet.foreground
	property color backgroundColor: colorSet.background
	property color strokeColor: colorSet.stroke
	property color blankColor: palette.neutral.fill
	property real lineWidth: 2.0
	property bool active: false
	property bool warning: false
	property bool alarm: false

	Behavior on baseColor { ColorAnimation {} }
	Behavior on fillColor { ColorAnimation {} }
	Behavior on tintColor { ColorAnimation {} }
	Behavior on shadeColor { ColorAnimation {} }
	Behavior on foregroundColor { ColorAnimation {} }
	Behavior on backgroundColor { ColorAnimation {} }
	Behavior on strokeColor { ColorAnimation {} }

	ColorSet {
		id: warningBlink

		base: Qt.lighter(palette.warning.base)
		fill: Qt.lighter(palette.warning.fill)
		tint: Qt.lighter(palette.warning.tint)
		shade: Qt.lighter(palette.warning.shade)
		foreground: Qt.lighter(palette.warning.foreground)
		background: Qt.lighter(palette.warning.background)
		stroke: palette.warning.stroke
	}

	ColorSet {
		id: alarmBlink

		base: Qt.lighter(palette.alarm.base)
		fill: palette.alarm.stroke
		tint: palette.alarm.shade
		shade: palette.alarm.tint
		foreground: palette.alarm.background
		background: palette.alarm.foreground
		stroke: palette.alarm.fill
	}

	Timer {
		id: blinkTimer

		interval: blink ? 250 : alarm ? 250 : 1500
		running: warning || alarm
		repeat: true

		property bool blink: false

		onTriggered: blink = !blink
	}

	function currentStateColorSet() {
		return alarm ? (blinkTimer.blink ? alarmBlink : palette.alarm) :
			   warning ? (blinkTimer.blink ? warningBlink : palette.warning) :
			   active ? palette.active : palette.inactive
	}
}
{'fraction_non_alphanumeric': 0.0895451297928078, 'fraction_numerical': 0.011193141224100976, 'mean_word_length': 4.3984575835475574, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4011245', 'n_tokens_mistral': 1434, 'n_tokens_neox': 1280, 'n_words': 344}